forked from RascalSoftware/python-RAT
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_custom_file_languages.py
More file actions
42 lines (29 loc) · 984 Bytes
/
run_custom_file_languages.py
File metadata and controls
42 lines (29 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""Test custom function languages."""
import pathlib
import time
import setup_problem
import RATapi as RAT
path = pathlib.Path(__file__).parent
project = setup_problem.make_example_problem()
controls = RAT.Controls()
controls.calcSldDuringFit = True
# Python
start = time.time()
project, results = RAT.run(project, controls)
end = time.time()
print(f"Python time is: {end - start}s\n")
RAT.plotting.plot_ref_sld(project, results)
# Matlab
project.custom_files.set_fields(0, filename="custom_bilayer.m", language="matlab", path=path)
start = time.time()
project, results = RAT.run(project, controls)
end = time.time()
print(f"Matlab time is: {end - start}s\n")
RAT.plotting.plot_ref_sld(project, results)
# C++
project.custom_files.set_fields(0, filename="custom_bilayer.dll", language="cpp", path=path)
start = time.time()
project, results = RAT.run(project, controls)
end = time.time()
print(f"C++ time is: {end - start}s\n")
RAT.plotting.plot_ref_sld(project, results)