Skip to content
Snippets Groups Projects
Commit 1a9a2705 authored by Steffen Hauf's avatar Steffen Hauf
Browse files

Adress feedback from review

parent 9e54f77a
No related branches found
No related tags found
1 merge request!79Propagate backlog of cal_tools related changes from production system as of 06/2019
...@@ -2,14 +2,15 @@ import copy ...@@ -2,14 +2,15 @@ import copy
from enum import Enum from enum import Enum
import h5py import h5py
import numpy as np
from cal_tools.enums import BadPixels
from cal_tools.tools import get_constant_from_db, get_constant_from_db_and_time
from iCalibrationDB import Constants, Conditions, Detectors from iCalibrationDB import Constants, Conditions, Detectors
import numpy as np
from scipy.signal import cwt, ricker from scipy.signal import cwt, ricker
from sklearn.mixture import GaussianMixture from sklearn.mixture import GaussianMixture
from sklearn.preprocessing import StandardScaler from sklearn.preprocessing import StandardScaler
from cal_tools.enums import BadPixels
from cal_tools.tools import get_constant_from_db, get_constant_from_db_and_time
def get_num_cells(fname, loc, module): def get_num_cells(fname, loc, module):
with h5py.File(fname, "r") as f: with h5py.File(fname, "r") as f:
...@@ -1125,7 +1126,6 @@ class AgipdCorrections: ...@@ -1125,7 +1126,6 @@ class AgipdCorrections:
single_image.shape[2]) single_image.shape[2])
self.firange = firange self.firange = firange
self.single_image = single_image self.single_image = single_image
self.can_calibrate = can_calibrate
def copy_and_sanitize_non_cal_data(self): def copy_and_sanitize_non_cal_data(self):
""" Copy and sanitize data in `infile` that is not touched by """ Copy and sanitize data in `infile` that is not touched by
...@@ -1142,7 +1142,7 @@ class AgipdCorrections: ...@@ -1142,7 +1142,7 @@ class AgipdCorrections:
firange = firange[0::2] firange = firange[0::2]
alltrains = self.infile[agipd_base + "image/trainId"] alltrains = self.infile[agipd_base + "image/trainId"]
alltrains = np.squeeze( alltrains = np.squeeze(
alltrains[first_index:last_index, ...]) # [self.can_calibrate] alltrains[first_index:last_index, ...])
# these are touched in the correct function, do not copy them here # these are touched in the correct function, do not copy them here
dont_copy = ["data", "cellId", "trainId", "pulseId", "status", dont_copy = ["data", "cellId", "trainId", "pulseId", "status",
...@@ -1471,8 +1471,8 @@ class AgipdCorrections: ...@@ -1471,8 +1471,8 @@ class AgipdCorrections:
photon_energy, photon_energy,
pixels_x=512, pixels_x=512,
pixels_y=128, pixels_y=128,
beam_energy=None), beam_energy=None), # noqa
# noqa
np.ones((128, 512, max_cells_db, 2)), np.ones((128, 512, max_cells_db, 2)),
cal_db_interface, cal_db_interface,
creation_time=creation_time, creation_time=creation_time,
......
...@@ -93,11 +93,11 @@ class LpdCorrections: ...@@ -93,11 +93,11 @@ class LpdCorrections:
# emprically determined from APD datasets p900038, r155,r156 # emprically determined from APD datasets p900038, r155,r156
self.cnl_const = { self.cnl_const = {
'high': {'A': -0.000815934, 'lam': 0.00811281, 'c': 1908.89, 'high': {'A': -0.000815934, 'lam': 0.00811281, 'c': 1908.89,
'm': 0, 'b': 0}, # noqa 'm': 0, 'b': 0},
'med': {'A': 0.0999894, 'lam': -0.00137652, 'c': 3107.83, 'med': {'A': 0.0999894, 'lam': -0.00137652, 'c': 3107.83,
'm': 3.89982e-06, 'b': -0.116811}, # noqa 'm': 3.89982e-06, 'b': -0.116811},
'low': {'A': 0.0119132, 'lam': -0.0002, 'c': 36738.6, 'low': {'A': 0.0119132, 'lam': -0.0002, 'c': 36738.6,
'm': 2.00273e-08, 'b': 0.245537}} # noqa 'm': 2.00273e-08, 'b': 0.245537}}
def get_iteration_range(self): def get_iteration_range(self):
"""Returns a range expression over which to iterate in chunks """Returns a range expression over which to iterate in chunks
...@@ -662,8 +662,7 @@ class LpdCorrections: ...@@ -662,8 +662,7 @@ class LpdCorrections:
pixels_x=256, pixels_x=256,
pixels_y=256, pixels_y=256,
beam_energy=None, beam_energy=None,
capacitor=capacitor), capacitor=capacitor), # noqa
# noqa
np.ones((256, 256)), np.ones((256, 256)),
cal_db_interface, cal_db_interface,
creation_time=creation_time, creation_time=creation_time,
......
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