Skip to content
Snippets Groups Projects
Commit 0184d264 authored by Rafael Gort's avatar Rafael Gort Committed by Martin Teichmann
Browse files

Further testing. DSSCBinner ready. docs to be done

parent f2d708c4
No related branches found
No related tags found
2 merge requests!98WIP: Separate digitizers from XGM, assign absolute pulse ID to XGM and digitizers data,!87Introduce package structure, generalized binning principle, ...
1.0.2-alpha.2 1.0.3-alpha.3
\ No newline at end of file
...@@ -6,7 +6,7 @@ from .dssc_data import ( ...@@ -6,7 +6,7 @@ from .dssc_data import (
save_to_file, load_from_file) save_to_file, load_from_file)
from .dssc_misc import ( from .dssc_misc import (
load_dssc_info, load_geom, quickmask_DSSC_ASIC, calc_xgm_frame_indices, load_dssc_info, load_geom, quickmask_DSSC_ASIC, calc_xgm_frame_indices,
create_xgm_pulsemask, get_xgm_binned, get_xgm_formatted) create_xgm_pulsemask, get_xgm_binned, get_xgm_formatted, load_mask)
from .dssc_processing import ( from .dssc_processing import (
split_frames, bin_data_multipr, sum_trains_multipr, split_frames, bin_data_multipr, sum_trains_multipr,
sum_trains, bin_data) sum_trains, bin_data)
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
comments: comments:
- contributions should comply with pep8 code structure guidelines. - contributions should comply with pep8 code structure guidelines.
- Plot routines don't fit into objects since they are rather fluent. - Plot routines don't fit into objects since they are rather fluent.
They have been outsourced to dssc_plot.py. Alternatively they could They have been outsourced to dssc_plot.py. They can now be accessed
be accessed as tbdet member functions. as tbdet member functions.
""" """
import os import os
import logging import logging
...@@ -27,7 +27,7 @@ from .dssc_misc import (load_dssc_info, calc_xgm_frame_indices, ...@@ -27,7 +27,7 @@ from .dssc_misc import (load_dssc_info, calc_xgm_frame_indices,
from .dssc_processing import (bin_data, bin_data_multipr, sum_trains, from .dssc_processing import (bin_data, bin_data_multipr, sum_trains,
sum_trains_multipr) sum_trains_multipr)
__all__ = ["DSSCBinner", "DSSCImage"] __all__ = ["DSSCBinner", "DSSCImager"]
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
...@@ -199,17 +199,16 @@ class DSSCBinner: ...@@ -199,17 +199,16 @@ class DSSCBinner:
return data return data
class DSSCImage: class DSSCImager:
def __init__(self, def __init__(self):
distance=1, mask_file=''
):
""" """
(doc to be done) (Placeholder for possible future class handling geometrical properties.
Its main method could be to call the azimuthal integrator).
""" """
#self.distance = distance #self.distance = distance
#self.pxpitchh = 236 # horizontal pitch in microns #self.pxpitchh = 236
#self.pxpitchv = 204 # vertical pitch in microns #self.pxpitchv = 204
#self.aspect = self.pxpitchv/self.pxpitchh #self.aspect = self.pxpitchv/self.pxpitchh
#self.geom = self.load_geom() #self.geom = None
#self.imagemask = self.load_mask(mask_file) #self.mask = None
pass pass
...@@ -182,35 +182,3 @@ def load_mask(fname): ...@@ -182,35 +182,3 @@ def load_mask(fname):
mask = dssc_mask.astype(float)[..., 0] // 255 mask = dssc_mask.astype(float)[..., 0] // 255
mask[dssc_mask==0] = np.nan mask[dssc_mask==0] = np.nan
return mask return mask
def substract_dark(self, data, dark, keys=['pumped', 'pumped']):
"""
Substract dark image from binned processed images
Parameters
----------
data: xarray.DataArray
processed data
dark: xarray.DataArray
processed dark run corresponding to data
key: str
name of the dataset to be accessed
"""
return (data[keys[0]] - dark[keys[1]].values)
def normalize_binned_data(self, data, norm, keys=['pumped', 'pumped']):
"""
Divide processed images
Parameters
----------
data: xarray.DataArray
processed data
dark: xarray.DataArray
processed dark run corresponding to data
key: str
name of the dataset to be accessed
"""
return data[keys[0]] / norm[keys[1]]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment