Skip to content

Commit

Permalink
Rename 'sample' to 'peak' in auto-reduction code (#192)
Browse files Browse the repository at this point in the history
* Rename 'sample' to 'peak' in reduction code

Signed-off-by: Jose Borreguero <[email protected]>
  • Loading branch information
jmborr authored Oct 31, 2024
1 parent 100be00 commit 4994a45
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 98 deletions.
4 changes: 2 additions & 2 deletions docs/developer/instruction/build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ After setting the environment variables, run the following ``make`` targets in t

.. code-block:: shell
make conda/create
make create/conda # or "make create/mamba" for mamba, to create the webmon conda environment
make all # create: python packages for dasmon, webmon, and workflow; fake SNS data; self-signed SSL certificates
make localdev/up # build all the services
Expand Down Expand Up @@ -176,7 +176,7 @@ source code requires rebuilding the python wheel(s).
For instance, if the source code of ``dasmon`` is changed, run at this
point ``make wheel/dasmon`` to rebuild the ``dasmon`` wheel.

If necessary, delete all existing wheels with ``make wheel/clean``
If necessary, delete all existing wheels with ``make wheel/clean``, then run ``make all`` to recreate them.

Rebuild the services
~~~~~~~~~~~~~~~~~~~~
Expand Down
22 changes: 11 additions & 11 deletions src/webmon_app/reporting/reduction/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,24 +296,24 @@ class ReductionConfigurationCorelliForm(BaseReductionConfigurationForm):
]


class ReductionConfigurationREFMForm(BaseReductionConfigurationForm):
class ReductionConfigurationREF_MForm(BaseReductionConfigurationForm):
"""
Generic form for REF_M reduction instruments
"""

skip_quicknxs = forms.BooleanField(required=False, initial=False)

# Options for all samples in the run
# Options for all peaks in the run
plot_in_2D = forms.BooleanField(required=False, initial=False)
use_const_q = forms.BooleanField(required=False, initial=False)
q_step = forms.FloatField(required=False, initial=-0.02)
use_sangle = forms.BooleanField(required=False, initial=True)
fit_peak_in_roi = forms.BooleanField(required=False, initial=False)
sample_count = forms.IntegerField(
peak_count = forms.IntegerField(
required=True, min_value=1, initial=1, widget=forms.NumberInput(attrs={"size": "2"})
)

# Options for first sample
# Options for first peak
force_peak = forms.BooleanField(required=False, initial=False)
peak_min = forms.IntegerField(required=True, initial=160, widget=forms.NumberInput(attrs={"size": "5"}))
peak_max = forms.IntegerField(required=True, initial=170, widget=forms.NumberInput(attrs={"size": "5"}))
Expand All @@ -324,7 +324,7 @@ class ReductionConfigurationREFMForm(BaseReductionConfigurationForm):
use_side_bck = forms.BooleanField(required=False, initial=False)
bck_width = forms.IntegerField(required=True, initial=10, widget=forms.NumberInput(attrs={"size": "4"}))

# Options for second sample
# Options for second peak
force_peak_s2 = forms.BooleanField(required=False, initial=False)
peak_min_s2 = forms.IntegerField(required=True, initial=160, widget=forms.NumberInput(attrs={"size": "5"}))
peak_max_s2 = forms.IntegerField(required=True, initial=170, widget=forms.NumberInput(attrs={"size": "5"}))
Expand All @@ -335,7 +335,7 @@ class ReductionConfigurationREFMForm(BaseReductionConfigurationForm):
use_side_bck_s2 = forms.BooleanField(required=False, initial=False)
bck_width_s2 = forms.IntegerField(required=True, initial=10, widget=forms.NumberInput(attrs={"size": "4"}))

# Options for third sample
# Options for third peak
force_peak_s3 = forms.BooleanField(required=False, initial=False)
peak_min_s3 = forms.IntegerField(required=True, initial=160, widget=forms.NumberInput(attrs={"size": "5"}))
peak_max_s3 = forms.IntegerField(required=True, initial=170, widget=forms.NumberInput(attrs={"size": "5"}))
Expand All @@ -348,14 +348,14 @@ class ReductionConfigurationREFMForm(BaseReductionConfigurationForm):

# List of fields are used in the template
_template_list = [
# Options for all samples in the run
# Options for all peaks in the run
"plot_in_2D",
"use_const_q",
"q_step",
"use_sangle",
"fit_peak_in_roi",
"sample_count",
# Options for first sample
"peak_count",
# Options for first peak
"force_peak",
"peak_min",
"peak_max",
Expand All @@ -365,7 +365,7 @@ class ReductionConfigurationREFMForm(BaseReductionConfigurationForm):
"bck_max",
"use_side_bck",
"bck_width",
# Options for second sample
# Options for second peak
"force_peak_s2",
"peak_min_s2",
"peak_max_s2",
Expand All @@ -375,7 +375,7 @@ class ReductionConfigurationREFMForm(BaseReductionConfigurationForm):
"bck_max_s2",
"use_side_bck_s2",
"bck_width_s2",
# Options for third sample
# Options for third peak
"force_peak_s3",
"peak_min_s3",
"peak_max_s3",
Expand Down
4 changes: 2 additions & 2 deletions src/webmon_app/reporting/reduction/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def configuration_ref_m(request, instrument):
view_util.reset_to_default(instrument_id)
return redirect(reverse("reduction:configuration", args=[instrument]))

options_form = forms.ReductionConfigurationREFMForm(request.POST)
options_form = forms.ReductionConfigurationREF_MForm(request.POST)
options_form.set_instrument(instrument.lower())
if options_form.is_valid():
options_form.to_db(instrument_id, request.user)
Expand All @@ -129,7 +129,7 @@ def configuration_ref_m(request, instrument):
props_list = ReductionProperty.objects.filter(instrument=instrument_id)
for item in props_list:
params_dict[str(item.key)] = str(item.value)
options_form = forms.ReductionConfigurationREFMForm(initial=params_dict)
options_form = forms.ReductionConfigurationREF_MForm(initial=params_dict)
options_form.set_instrument(instrument.lower())

last_action = datetime.datetime.now().isoformat()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<table class="property_table fixed_table" >

<tr>
<td style="font-size: 18px; text-decoration: underline;"><strong>Options for all samples</strong></td>
<td style="font-size: 18px; text-decoration: underline;"><strong>Options for all peaks</strong></td>
</tr>

<tr class='tiny_input'>
Expand All @@ -99,7 +99,7 @@
</td>
</tr>

<!-- Sample angle options -->
<!-- Peak angle options -->
<tr>
<td>
{{ options_form.use_sangle }}
Expand All @@ -112,7 +112,7 @@
<tr>
<td>
{{ options_form.fit_peak_in_roi }}
<span title="Once the reflected peak ROI is selected for each sample below,
<span title="Once the reflected peak ROI is selected for each peak below,
you can try to fine tune this ROI by fitting for a peak within that
region and updating the ROI [both center and width] according to the
location found. Check the box if you want to find a peak within the
Expand All @@ -125,19 +125,19 @@
<!-- Divider line -->
<td colspan="2"><hr></td>

<!-- Number of Samples in the run -->
<!-- Number of Peaks in the run -->
<tr class='tiny_input'>
<td>
<span class='short_label' title="Number of samples in the run"><strong>Sample count</strong></span>
{{ options_form.sample_count }}
<span class='short_label' title="Number of peaks in the run"><strong>Peak count</strong></span>
{{ options_form.peak_count }}
</td>
</tr>


<!-- Divider line -->
<td colspan="2"><hr></td>
<tr>
<td style="font-size: 18px; text-decoration: underline;"><strong>Sample # 1</strong></td>
<td style="font-size: 18px; text-decoration: underline;"><strong>Peak # 1</strong></td>
</tr>

<!-- Force peak ROI options -->
Expand All @@ -147,9 +147,9 @@
<span class='short_label' title="You can choose to replace the ROI in the data by your own range.
Check the following box if you want to define your own ROI and
use it for peak selection."><strong>Force peak ROI</strong></span>
<span class='short_label'>Pixel<sub>min</sub></span>
<label class='short_label' for='peak_min'>Pixel<sub>min</sub></label>
{{ options_form.peak_min }}
<span class='short_label'>Pixel<sub>max</sub></span>
<label class='short_label' for='peak_max'>Pixel<sub>max</sub></label>
{{ options_form.peak_max }}
</td>
</tr>
Expand All @@ -173,9 +173,9 @@
<span title="You can choose to replace the 2nd ROI in the data by your own range.
Check the following box if you want to define your own 2nd ROI and use it for background selection.
The option to use the 2nd ROI has to be turned ON to use this option."><strong>Force background ROI</strong></span>
<span class='short_label'>Bck<sub>min</sub></span>
<label class='short_label' for='bck_min'>Bck<sub>min</sub></label>
{{ options_form.bck_min }}
<span class='short_label'>Bck<sub>max</sub></span>
<label class='short_label' for='bck_max'>Bck<sub>max</sub></label>
{{ options_form.bck_max }}
</td>
</tr>
Expand All @@ -191,16 +191,16 @@
if you want to use the region on each side of the peak to estimate your background.">
<strong>Use side background</strong>
</span>
Pixels on each side {{ options_form.bck_width }}
<label for='bck_width'>Pixels on each side</label> {{ options_form.bck_width }}
</td>
</tr>


<!-- Divider line -->
<td colspan="2"><hr></td>
<tr>
<td style="font-size: 18px; text-decoration: underline;" title="Sample 2 options ignored if Sample count is 1">
<strong>Sample # 2</strong>
<td style="font-size: 18px; text-decoration: underline;" title="Peak 2 options ignored if Peak count is 1">
<strong>Peak # 2</strong>
</td>
</tr>

Expand All @@ -211,9 +211,9 @@
<span class='short_label' title="You can choose to replace the ROI in the data by your own range.
Check the following box if you want to define your own ROI and
use it for peak selection."><strong>Force peak ROI</strong></span>
<span class='short_label'>Pixel<sub>min</sub></span>
<label class='short_label' for='peak_min_s2'>Pixel<sub>min</sub></label>
{{ options_form.peak_min_s2 }}
<span class='short_label'>Pixel<sub>max</sub></span>
<label class='short_label' for='peak_max_s2'>Pixel<sub>max</sub></label>
{{ options_form.peak_max_s2 }}
</td>
</tr>
Expand All @@ -237,9 +237,9 @@
<span title="You can choose to replace the 2nd ROI in the data by your own range.
Check the following box if you want to define your own 2nd ROI and use it for background selection.
The option to use the 2nd ROI has to be turned ON to use this option."><strong>Force background ROI</strong></span>
<span class='short_label'>Bck<sub>min</sub></span>
<label class='short_label' for='bck_min_s2'>Bck<sub>min</sub></label>
{{ options_form.bck_min_s2 }}
<span class='short_label'>Bck<sub>max</sub></span>
<label class='short_label' for='bck_max_s2'>Bck<sub>max</sub></label>
{{ options_form.bck_max_s2 }}
</td>
</tr>
Expand All @@ -255,16 +255,16 @@
if you want to use the region on each side of the peak to estimate your background.">
<strong>Use side background</strong>
</span>
Pixels on each side {{ options_form.bck_width_s2 }}
<label for='bck_width_s2'>Pixels on each side</label> {{ options_form.bck_width_s2 }}
</td>
</tr>


<!-- Divider line -->
<td colspan="2"><hr></td>
<tr>
<td style="font-size: 18px; text-decoration: underline;" title="Sample 3 options ignored if Sample count smaller than 3">
<strong>Sample # 3</strong>
<td style="font-size: 18px; text-decoration: underline;" title="Peak 3 options ignored if Peak count smaller than 3">
<strong>Peak # 3</strong>
</td>
</tr>

Expand All @@ -276,9 +276,9 @@
<span class='short_label' title="You can choose to replace the ROI in the data by your own range.
Check the following box if you want to define your own ROI and
use it for peak selection."><strong>Force peak ROI</strong></span>
<span class='short_label'>Pixel<sub>min</sub></span>
<label class='short_label' for='peak_min_s3'>Pixel<sub>min</sub></label>
{{ options_form.peak_min_s3 }}
<span class='short_label'>Pixel<sub>max</sub></span>
<label class='short_label' for='peak_max_s3'>Pixel<sub>max</sub></label>
{{ options_form.peak_max_s3 }}
</td>
</tr>
Expand All @@ -302,9 +302,9 @@
<span title="You can choose to replace the 2nd ROI in the data by your own range.
Check the following box if you want to define your own 2nd ROI and use it for background selection.
The option to use the 2nd ROI has to be turned ON to use this option."><strong>Force background ROI</strong></span>
<span class='short_label'>Bck<sub>min</sub></span>
<label class='short_label' for='bck_min_s3'>Bck<sub>min</sub></label>
{{ options_form.bck_min_s3 }}
<span class='short_label'>Bck<sub>max</sub></span>
<label class='short_label' for='bck_max_s3'>Bck<sub>max</sub></label>
{{ options_form.bck_max_s3 }}
</td>
</tr>
Expand All @@ -320,7 +320,7 @@
if you want to use the region on each side of the peak to estimate your background.">
<strong>Use side background</strong>
</span>
Pixels on each side {{ options_form.bck_width_s3 }}
<label for='bck_width_s3'>Pixels on each side</label> {{ options_form.bck_width_s3 }}
</td>
</tr>

Expand Down
Loading

0 comments on commit 4994a45

Please sign in to comment.