Skip to content

Commit

Permalink
Add a point background model to TOF (#41)
Browse files Browse the repository at this point in the history
* Bump from 0.9.2 to 0.9.3 (#38)

* Fix summary (#34)

* Modify summary page

* Add measured and processed data for TOF
* Move report.cif from Analysis main view to sidebar text mode
* Show html-based analysis summary in the Analysis main view
* Allow saving analysis summary as html

* Update images for GUI tests

* Fix signing macos (#35)

* Temporarily remove the CI script for snapcraft

* Simplify build script to try code signing

* MACOS_CERTIFICATE_ENCODED (.p12 content base64 encoded) updated on github
* MACOS_CERTIFICATE_PASSWORD (.p12 password) updated on github

* Rename fpath to fname

* Migrate from altool to notarytool

* altool is depricated
* Migration instruction https://developer.apple.com/documentation/technotes/tn3147-migrating-to-the-latest-notarization-tool

* Fix spctl verbose output option

* Try using lando/code-sign-action instead of custom script

* Fix file path in the code signing script

* Update certificate identity

* Debug

* Fix identity

* more debug

* more debug

* more debug

* more debug

* debug: return after verify

* debug: return after sign

* debug: return before verify

* debug 2: return after sign

* more debug

* Another try with lando/code-sign-action

* More debug terminal

* more debug

* fix

* More fixes

* More fixes

* continue after signing

* Remove sleep before staple (moved to notarisation)

* clean up

* Rename variables and clean up

* More clean up

* Fix team-id

* Restore other steps in the build script

* Force to use numpy<2

* Use full os name in uploaded artifacts

* Windows signing (#33)

* initial test, mostly to get the filenames first

* attempt to locate the signed binary

* play with filename

* try again

* another attempt at properly delimit the string

* go back to the whole matrix before PR

* remove debug printouts

* Get path to setup_exe from Config.py

---------

Co-authored-by: Andrew Sazonov <andrew.sazonov@icloud.com>

* Prepare for releasing 0.9.2

* Fix release info [ci skip]

* Return snapcraft build script back (#37)

* Update release info

---------

Co-authored-by: Piotr Rozyczko <piotr.rozyczko@gmail.com>

* Bump from v0.9.2 to v0.9.3 (#39)

* Fix summary (#34)

* Modify summary page

* Add measured and processed data for TOF
* Move report.cif from Analysis main view to sidebar text mode
* Show html-based analysis summary in the Analysis main view
* Allow saving analysis summary as html

* Update images for GUI tests

* Fix signing macos (#35)

* Temporarily remove the CI script for snapcraft

* Simplify build script to try code signing

* MACOS_CERTIFICATE_ENCODED (.p12 content base64 encoded) updated on github
* MACOS_CERTIFICATE_PASSWORD (.p12 password) updated on github

* Rename fpath to fname

* Migrate from altool to notarytool

* altool is depricated
* Migration instruction https://developer.apple.com/documentation/technotes/tn3147-migrating-to-the-latest-notarization-tool

* Fix spctl verbose output option

* Try using lando/code-sign-action instead of custom script

* Fix file path in the code signing script

* Update certificate identity

* Debug

* Fix identity

* more debug

* more debug

* more debug

* more debug

* debug: return after verify

* debug: return after sign

* debug: return before verify

* debug 2: return after sign

* more debug

* Another try with lando/code-sign-action

* More debug terminal

* more debug

* fix

* More fixes

* More fixes

* continue after signing

* Remove sleep before staple (moved to notarisation)

* clean up

* Rename variables and clean up

* More clean up

* Fix team-id

* Restore other steps in the build script

* Force to use numpy<2

* Use full os name in uploaded artifacts

* Windows signing (#33)

* initial test, mostly to get the filenames first

* attempt to locate the signed binary

* play with filename

* try again

* another attempt at properly delimit the string

* go back to the whole matrix before PR

* remove debug printouts

* Get path to setup_exe from Config.py

---------

Co-authored-by: Andrew Sazonov <andrew.sazonov@icloud.com>

* Prepare for releasing 0.9.2

* Fix release info [ci skip]

* Return snapcraft build script back (#37)

* Update release info

---------

Co-authored-by: Piotr Rozyczko <piotr.rozyczko@gmail.com>

* Bump from v0.9.2 to v0.9.3 (#40)

* Fix summary (#34)

* Modify summary page

* Add measured and processed data for TOF
* Move report.cif from Analysis main view to sidebar text mode
* Show html-based analysis summary in the Analysis main view
* Allow saving analysis summary as html

* Update images for GUI tests

* Fix signing macos (#35)

* Temporarily remove the CI script for snapcraft

* Simplify build script to try code signing

* MACOS_CERTIFICATE_ENCODED (.p12 content base64 encoded) updated on github
* MACOS_CERTIFICATE_PASSWORD (.p12 password) updated on github

* Rename fpath to fname

* Migrate from altool to notarytool

* altool is depricated
* Migration instruction https://developer.apple.com/documentation/technotes/tn3147-migrating-to-the-latest-notarization-tool

* Fix spctl verbose output option

* Try using lando/code-sign-action instead of custom script

* Fix file path in the code signing script

* Update certificate identity

* Debug

* Fix identity

* more debug

* more debug

* more debug

* more debug

* debug: return after verify

* debug: return after sign

* debug: return before verify

* debug 2: return after sign

* more debug

* Another try with lando/code-sign-action

* More debug terminal

* more debug

* fix

* More fixes

* More fixes

* continue after signing

* Remove sleep before staple (moved to notarisation)

* clean up

* Rename variables and clean up

* More clean up

* Fix team-id

* Restore other steps in the build script

* Force to use numpy<2

* Use full os name in uploaded artifacts

* Windows signing (#33)

* initial test, mostly to get the filenames first

* attempt to locate the signed binary

* play with filename

* try again

* another attempt at properly delimit the string

* go back to the whole matrix before PR

* remove debug printouts

* Get path to setup_exe from Config.py

---------

Co-authored-by: Andrew Sazonov <andrew.sazonov@icloud.com>

* Prepare for releasing 0.9.2

* Fix release info

* Return snapcraft build script back (#37)

* Update release info

---------

Co-authored-by: Piotr Rozyczko <piotr.rozyczko@gmail.com>

* Initial implementation of point background for TOF

* Clean up debugging

* Force scipy<1.14

---------

Co-authored-by: Piotr Rozyczko <piotr.rozyczko@gmail.com>
  • Loading branch information
AndrewSazonov and rozyczko authored Jun 26, 2024
1 parent a92ed72 commit 88b962a
Show file tree
Hide file tree
Showing 14 changed files with 202 additions and 135 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,26 @@ _pd_instr.beta1 0.00224
_pd_instr.sigma0 0.409
_pd_instr.sigma1 8.118

_tof_background.coeff1 25101(108)
_tof_background.coeff2 6940(199)
_tof_background.coeff3 8460(189)
_tof_background.coeff4 3452(162)
_tof_background.coeff5 2812(157)
_tof_background.coeff6 545(122)
_tof_background.coeff7 1000(128)
_tof_background.coeff8 9(77)
_tof_background.coeff9 116(78)
_tof_background.coeff10 0.0
_tof_background.coeff11 0.0
_tof_background.coeff12 0.0
_tof_background.coeff13 0.0
_tof_background.coeff14 0.0
_tof_background.coeff15 0.0
_tof_background.coeff16 0.0
_tof_background.coeff17 0.0
_tof_background.coeff18 0.0

_diffrn_radiation.probe neutron

loop_
_pd_background.line_segment_X
_pd_background.line_segment_intensity
_pd_background.X_coordinate
3000.0 33469(55) time-of-flight
4000.0 27344(46) time-of-flight
5000.0 23749(54) time-of-flight
6000.0 20995(65) time-of-flight
7000.0 19795(71) time-of-flight
9000.0 18381(91) time-of-flight
11000.0 18983(136) time-of-flight
13000.0 20745(237) time-of-flight
15000.0 19626(352) time-of-flight
16000.0 22778(634) time-of-flight
17000.0 23899(837) time-of-flight
18000.0 25356(985) time-of-flight
19000.0 25188(1649) time-of-flight

loop_
_pd_phase_block.id
_pd_phase_block.scale
Expand Down Expand Up @@ -3733,4 +3732,4 @@ _pd_meas.intensity_total_su
18976.191 26208.0 5806.0
18985.67 19929.0 5494.0
18995.164 26780.0 5848.0
19004.658 22232.0 5634.0
19004.658 22232.0 5634.0
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,34 @@ _pd_instr.dtt1 17591.139
_pd_instr.dtt2 -0.56(5)
_pd_instr.zero 2.4(2)
_pd_instr.alpha0 0.0
_pd_instr.alpha1 0.0773(9)
_pd_instr.beta0 0.01079(7)
_pd_instr.alpha1 0.0772(9)
_pd_instr.beta0 0.01078(7)
_pd_instr.beta1 0.0555(9)
_pd_instr.sigma0 0.0
_pd_instr.sigma1 13.2(1)

_tof_background.coeff1 819(43)
_tof_background.coeff2 737(85)
_tof_background.coeff3 717(83)
_tof_background.coeff4 567(79)
_tof_background.coeff5 441(74)
_tof_background.coeff6 316(68)
_tof_background.coeff7 230(61)
_tof_background.coeff8 157(54)
_tof_background.coeff9 102(46)
_tof_background.coeff10 58(39)
_tof_background.coeff11 20(32)
_tof_background.coeff12 -3(25)
_tof_background.coeff13 -19(19)
_tof_background.coeff14 -19(14)
_tof_background.coeff15 -20(10)
_tof_background.coeff16 -8(7)
_tof_background.coeff17 -9(4)
_tof_background.coeff18 -5(3)

_diffrn_radiation.probe neutron

loop_
_pd_background.line_segment_X
_pd_background.line_segment_intensity
_pd_background.X_coordinate
14918.0 1915(55) time-of-flight
16000.0 1661(28) time-of-flight
18000.0 1511(17) time-of-flight
20000.0 1059(12) time-of-flight
22000.0 885(8) time-of-flight
25000.0 758(6) time-of-flight
30000.0 607(5) time-of-flight
35000.0 523(4) time-of-flight
40000.0 416(3) time-of-flight
50000.0 363(3) time-of-flight
70000.0 394(3) time-of-flight
90000.0 425(6) time-of-flight
110000.0 445(10) time-of-flight
120000.0 484(14) time-of-flight
135002.0 487(10) time-of-flight

loop_
_pd_phase_block.id
_pd_phase_block.scale
Expand Down
Original file line number Diff line number Diff line change
@@ -1,41 +1,55 @@
data_wish

_pd_instr.2theta_bank 152.827
_pd_instr.dtt1 20773.9(3)
_pd_instr.dtt1 20773.5(3)
_pd_instr.dtt2 -1.08308
_pd_instr.zero -15.0(5)
_pd_instr.alpha0 -0.0160(8)
_pd_instr.alpha1 0.121(3)
_pd_instr.beta0 0.00663(3)
_pd_instr.beta1 0.0100(3)
_pd_instr.zero -14.4(5)
_pd_instr.alpha0 -0.0162(8)
_pd_instr.alpha1 0.122(3)
_pd_instr.beta0 0.00658(3)
_pd_instr.beta1 0.0108(3)
_pd_instr.sigma0 0.0
_pd_instr.sigma1 7.5(2)

_tof_background.coeff1 307(16)
_tof_background.coeff2 63(32)
_tof_background.coeff3 18(31)
_tof_background.coeff4 -27(30)
_tof_background.coeff5 -45(29)
_tof_background.coeff6 -45(27)
_tof_background.coeff7 -46(25)
_tof_background.coeff8 -45(23)
_tof_background.coeff9 -40(20)
_tof_background.coeff10 -31(17)
_tof_background.coeff11 -23(15)
_tof_background.coeff12 -21(12)
_tof_background.coeff13 -16(10)
_tof_background.coeff14 -11(8)
_tof_background.coeff15 -5(6)
_tof_background.coeff16 -3(4)
_tof_background.coeff17 1(2)
_tof_background.coeff18 -2(2)

_diffrn_radiation.probe neutron

loop_
_pd_background.line_segment_X
_pd_background.line_segment_intensity
_pd_background.X_coordinate
9162.304 466(39) time-of-flight
11136.874 593(30) time-of-flight
13313.388 497(22) time-of-flight
14906.508 546(19) time-of-flight
16454.75 533(17) time-of-flight
17352.281 497(14) time-of-flight
18743.455 429(10) time-of-flight
20179.508 453(10) time-of-flight
21368.736 397(9) time-of-flight
22176.04 473(12) time-of-flight
22827.227 478(9) time-of-flight
24644.729 380(6) time-of-flight
26439.791 381(5) time-of-flight
28257.293 378(5) time-of-flight
31196.71 343(4) time-of-flight
34034.406 328(4) time-of-flight
37265.52 309(4) time-of-flight
41214.66 322(3) time-of-flight
44827.227 282(3) time-of-flight
49830.965 272(4) time-of-flight
52905.01 257(4) time-of-flight
58204.938 260(4) time-of-flight
62916.98 261(4) time-of-flight
70186.984 262(5) time-of-flight
74204.94 262(6) time-of-flight
82103.22 268(6) time-of-flight
91958.87 268(7) time-of-flight
102712.04 262(15) time-of-flight

loop_
_pd_phase_block.id
_pd_phase_block.scale
ncaf 1.087(5)
ncaf 1.095(5)

loop_
_pd_meas.time_of_flight
Expand Down
44 changes: 20 additions & 24 deletions easyDiffractionApp/Examples/Si_SEPD@Argonne/experiments/sepd.cif
Original file line number Diff line number Diff line change
@@ -1,41 +1,37 @@
data_sepd

_diffrn_radiation.probe neutron

_pd_instr.2theta_bank 144.845
_pd_instr.dtt1 7476.91
_pd_instr.dtt2 -1.54
_pd_instr.zero -9.26(5)
_pd_instr.zero -9.24(5)
_pd_instr.alpha0 0.0
_pd_instr.alpha1 0.5971
_pd_instr.beta0 0.04221
_pd_instr.beta1 0.00946
_pd_instr.sigma0 0.21(6)
_pd_instr.sigma1 7.08(6)

_tof_background.coeff1 154.8(6)
_tof_background.coeff2 1(1)
_tof_background.coeff3 36.8(9)
_tof_background.coeff4 12.1(8)
_tof_background.coeff5 17.7(8)
_tof_background.coeff6 5.0(7)
_tof_background.coeff7 6.8(5)
_tof_background.coeff8 0.0
_tof_background.coeff9 0.0
_tof_background.coeff10 0.0
_tof_background.coeff11 0.0
_tof_background.coeff12 0.0
_tof_background.coeff13 0.0
_tof_background.coeff14 0.0
_tof_background.coeff15 0.0
_tof_background.coeff16 0.0
_tof_background.coeff17 0.0
_tof_background.coeff18 0.0
_pd_instr.sigma0 0.30(6)
_pd_instr.sigma1 7.01(6)

_diffrn_radiation.probe neutron
loop_
_pd_background.line_segment_X
_pd_background.line_segment_intensity
_pd_background.X_coordinate
2000.0 221.1 time-of-flight
4000.0 169.5 time-of-flight
6000.0 135.4 time-of-flight
10000.0 121.4 time-of-flight
14000.0 132.2 time-of-flight
18000.0 134 time-of-flight
22000.0 143 time-of-flight
25000.0 183 time-of-flight
28000.0 165 time-of-flight
29995.0 204 time-of-flight

loop_
_pd_phase_block.id
_pd_phase_block.scale
si 15.01(4)
si 14.97(4)

loop_
_pd_meas.time_of_flight
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,14 @@ EaComponents.SideBarColumn {
if (JSON.stringify(Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type')) === '{}') {
return ''
}
if (Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type').value === 'cwl') {
return 'SideBarBasic/PdBackground.qml'
} else if (Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type').value === 'tof') {
return 'SideBarBasic/PdBackground_TOF.qml'
} else {
return ''
}
//if (Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type').value === 'cwl') {
// return 'SideBarBasic/PdBackground.qml'
//} else if (Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type').value === 'tof') {
// return 'SideBarBasic/PdBackground_TOF.qml'
//} else {
// return ''
//}
return 'SideBarBasic/PdBackground.qml'
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion easyDiffractionApp/Gui/Globals/Configs.qml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ QtObject { // If "Unknown component. (M300) in QtCreator", try: "Tools > QML/JS
readonly property string branch_url: ''
readonly property string commit_sha_short: ''
readonly property string commit_url: ''
readonly property string build_date: '29 May 2024'
readonly property string build_date: '21 Jun 2024'
}
}
}
Expand Down
33 changes: 19 additions & 14 deletions easyDiffractionApp/Logic/Calculators.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
str_to_globaln
from cryspy.A_functions_base.function_2_space_group import \
get_it_coordinate_system_codes_by_it_number
console.debug('CrysPy module imported')
#console.debug('CrysPy module imported')
except ImportError:
console.error('No CrysPy module found')

Expand Down Expand Up @@ -237,6 +237,8 @@ def edCifToCryspyCif(edCif, diffrn_radiation_type='cwl'):
# NEED to remove this and use our handling of a background as for TOF case
'_pd_background.line_segment_X': '_pd_background_2theta',
'_pd_background.line_segment_intensity': '_pd_background_intensity',
'_pd_background.X_coordinate': '_pd_background_X_coordinate',

}
edToCryspyNamesMap['tof'] = {
'_pd_instr.zero': '_tof_parameters_Zero',
Expand All @@ -256,8 +258,12 @@ def edCifToCryspyCif(edCif, diffrn_radiation_type='cwl'):
'_pd_instr.sigma1': '_tof_profile_sigma1',
'_pd_instr.sigma2': '_tof_profile_sigma2',

'_tof_background.time_max': '_tof_background_time_max',
'_tof_background.coeff': '_tof_background_coeff',
###'_tof_background.time_max': '_tof_background_time_max',
###'_tof_background.coeff': '_tof_background_coeff',

'_pd_background.line_segment_X': '_tof_backgroundpoint_time',
'_pd_background.line_segment_intensity': '_tof_backgroundpoint_intensity',
'_pd_background.X_coordinate': '_tof_backgroundpoint.X_coordinate',

'_pd_meas.time_of_flight': '_tof_meas_time',
'_pd_meas.intensity_total_su': '_tof_meas_intensity_sigma', # before _pd_meas.intensity_total!
Expand Down Expand Up @@ -1251,14 +1257,14 @@ def cryspyObjAndDictToEdExperiments(cryspy_obj, cryspy_dict): # NEED to be modi
# fit = item.gamma2_refinement
#))

# Ed (pycifstar processed) background section
elif type(item) is cryspy.B_parent_classes.cl_2_loop.LoopN and item.items[0].PREFIX == 'pd_background':
pycifstar_bkg_points = item.items
# Cryspy background section (TOF, points)
elif type(item) is cryspy.C_item_loop_classes.cl_1_tof_background_by_points.TOFBackgroundPointL:
cryspy_bkg_points = item.items
ed_bkg_points = []
for idx, pycifstar_bkg_point in enumerate(pycifstar_bkg_points):
for idx, cryspy_bkg_point in enumerate(cryspy_bkg_points):
ed_bkg_point = {}
ed_bkg_point['line_segment_X'] = dict(Parameter(
pycifstar_bkg_point.line_segment_x,
cryspy_bkg_point.time,
idx = idx,
category = '_pd_background',
name = 'line_segment_X',
Expand All @@ -1268,13 +1274,12 @@ def cryspyObjAndDictToEdExperiments(cryspy_obj, cryspy_dict): # NEED to be modi
cifDict = 'pd'
))
ed_bkg_point['line_segment_intensity'] = dict(Parameter(
pycifstar_bkg_point.line_segment_intensity,
#error = pycifstar_bkg_point.line_segment_intensity_sigma,
error = 1.0,
cryspy_bkg_point.intensity,
error = cryspy_bkg_point.intensity_sigma,
idx = idx,
category = '_pd_background',
prettyCategory = 'bkg',
rowName = f'{pycifstar_bkg_point.line_segment_x:g}µs', # formatting float to str without trailing zeros
rowName = f'{cryspy_bkg_point.time:g}µs', # formatting float to str without trailing zeros
name = 'line_segment_intensity',
prettyName = 'intensity',
shortPrettyName = 'Ibkg',
Expand All @@ -1284,7 +1289,7 @@ def cryspyObjAndDictToEdExperiments(cryspy_obj, cryspy_dict): # NEED to be modi
cifDict = 'pd',
pctDelta = 25,
fittable = True,
fit = pycifstar_bkg_point.line_segment_intensity_refinement
fit = cryspy_bkg_point.intensity_refinement
))
ed_bkg_point['X_coordinate'] = dict(Parameter(
'time-of-flight',
Expand All @@ -1299,7 +1304,7 @@ def cryspyObjAndDictToEdExperiments(cryspy_obj, cryspy_dict): # NEED to be modi
ed_bkg_points.append(ed_bkg_point)
ed_experiment_no_meas['loops']['_pd_background'] = ed_bkg_points

# Cryspy background section (TOF, polinom coeffs?)
# Cryspy background section (TOF, polinom coeffs)
elif type(item) is cryspy.C_item_loop_classes.cl_1_tof_background.TOFBackground:
if hasattr(item, 'time_max'):
if not '_tof_background' in ed_experiment_no_meas['params']:
Expand Down
2 changes: 1 addition & 1 deletion easyDiffractionApp/Logic/Data.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
try:
from cryspy.H_functions_global.function_1_cryspy_objects import \
str_to_globaln
console.debug('CrysPy module imported')
#console.debug('CrysPy module imported')
except ImportError:
console.error('No CrysPy module found')

Expand Down
Loading

0 comments on commit 88b962a

Please sign in to comment.