Skip to content

Commit

Permalink
Changes according to the review comments #30
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewSazonov committed May 29, 2024
1 parent 9b32000 commit b2da719
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 164 deletions.
20 changes: 10 additions & 10 deletions easyDiffractionApp/Gui/Components/Pages/Experiment/SideBarBasic.qml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ EaComponents.SideBarColumn {
if (JSON.stringify(Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type')) === '{}') {
return ''
}
if (Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type').value === 'cw') {
return 'SideBarBasic/PdMeas_CW.qml'
if (Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type').value === 'cwl') {
return 'SideBarBasic/PdMeas_CWL.qml'
} else if (Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type').value === 'tof') {
return 'SideBarBasic/PdMeas_TOF.qml'
} else {
Expand All @@ -58,8 +58,8 @@ EaComponents.SideBarColumn {
if (JSON.stringify(Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type')) === '{}') {
return ''
}
if (Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type').value === 'cw') {
return 'SideBarBasic/PdInstrParams_CW.qml'
if (Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type').value === 'cwl') {
return 'SideBarBasic/PdInstrParams_CWL.qml'
} else if (Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type').value === 'tof') {
return 'SideBarBasic/PdInstrParams_TOF.qml'
} else {
Expand All @@ -78,8 +78,8 @@ EaComponents.SideBarColumn {
if (JSON.stringify(Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type')) === '{}') {
return ''
}
if (Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type').value === 'cw') {
return 'SideBarBasic/PdPeakProfile_CW.qml'
if (Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type').value === 'cwl') {
return 'SideBarBasic/PdPeakProfile_CWL.qml'
} else if (Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type').value === 'tof') {
return 'SideBarBasic/PdPeakProfile_TOF.qml'
} else {
Expand All @@ -99,9 +99,9 @@ EaComponents.SideBarColumn {
peakAsymmetryGroup.visible = false
return ''
}
if (Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type').value === 'cw') {
if (Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type').value === 'cwl') {
peakAsymmetryGroup.visible = true
return 'SideBarBasic/PdInstrPeakAsymm_CW.qml'
return 'SideBarBasic/PdInstrPeakAsymm_CWL.qml'
} else {
peakAsymmetryGroup.visible = false
return ''
Expand All @@ -122,7 +122,7 @@ EaComponents.SideBarColumn {

EaElements.GroupBox {
title: {
if (Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type').value === 'cw') {
if (Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type').value === 'cwl') {
return Globals.Proxies.experimentLoopTitle(qsTr('Background'), '_pd_background')
} else if (Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type').value === 'tof') {
return qsTr('Background')
Expand All @@ -135,7 +135,7 @@ EaComponents.SideBarColumn {
if (JSON.stringify(Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type')) === '{}') {
return ''
}
if (Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type').value === 'cw') {
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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ EaElements.GroupRow {
}
let param = Globals.Proxies.experimentMainParam('_diffrn_radiation', 'type')
let val = param.value
val = val.replace('cw', 'constant wavelength')
val = val.replace('cwl', 'constant wavelength')
val = val.replace('tof', 'time-of-flight')
param.value = val
return param
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ import EasyApp.Gui.Elements as EaElements

import Gui.Globals as Globals

EaElements.GroupColumn {
property real titleSpacing: 0.5
EaElements.GroupRow {
//property real titleSpacing: 0.5

//Column {
// spacing: titleSpacing
// EaElements.Label {
// color: EaStyle.Colors.themeForegroundMinor
// text: 'Exponential decay parameters'
// }
EaElements.GroupRow {
// EaElements.GroupRow {
EaElements.ParamTextField {
parameter: Globals.Proxies.experimentMainParam('_pd_instr', 'alpha0')
onEditingFinished: Globals.Proxies.setExperimentMainParam(parameter, 'value', Number(text))
Expand All @@ -30,7 +30,7 @@ EaElements.GroupColumn {
onEditingFinished: Globals.Proxies.setExperimentMainParam(parameter, 'value', Number(text))
fitCheckBox.onToggled: Globals.Proxies.setExperimentMainParam(parameter, 'fit', fitCheckBox.checked)
}
}
// }
//}

//Column {
Expand All @@ -39,7 +39,7 @@ EaElements.GroupColumn {
// color: EaStyle.Colors.themeForegroundMinor
// text: 'Exponential decay parameters'
// }
EaElements.GroupRow {
// EaElements.GroupRow {
EaElements.ParamTextField {
parameter: Globals.Proxies.experimentMainParam('_pd_instr', 'beta0')
onEditingFinished: Globals.Proxies.setExperimentMainParam(parameter, 'value', Number(text))
Expand All @@ -50,7 +50,7 @@ EaElements.GroupColumn {
onEditingFinished: Globals.Proxies.setExperimentMainParam(parameter, 'value', Number(text))
fitCheckBox.onToggled: Globals.Proxies.setExperimentMainParam(parameter, 'fit', fitCheckBox.checked)
}
}
// }
//}

//Column {
Expand All @@ -59,7 +59,7 @@ EaElements.GroupColumn {
// color: EaStyle.Colors.themeForegroundMinor
// text: 'Variance of the Gaussian component'
// }
EaElements.GroupRow {
// EaElements.GroupRow {
EaElements.ParamTextField {
parameter: Globals.Proxies.experimentMainParam('_pd_instr', 'sigma0')
onEditingFinished: Globals.Proxies.setExperimentMainParam(parameter, 'value', Number(text))
Expand All @@ -78,7 +78,7 @@ EaElements.GroupColumn {
//EaElements.ParamTextField { // Empty spot for better visual alignment
// visible: false
//}
}
// }
//}

//Column {
Expand Down
18 changes: 9 additions & 9 deletions easyDiffractionApp/Logic/Calculators.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def dataBlockToCif(block, includeBlockName=True):
return cif

@staticmethod
def edCifToCryspyCif(edCif, diffrn_radiation_type='cw'):
def edCifToCryspyCif(edCif, diffrn_radiation_type='cwl'):
rawToEdNamesCif = {
'_symmetry_space_group_name_H-M': '_space_group.name_H-M_alt',
'_atom_site_thermal_displace_type': '_atom_site.ADP_type',
Expand All @@ -210,7 +210,7 @@ def edCifToCryspyCif(edCif, diffrn_radiation_type='cw'):
'_model.cif_file_name': '_model_cif_file_name',
'_experiment.cif_file_name': '_experiment_cif_file_name'
}
edToCryspyNamesMap['cw'] = {
edToCryspyNamesMap['cwl'] = {
'_diffrn_radiation_wavelength.wavelength': '_setup_wavelength',

'_pd_calib.2theta_offset': '_setup_offset_2theta',
Expand Down Expand Up @@ -750,7 +750,7 @@ def cryspyObjAndDictToEdExperiments(cryspy_obj, cryspy_dict): # NEED to be modi

# DATABLOCK SINGLES

# Ranges category (CW)
# Ranges category (CWL)
if type(item) == cryspy.C_item_loop_classes.cl_1_range.Range:
ed_experiment_no_meas['params']['_pd_meas'] = {}
if hasattr(item, 'ttheta_min') and hasattr(item, 'ttheta_max'):
Expand Down Expand Up @@ -855,7 +855,7 @@ def cryspyObjAndDictToEdExperiments(cryspy_obj, cryspy_dict): # NEED to be modi
ed_phases.append(ed_phase)
ed_experiment_no_meas['loops']['_pd_phase_block'] = ed_phases

# Cryspy setup section (TOF/CW)
# Cryspy setup section (TOF/CWL)
elif type(item) == cryspy.C_item_loop_classes.cl_1_setup.Setup:
if hasattr(item, 'radiation'):
if not '_diffrn_radiation' in ed_experiment_no_meas['params']:
Expand Down Expand Up @@ -908,7 +908,7 @@ def cryspyObjAndDictToEdExperiments(cryspy_obj, cryspy_dict): # NEED to be modi
fit = item.offset_ttheta_refinement
))

# Cryspy instrument resolution section (CW)
# Cryspy instrument resolution section (CWL)
elif type(item) is cryspy.C_item_loop_classes.cl_1_pd_instr_resolution.PdInstrResolution:
if hasattr(item, 'u') and hasattr(item, 'v') and hasattr(item, 'w') and hasattr(item, 'x') and hasattr(item, 'y'):
if not '_pd_instr' in ed_experiment_no_meas['params']:
Expand Down Expand Up @@ -984,7 +984,7 @@ def cryspyObjAndDictToEdExperiments(cryspy_obj, cryspy_dict): # NEED to be modi
fit = item.y_refinement
))

# Cryspy peak asymmetries section (CW)
# Cryspy peak asymmetries section (CWL)
elif type(item) is cryspy.C_item_loop_classes.cl_1_pd_instr_reflex_asymmetry.PdInstrReflexAsymmetry:
if hasattr(item, 'p1') and hasattr(item, 'p2') and hasattr(item, 'p3') and hasattr(item, 'p4'):
if not '_pd_instr' in ed_experiment_no_meas['params']:
Expand Down Expand Up @@ -1567,7 +1567,7 @@ def cryspyObjAndDictToEdExperiments(cryspy_obj, cryspy_dict): # NEED to be modi
fit = item.coeff18_refinement
))

# Cryspy background section (CW, points)
# Cryspy background section (CWL, points)
elif type(item) is cryspy.C_item_loop_classes.cl_1_pd_background.PdBackgroundL:
cryspy_bkg_points = item.items
ed_bkg_points = []
Expand Down Expand Up @@ -1666,12 +1666,12 @@ def cryspyObjAndDictToEdExperiments(cryspy_obj, cryspy_dict): # NEED to be modi
pd_meas_range_inc = (pd_meas_range_max - pd_meas_range_min) / (len(ed_meas_points) - 1)
ed_experiment_no_meas['params']['_pd_meas']['tof_range_inc']['value'] = pd_meas_range_inc

# Cryspy measured data section (CW)
# Cryspy measured data section (CWL)
elif type(item) is cryspy.C_item_loop_classes.cl_1_pd_meas.PdMeasL:
if not '_diffrn_radiation' in ed_experiment_no_meas['params']:
ed_experiment_no_meas['params']['_diffrn_radiation'] = {}
ed_experiment_no_meas['params']['_diffrn_radiation']['type'] = dict(Parameter(
'cw',
'cwl',
optional=True,
category='_diffrn_radiation',
name='type',
Expand Down
Loading

0 comments on commit b2da719

Please sign in to comment.