Convert between RAT and RasCAL-1#

RAT is backwards-compatible with RasCAL-1; any RasCAL-1 project can be converted to a RAT project and analysed using RAT, and it is also possible to convert RAT projects back into RasCAL-1 projects (although you will lose any data from features of RAT which are not in RasCAL-1!)

Convert R1 to RAT#

As an example, we can use the ‘monolayer_8_contrasts’ demo example shipped with RasCAL-1:

rascal-1

To convert this, simply navigate to the project directory, and run the following:

problem = r1ToProjectClass('monolayer_8_contrasts.mat')
from RATapi.utils.convert import r1_to_project_class

problem = r1_to_project_class('monolayer_8_contrasts.mat')

This produces a projectClass containing the R1 project, which can then be analysed as normal:

controls = controlsClass();
controls.procedure = 'de';
controls.parallel = 'contrasts';
[problem,results] = RAT(problem,controls);
plotRefSLD(problem,results);
import RATapi as RAT

controls = RAT.Controls(procedure='de', parallel='contrasts')
problem, results = RAT.run(problem, controls)
RAT.plotting.plot_ref_sld(problem, results)

Convert RAT to a RasCAL-1 Project#

It is also possible to do the opposite conversion, and convert any projectClass back to an R1 project:

projectClassToR1(problem,'saveproject',true,'dirName','testProject','fileName','myConvertedProject')
from RATapi.utils.convert import project_class_to_r1

project_class_to_r1(problem, "./testProject/myConvertedProject")

This will create the usual RasCAL-1 project structure in a directory called testProject, with a filename called myConvertedProject.mat This can then be loaded into RasCAL-1 as normal.