Skip to content

Commit 82ce3f2

Browse files
committed
some further fixes
1 parent 30c9895 commit 82ce3f2

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

sed/calibrator/momentum.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,8 +680,9 @@ def spline_warp_estimate(
680680
if "creation_date" in self.correction:
681681
datestring = datetime.fromtimestamp(
682682
self.correction["creation_date"],
683-
).strftime
684-
("%m/%d/%Y, %H:%M:%S",)
683+
).strftime(
684+
"%m/%d/%Y, %H:%M:%S",
685+
)
685686
logger.info(
686687
"No landmarks defined, using momentum correction parameters "
687688
f"generated on {datestring}",
@@ -1873,6 +1874,7 @@ def append_k_axis(
18731874
new_x_column: str = None,
18741875
new_y_column: str = None,
18751876
calibration: dict = None,
1877+
suppress_output: bool = False,
18761878
**kwds,
18771879
) -> tuple[pd.DataFrame | dask.dataframe.DataFrame, dict]:
18781880
"""Calculate and append the k axis coordinates (kx, ky) to the events dataframe.
@@ -1892,6 +1894,8 @@ def append_k_axis(
18921894
momentum calibration. Defaults to config["momentum"]["ky_column"].
18931895
calibration (dict, optional): Dictionary containing calibration parameters.
18941896
Defaults to 'self.calibration' or config["momentum"]["calibration"].
1897+
suppress_output (bool, optional): Option to suppress output of diagnostic information.
1898+
Defaults to False.
18951899
**kwds: Keyword parameters for momentum calibration. Parameters are added
18961900
to the calibration dictionary.
18971901
@@ -1938,6 +1942,12 @@ def append_k_axis(
19381942
if len(kwds) > 0:
19391943
raise TypeError(f"append_k_axis() got unexpected keyword arguments {kwds.keys()}.")
19401944

1945+
if "creation_date" in calibration and not suppress_output:
1946+
datestring = datetime.fromtimestamp(calibration["creation_date"]).strftime(
1947+
"%m/%d/%Y, %H:%M:%S",
1948+
)
1949+
logger.info(f"Using momentum calibration parameters generated on {datestring}")
1950+
19411951
try:
19421952
(df[new_x_column], df[new_y_column]) = detector_coordinates_2_k_coordinates(
19431953
r_det=df[x_column],

sed/core/processor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,7 @@ def apply_momentum_calibration(
966966
tdf, _ = self.mc.append_k_axis(
967967
df=self._timed_dataframe,
968968
calibration=calibration,
969+
suppress_output=True,
969970
**kwds,
970971
)
971972

tutorial/4_hextof_workflow.ipynb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,6 @@
503503
" d={'value':1.0,'min': .2, 'max':1.0, 'vary':False},\n",
504504
" t0={'value':5e-7, 'min': 1e-7, 'max': 1e-6, 'vary':True},\n",
505505
" E0={'value': 0., 'min': -100, 'max': 100, 'vary': True},\n",
506-
" verbose=True,\n",
507506
")"
508507
]
509508
},

0 commit comments

Comments
 (0)