Skip to content

Commit

Permalink
add in option to save unnormalised intensity
Browse files Browse the repository at this point in the history
  • Loading branch information
P-Mousley authored Jan 10, 2025
1 parent 3bfab1e commit 903c1a3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/islatu/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,19 @@ def reflectivity_e(self) -> np.array:
intensity array.
"""
return self.intensity_e/np.amax(self.intensity)
@property
def reflectivity_nonorm(self) -> np.array:
"""
Returns the intensity, unnormalised
"""
return self.intensity

@property
def reflectivity_e_nonorm(self) -> np.array:
"""
Returns the errors on the intensity, unnormalised
"""
return self.intensity_e

@property
def q_vectors(self) -> np.array:
Expand Down
11 changes: 9 additions & 2 deletions src/islatu/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def __init__(self, software=Software(), input_files=None,
data_state=DataState(), parser=io.i07_nxs_parser,
crop_function=cropping.crop_to_region, crop_kwargs=None,
bkg_function=background.fit_gaussian_1d, bkg_kwargs=None,
dcd_normalisation=None, sample_size=None, beam_width=None,overwrite_transmission=None):
dcd_normalisation=None, sample_size=None, beam_width=None,overwrite_transmission=None,normalisation=True):
if input_files is None:
input_files = []
self.software = software
Expand All @@ -155,6 +155,7 @@ def __init__(self, software=Software(), input_files=None,
self.sample_size = sample_size
self.beam_width = beam_width
self.overwrite_transmission=overwrite_transmission
self.normalisation=normalisation


class Data:
Expand Down Expand Up @@ -258,6 +259,9 @@ def setup(self, recipe):
self.reduction.bkg_kwargs = recipe['background']['kwargs']
if 'transmission' in keys:
self.reduction.overwrite_transmission=recipe['transmission']['values']

if 'normalisation' in keys:
self.reduction.normalisation=recipe['normalisation']['maxnorm']
# Populate the setup information
if 'setup' in keys:
if 'dcd normalisation' in recipe['setup'].keys():
Expand Down Expand Up @@ -493,7 +497,10 @@ def i07reduce(run_numbers, yaml_file, directory='/dls/{}/data/{}/{}/',


# Prepare the data array.
data = np.array([refl.q_vectors, refl.reflectivity, refl.reflectivity_e]).T
if the_boss.reduction.normalisation==True:
data = np.array([refl.q_vectors, refl.reflectivity, refl.reflectivity_e]).T
elif the_boss.reduction.normalisation==False:
data = np.array([refl.q_vectors, refl.reflectivity_nonorm, refl.reflectivity_e_nonorm]).T
debug.log("XRR reduction completed.", unimportance=2)

# Work out where to save the file.
Expand Down

0 comments on commit 903c1a3

Please sign in to comment.