Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ jobs:
- name: Create venv and install Python dependences
run: poetry install

- name: Install extras # How to do it via poetry without pip?
run: poetry run pip install CFML GSASII --extra-index-url https://easyscience.github.io/pypi

- name: Create freezed python app bundle
run: poetry run python ${{ env.SCRIPTS_PATH }}/FreezeApp.py

Expand Down
12 changes: 12 additions & 0 deletions easyDiffractionApp/Gui/Pages/Experiment/SideBarBasic.qml
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,18 @@ EaComponents.SideBarColumn {
}
}

EaElements.GroupBox {
title: qsTr("Peak asymmetry")
enabled: ExGlobals.Constants.proxy.experiment.experimentLoaded ||
ExGlobals.Constants.proxy.experiment.experimentSkipped

Loader {
source: {
return 'SideBarGroups/PeakAsymmetry.qml'
}
}
}

EaElements.GroupBox {
title: qsTr("Peak profile")
enabled: ExGlobals.Constants.proxy.experiment.experimentLoaded ||
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// SPDX-FileCopyrightText: 2022 easyDiffraction contributors <support@easydiffraction.org>
// SPDX-License-Identifier: BSD-3-Clause
// © 2021-2022 Contributors to the easyDiffraction project <https://github.com/easyScience/easyDiffractionApp>

import QtQuick 2.13
import QtQuick.Controls 2.13

import easyApp.Gui.Style 1.0 as EaStyle
import easyApp.Gui.Elements 1.0 as EaElements
import easyApp.Gui.Logic 1.0 as EaLogic

import Gui.Globals 1.0 as ExGlobals


Grid {
columns: 4
columnSpacing: EaStyle.Sizes.fontPixelSize

Column {
EaElements.Label {
enabled: false
text: qsTr("P1")
}

EaElements.Parameter {
width: inputFieldWidth()
units: ""
text: EaLogic.Utils.toFixed(ExGlobals.Constants.proxy.parameters.instrumentParametersAsObj.reflex_asymmetry_p1.value)
onEditingFinished: editParameterValue(ExGlobals.Constants.proxy.parameters.instrumentParametersAsObj.reflex_asymmetry_p1["@id"], text)
}
}

Column {
EaElements.Label {
enabled: false
text: qsTr("P2")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this short name P1, P2 etc. good enough? Shouldn't we have at least a tooltip?
On the other hand, Labels don't really have tooltips so maybe it's too much.

Copy link
Member

@rozyczko rozyczko Aug 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we might want to add a tooltip or a note about the method used, since apparently there is more than one way to do this correction. This one seems to be the Berar and Baldinozzi correction (?) Specifying this would make the names of the parameters hopefully more meaningfull

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. This should more clear. I suggest extending it after we switch to the CrysPyV3 interface and confirm that peak asymmetry actually works. I have created a draft issue for the EasyDiffraction project.

}

EaElements.Parameter {
width: inputFieldWidth()
units: ""
text: EaLogic.Utils.toFixed(ExGlobals.Constants.proxy.parameters.instrumentParametersAsObj.reflex_asymmetry_p2.value)
onEditingFinished: editParameterValue(ExGlobals.Constants.proxy.parameters.instrumentParametersAsObj.reflex_asymmetry_p2["@id"], text)
}
}

Column {
EaElements.Label {
enabled: false
text: qsTr("P3")
}

EaElements.Parameter {
width: inputFieldWidth()
units: ""
text: EaLogic.Utils.toFixed(ExGlobals.Constants.proxy.parameters.instrumentParametersAsObj.reflex_asymmetry_p3.value)
onEditingFinished: editParameterValue(ExGlobals.Constants.proxy.parameters.instrumentParametersAsObj.reflex_asymmetry_p3["@id"], text)
}
}

Column {
EaElements.Label {
enabled: false
text: qsTr("P4")
}

EaElements.Parameter {
width: inputFieldWidth()
units: ""
text: EaLogic.Utils.toFixed(ExGlobals.Constants.proxy.parameters.instrumentParametersAsObj.reflex_asymmetry_p4.value)
onEditingFinished: editParameterValue(ExGlobals.Constants.proxy.parameters.instrumentParametersAsObj.reflex_asymmetry_p4["@id"], text)
}
}

// Logic

function inputFieldWidth() {
return (EaStyle.Sizes.sideBarContentWidth - columnSpacing * (columns - 1)) / columns
}

function editParameterValue(id, value) {
ExGlobals.Constants.proxy.parameters.editParameter(id, parseFloat(value))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ PeakProfilePdTof1d 1.0 PeakProfilePdTof1d.qml
BackgroundPdTof1d 1.0 BackgroundPdTof1d.qml

DiffractionRadiation 1.0 DiffractionRadiation.qml
PeakAsymmetry 1.0 PeakAsymmetry.qml
12 changes: 12 additions & 0 deletions easyDiffractionApp/Logic/Experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,18 @@ def _loadExperimentCif(self, file_url):
value = block.find_value("_pd_instr_resolution_y")
if value is not None:
instrument_parameters.resolution_y = float(value)
value = block.find_value("_pd_instr_reflex_asymmetry_p1")
if value is not None:
instrument_parameters.reflex_asymmetry_p1 = float(value)
value = block.find_value("_pd_instr_reflex_asymmetry_p2")
if value is not None:
instrument_parameters.reflex_asymmetry_p2 = float(value)
value = block.find_value("_pd_instr_reflex_asymmetry_p3")
if value is not None:
instrument_parameters.reflex_asymmetry_p3 = float(value)
value = block.find_value("_pd_instr_reflex_asymmetry_p4")
if value is not None:
instrument_parameters.reflex_asymmetry_p4 = float(value)

# Get phase parameters
sample_phase_labels = self.parent.l_phase.phases.phase_names
Expand Down
4 changes: 4 additions & 0 deletions easyDiffractionApp/Logic/Parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ def _defaultInstrumentParameters(self):
"resolution_w": 0.01,
"resolution_x": 0.0,
"resolution_y": 0.0,
"reflex_asymmetry_p1": 0.0,
"reflex_asymmetry_p2": 0.0,
"reflex_asymmetry_p3": 0.0,
"reflex_asymmetry_p4": 0.0
}

def _setInstrumentParametersAsObj(self):
Expand Down
4 changes: 4 additions & 0 deletions easyDiffractionApp/Logic/Sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def _defaultParameters(self, sample):
sample.parameters.resolution_w = 0.3864
sample.parameters.resolution_x = 0.0
sample.parameters.resolution_y = 0.0 # 0.0961
sample.parameters.reflex_asymmetry_p1 = 0.0
sample.parameters.reflex_asymmetry_p2 = 0.0
sample.parameters.reflex_asymmetry_p3 = 0.0
sample.parameters.reflex_asymmetry_p4 = 0.0
return sample

def _defaultCWSample(self):
Expand Down
Loading