Skip to content

Commit 11c07aa

Browse files
committed
Addresses review comments
1 parent 67a47a1 commit 11c07aa

File tree

13 files changed

+391
-606
lines changed

13 files changed

+391
-606
lines changed

RATapi/examples/absorption/absorption.ipynb

Lines changed: 17 additions & 546 deletions
Large diffs are not rendered by default.

RATapi/examples/absorption/absorption.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
import pathlib
32

43
import numpy as np
@@ -78,18 +77,18 @@ def absorption():
7877
problem.resolution_parameters.set_fields(0, fit=True)
7978

8079
# Now add the data we need
81-
data_path = os.path.join(pathlib.Path(__file__).parents[1].resolve(), "data")
80+
data_path = pathlib.Path(__file__).parents[1] / "data"
8281

83-
data_1 = np.loadtxt(os.path.join(data_path, "D2O_spin_down.dat"))
82+
data_1 = np.loadtxt(data_path / "D2O_spin_down.dat")
8483
problem.data.append(name="D2O_dn", data=data_1)
8584

86-
data_2 = np.loadtxt(os.path.join(data_path, "D2O_spin_up.dat"))
85+
data_2 = np.loadtxt(data_path / "D2O_spin_up.dat")
8786
problem.data.append(name="D2O_up", data=data_2)
8887

89-
data_3 = np.loadtxt(os.path.join(data_path, "H2O_spin_down.dat"))
88+
data_3 = np.loadtxt(data_path / "H2O_spin_down.dat")
9089
problem.data.append(name="H2O_dn", data=data_3)
9190

92-
data_4 = np.loadtxt(os.path.join(data_path, "H2O_spin_up.dat"))
91+
data_4 = np.loadtxt(data_path / "H2O_spin_up.dat")
9392
problem.data.append(name="H2O_up", data=data_4)
9493

9594
# Add the custom file

RATapi/examples/convert_rascal_project/convert_rascal.ipynb

Lines changed: 334 additions & 11 deletions
Large diffs are not rendered by default.

RATapi/examples/domains/domains_custom_XY.ipynb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
"cell_type": "markdown",
1818
"metadata": {},
1919
"source": [
20-
"[IMAGES!]\n",
21-
"\n",
2220
"# Simple example of a layer containing domains using a custom XY model\n",
2321
"\n",
2422
"Domains custom XY models operate in the same way as domains custom layer models, in that there is an additional input to the custom model specifying the domain to be calculated:\n",
@@ -456,7 +454,7 @@
456454
"text": [
457455
"Starting RAT ───────────────────────────────────────────────────────────────────────────────────────────────────────────\n",
458456
"\n",
459-
"Elapsed time is 0.058 seconds\n",
457+
"Elapsed time is 0.071 seconds\n",
460458
"\n",
461459
"Finished RAT ───────────────────────────────────────────────────────────────────────────────────────────────────────────\n",
462460
"\n"

RATapi/examples/languages/run_custom_file_languages.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
project = setup_problem.make_example_problem()
1313
controls = RAT.Controls()
14+
controls.calcSldDuringFit = True
1415

1516
# Python
1617
start = time.time()

RATapi/examples/languages/setup_problem.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
import pathlib
32

43
import numpy as np
@@ -39,10 +38,10 @@ def make_example_problem():
3938
# and H2O. Load these datafiles in and put them in the data block
4039

4140
# Read in the datafiles
42-
data_path = os.path.join(pathlib.Path(__file__).parents[1].resolve(), "data")
43-
D2O_data = np.loadtxt(os.path.join(data_path, "c_PLP0016596.dat"), delimiter=",")
44-
SMW_data = np.loadtxt(os.path.join(data_path, "c_PLP0016601.dat"), delimiter=",")
45-
H2O_data = np.loadtxt(os.path.join(data_path, "c_PLP0016607.dat"), delimiter=",")
41+
data_path = pathlib.Path("../data")
42+
D2O_data = np.loadtxt(data_path / "c_PLP0016596.dat", delimiter=",")
43+
SMW_data = np.loadtxt(data_path / "c_PLP0016601.dat", delimiter=",")
44+
H2O_data = np.loadtxt(data_path / "c_PLP0016607.dat", delimiter=",")
4645

4746
# Add the data to the project - note this data has a resolution 4th column
4847
problem.data.append(name="Bilayer / D2O", data=D2O_data)

RATapi/examples/non_polarised/DSPC_custom_XY.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
import pathlib
32

43
import numpy as np
@@ -59,10 +58,10 @@ def DSPC_custom_XY():
5958
# Water and H2O. Load these datafiles in and put them in the data block
6059

6160
# Read in the datafiles
62-
data_path = os.path.join(pathlib.Path(__file__).parents[1].resolve(), "data")
63-
D2O_data = np.loadtxt(os.path.join(data_path, "c_PLP0016596.dat"), delimiter=",")
64-
SMW_data = np.loadtxt(os.path.join(data_path, "c_PLP0016601.dat"), delimiter=",")
65-
H2O_data = np.loadtxt(os.path.join(data_path, "c_PLP0016607.dat"), delimiter=",")
61+
data_path = pathlib.Path(__file__).parents[1] / "data"
62+
D2O_data = np.loadtxt(data_path / "c_PLP0016596.dat", delimiter=",")
63+
SMW_data = np.loadtxt(data_path / "c_PLP0016601.dat", delimiter=",")
64+
H2O_data = np.loadtxt(data_path / "c_PLP0016607.dat", delimiter=",")
6665

6766
# Add the data to the project - note this data has a resolution 4th column
6867
problem.data.append(name="Bilayer / D2O", data=D2O_data)

RATapi/examples/non_polarised/DSPC_custom_layers.ipynb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"metadata": {},
88
"outputs": [],
99
"source": [
10-
"import os\n",
1110
"import pathlib\n",
1211
"\n",
1312
"import numpy as np\n",
@@ -485,10 +484,10 @@
485484
"outputs": [],
486485
"source": [
487486
"# Read in the datafiles\n",
488-
"data_path = os.path.join(pathlib.Path.cwd().parents[0].resolve(), \"data\")\n",
489-
"D2O_data = np.loadtxt(os.path.join(data_path, \"c_PLP0016596.dat\"), delimiter=\",\")\n",
490-
"SMW_data = np.loadtxt(os.path.join(data_path, \"c_PLP0016601.dat\"), delimiter=\",\")\n",
491-
"H2O_data = np.loadtxt(os.path.join(data_path, \"c_PLP0016607.dat\"), delimiter=\",\")\n",
487+
"data_path = pathlib.Path(\"../data\")\n",
488+
"D2O_data = np.loadtxt(data_path / \"c_PLP0016596.dat\", delimiter=\",\")\n",
489+
"SMW_data = np.loadtxt(data_path / \"c_PLP0016601.dat\", delimiter=\",\")\n",
490+
"H2O_data = np.loadtxt(data_path / \"c_PLP0016607.dat\", delimiter=\",\")\n",
492491
"\n",
493492
"# Add the data to the project - note this data has a resolution 4th column\n",
494493
"problem.data.append(name=\"Bilayer / D2O\", data=D2O_data, data_range=[0.013, 0.37])\n",
@@ -819,7 +818,7 @@
819818
"text": [
820819
"Starting RAT ───────────────────────────────────────────────────────────────────────────────────────────────────────────\n",
821820
"\n",
822-
"Elapsed time is 0.023 seconds\n",
821+
"Elapsed time is 0.020 seconds\n",
823822
"\n",
824823
"Finished RAT ───────────────────────────────────────────────────────────────────────────────────────────────────────────\n",
825824
"\n"

RATapi/examples/non_polarised/DSPC_custom_layers.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
import pathlib
32

43
import numpy as np
@@ -39,10 +38,10 @@ def DSPC_custom_layers():
3938
# Water and H2O. Load these datafiles in and put them in the data block
4039

4140
# Read in the datafiles
42-
data_path = os.path.join(pathlib.Path(__file__).parents[1].resolve(), "data")
43-
D2O_data = np.loadtxt(os.path.join(data_path, "c_PLP0016596.dat"), delimiter=",")
44-
SMW_data = np.loadtxt(os.path.join(data_path, "c_PLP0016601.dat"), delimiter=",")
45-
H2O_data = np.loadtxt(os.path.join(data_path, "c_PLP0016607.dat"), delimiter=",")
41+
data_path = pathlib.Path(__file__).parents[1] / "data"
42+
D2O_data = np.loadtxt(data_path / "c_PLP0016596.dat", delimiter=",")
43+
SMW_data = np.loadtxt(data_path / "c_PLP0016601.dat", delimiter=",")
44+
H2O_data = np.loadtxt(data_path / "c_PLP0016607.dat", delimiter=",")
4645

4746
# Add the data to the project - note this data has a resolution 4th column
4847
problem.data.append(name="Bilayer / D2O", data=D2O_data, data_range=[0.013, 0.37])

RATapi/examples/non_polarised/DSPC_custom_xy.ipynb

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"metadata": {},
88
"outputs": [],
99
"source": [
10-
"import os\n",
1110
"import pathlib\n",
1211
"\n",
1312
"import numpy as np\n",
@@ -125,10 +124,10 @@
125124
"outputs": [],
126125
"source": [
127126
"# Read in the datafiles\n",
128-
"data_path = os.path.join(pathlib.Path.cwd().parents[0].resolve(), \"data\")\n",
129-
"D2O_data = np.loadtxt(os.path.join(data_path, \"c_PLP0016596.dat\"), delimiter=\",\")\n",
130-
"SMW_data = np.loadtxt(os.path.join(data_path, \"c_PLP0016601.dat\"), delimiter=\",\")\n",
131-
"H2O_data = np.loadtxt(os.path.join(data_path, \"c_PLP0016607.dat\"), delimiter=\",\")\n",
127+
"data_path = pathlib.Path(\"../data\")\n",
128+
"D2O_data = np.loadtxt(data_path / \"c_PLP0016596.dat\", delimiter=\",\")\n",
129+
"SMW_data = np.loadtxt(data_path / \"c_PLP0016601.dat\", delimiter=\",\")\n",
130+
"H2O_data = np.loadtxt(data_path / \"c_PLP0016607.dat\", delimiter=\",\")\n",
132131
"\n",
133132
"# Add the data to the project - note this data has a resolution 4th column\n",
134133
"problem.data.append(name=\"Bilayer / D2O\", data=D2O_data)\n",
@@ -245,7 +244,7 @@
245244
"source": [
246245
"## Running the Model\n",
247246
"\n",
248-
"We do this by first making a controls block as previously. We'll run a Differential Evolution, and then a Bayesian analysis:"
247+
"We do this by first making a controls block as previously. We'll run a Differential Evolution:"
249248
]
250249
},
251250
{
@@ -264,7 +263,7 @@
264263
"Running Differential Evolution\n",
265264
"\n",
266265
"Final chi squared is 8.39155\n",
267-
"Elapsed time is 127.146 seconds\n",
266+
"Elapsed time is 108.162 seconds\n",
268267
"\n",
269268
"Finished RAT ───────────────────────────────────────────────────────────────────────────────────────────────────────────\n",
270269
"\n"

0 commit comments

Comments
 (0)