Skip to content

Commit 7e9565f

Browse files
committed
Refines tutorial comments for clarity and consistency
1 parent e61e174 commit 7e9565f

File tree

1 file changed

+44
-44
lines changed

1 file changed

+44
-44
lines changed

tutorials/advanced_joint-fit_pd-neut-xray-cwl_PbSO4.py

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# %% [markdown]
2-
# # Joint Fit (Advanced Usage)
2+
# # Joint Fit (Advanced)
33
#
4-
# This example demonstrates a more flexible and advanced usage of the
5-
# EasyDiffraction library by explicitly creating and configuring some objects.
6-
# It is more suitable for users comfortable with Python programming and those
7-
# interested in custom workflows.
4+
# This example demonstrates a flexible and advanced use of the
5+
# EasyDiffraction library by explicitly creating and configuring objects.
6+
# It is intended for users who are comfortable with Python programming and are
7+
# interested in creating custom workflows.
88

99
# %% [markdown]
10-
# ## Import EasyDiffraction
10+
# ## Import Library
1111

1212
# %%
1313
from easydiffraction import (
@@ -20,29 +20,29 @@
2020
# %% [markdown]
2121
# ## Define Sample Model
2222
#
23-
# This section covers how to add sample models and modify their parameters.
23+
# This section explains how to add sample models and modify their parameters.
2424
#
25-
# ### Create sample model object
25+
# ### Create Sample Model
2626

2727
# %%
2828
model = SampleModel('pbso4')
2929

3030
# %% [markdown]
31-
# ### Define space group
31+
# ### Set Space Group
3232

3333
# %%
3434
model.space_group.name_h_m = 'P n m a'
3535

3636
# %% [markdown]
37-
# ### Define unit cell
37+
# ### Set Unit Cell
3838

3939
# %%
4040
model.cell.length_a = 8.47
4141
model.cell.length_b = 5.39
4242
model.cell.length_c = 6.95
4343

4444
# %% [markdown]
45-
# ### Define atom sites
45+
# ### Set Atom Sites
4646

4747
# %%
4848
model.atom_sites.add('Pb', 'Pb', 0.1876, 0.25, 0.167, b_iso=1.37)
@@ -55,35 +55,35 @@
5555
# %% [markdown]
5656
# ## Define Experiments
5757
#
58-
# This section teaches how to add experiments, configure their parameters, and
59-
# link to them the sample models defined in the previous step.
58+
# This section explains how to add experiments, configure their parameters, and
59+
# link the sample models defined in the previous step.
6060
#
6161
# ### Experiment 1: npd
6262
#
63-
# #### Download measured data
63+
# #### Download Data
6464

6565
# %%
6666
download_from_repository('d1a_pbso4.dat',
6767
branch='docs',
6868
destination='data')
6969

7070
# %% [markdown]
71-
# #### Create experiment object
71+
# #### Create Experiment
7272

7373
# %%
7474
expt1 = Experiment('npd',
7575
radiation_probe='neutron',
7676
data_path='data/d1a_pbso4.dat')
7777

7878
# %% [markdown]
79-
# #### Define instrument
79+
# #### Set Instrument
8080

8181
# %%
8282
expt1.instrument.setup_wavelength = 1.91
8383
expt1.instrument.calib_twotheta_offset = -0.1406
8484

8585
# %% [markdown]
86-
# #### Define peak profile
86+
# #### Set Peak Profile
8787

8888
# %%
8989
expt1.peak.broad_gauss_u = 0.139
@@ -93,16 +93,16 @@
9393
expt1.peak.broad_lorentz_y = 0.088
9494

9595
# %% [markdown]
96-
# #### Define background
96+
# #### Set Background
9797

9898
# %% [markdown]
99-
# Select desired background type
99+
# Select Background Type
100100

101101
# %%
102102
expt1.background_type = 'line-segment'
103103

104104
# %% [markdown]
105-
# Add background points
105+
# Add Background Points
106106

107107
# %%
108108
for x, y in [
@@ -118,38 +118,38 @@
118118
expt1.background.add(x, y)
119119

120120
# %% [markdown]
121-
# #### Define linked phases
121+
# #### Set Linked Phases
122122

123123
# %%
124124
expt1.linked_phases.add('pbso4', scale=1.5)
125125

126126
# %% [markdown]
127127
# ### Experiment 2: xrd
128128
#
129-
# #### Download measured data
129+
# #### Download Data
130130

131131
# %%
132132
download_from_repository('lab_pbso4.dat',
133133
branch='docs',
134134
destination='data')
135135

136136
# %% [markdown]
137-
# #### Create experiment object
137+
# #### Create Experiment
138138

139139
# %%
140140
expt2 = Experiment('xrd',
141141
radiation_probe='xray',
142142
data_path='data/lab_pbso4.dat')
143143

144144
# %% [markdown]
145-
# #### Define instrument
145+
# #### Set Instrument
146146

147147
# %%
148148
expt2.instrument.setup_wavelength = 1.540567
149149
expt2.instrument.calib_twotheta_offset = -0.05181
150150

151151
# %% [markdown]
152-
# #### Define peak profile
152+
# #### Set Peak Profile
153153

154154
# %%
155155
expt2.peak.broad_gauss_u = 0.304138
@@ -159,16 +159,16 @@
159159
expt2.peak.broad_lorentz_y = 0.057691
160160

161161
# %% [markdown]
162-
# #### Define background
162+
# #### Set Background
163163

164164
# %% [markdown]
165-
# Select desired background type
165+
# Select Background Type
166166

167167
# %%
168168
expt2.background_type = 'chebyshev polynomial'
169169

170170
# %% [markdown]
171-
# Add background points
171+
# Add Background Points
172172

173173
# %%
174174
for x, y in [
@@ -182,30 +182,30 @@
182182
expt2.background.add(x, y)
183183

184184
# %% [markdown]
185-
# #### Define linked phases
185+
# #### Set Linked Phases
186186

187187
# %%
188188
expt2.linked_phases.add('pbso4', scale=0.001)
189189

190190
# %% [markdown]
191191
# ## Define Project
192192
#
193-
# The project object is used to manage the sample model, experiments, and
194-
# analysis
193+
# The project object manages the sample model, experiments, and
194+
# analysis.
195195
#
196-
# ### Create project object
196+
# ### Create Project
197197

198198
# %%
199199
project = Project()
200200

201201
# %% [markdown]
202-
# ### Add sample model
202+
# ### Add Sample Model
203203

204204
# %%
205205
project.sample_models.add(model)
206206

207207
# %% [markdown]
208-
# ### Add experiments
208+
# ### Add Experiments
209209

210210
# %%
211211
project.experiments.add(expt1)
@@ -214,38 +214,38 @@
214214
# %% [markdown]
215215
# ## Analysis
216216
#
217-
# This section will guide you through the analysis process, including setting
218-
# up calculators and fitting models.
217+
# This section explains the analysis process, including how to set
218+
# up calculators and fit models.
219219
#
220-
# ### Set calculation engine
220+
# ### Set Calculator
221221

222222
# %%
223223
project.analysis.current_calculator = 'cryspy'
224224

225225
# %% [markdown]
226-
# ### Set fit mode
226+
# ### Set Fit Mode
227227

228228
# %%
229229
project.analysis.fit_mode = 'joint'
230230

231231
# %% [markdown]
232-
# ### Set fitting engine
232+
# ### Set Minimizer
233233

234234
# %%
235235
project.analysis.current_minimizer = 'lmfit (leastsq)'
236236

237237
# %% [markdown]
238-
# ### Set fitting parameters
238+
# ### Set Fitting Parameters
239239
#
240-
# Set sample model parameters to be fitted
240+
# Set sample model parameters to be refined
241241

242242
# %%
243243
model.cell.length_a.free = True
244244
model.cell.length_b.free = True
245245
model.cell.length_c.free = True
246246

247247
# %% [markdown]
248-
# Set experimental parameters to be fitted
248+
# Set experiment parameters to be refined
249249

250250
# %%
251251
expt1.linked_phases['pbso4'].scale.free = True
@@ -271,13 +271,13 @@
271271
term.coef.free = True
272272

273273
# %% [markdown]
274-
# ### Perform Fit
274+
# ### Run Fit
275275

276276
# %%
277277
project.analysis.fit()
278278

279279
# %% [markdown]
280-
# ### Show fitting results
280+
# ### Show Results
281281

282282
# %%
283283
project.plot_meas_vs_calc(expt_name='npd',

0 commit comments

Comments
 (0)