Skip to content

Commit

Permalink
fix docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
rettigl committed Jan 4, 2024
1 parent 188dbb7 commit 0e01998
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 28 deletions.
22 changes: 10 additions & 12 deletions sed/calibrator/delay.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def add_offsets(
Args:
df (Union[pd.DataFrame, dask.dataframe.DataFrame]): Dataframe to use.
offset (Dict, optional): Dictionary of delay offset parameters.
offsets (Dict, optional): Dictionary of delay offset parameters.
constant (float, optional): The constant to shift the delay axis by.
flip_delay_axis (bool, optional): Whether to flip the time axis. Defaults to False.
columns (Union[str, Sequence[str]]): Name of the column(s) to apply the shift from.
Expand All @@ -233,6 +233,7 @@ def add_offsets(
of dask.dataframe.Series. For example "mean". In this case the function is applied
to the column to generate a single value for the whole dataset. If None, the shift
is applied per-dataframe-row. Defaults to None. Currently only "mean" is supported.
delay_column (str, optional): Name of the column containing the delay values.
verbose (bool, optional): Option to print out diagnostic information.
Defaults to True.
Expand Down Expand Up @@ -381,13 +382,13 @@ def extract_delay_stage_parameters(
Read delay stage ranges from hdf5 file
Parameters:
file: filename
p1_key: hdf5 path to the start of the scan range
p2_key: hdf5 path to the end of the scan range
t0_key: hdf5 path to the t0 value
file (str): filename
p1_key (str): hdf5 path to the start of the scan range
p2_key (str): hdf5 path to the end of the scan range
t0_key (str): hdf5 path to the t0 value
Returns:
(p1_value, p2_value, t0_value)
tuple: (p1_value, p2_value, t0_value)
"""
with h5py.File(file, "r") as file_handle:
values = []
Expand All @@ -408,14 +409,11 @@ def mm_to_ps(
(double pass).
Args:
delay_mm (Union[float, Sequence[float]]):
Delay stage position in mm
time0_mm (_type_):
Delay stage position of pump-probe overlap in mm
delay_mm (Union[float, Sequence[float]]): Delay stage position in mm
time0_mm (float): Delay stage position of pump-probe overlap in mm
Returns:
Union[float, Sequence[float]]:
Relative delay in picoseconds
Union[float, Sequence[float]]: Relative delay in picoseconds
"""
delay_ps = (delay_mm - time0_mm) / 0.15
return delay_ps
2 changes: 1 addition & 1 deletion sed/calibrator/energy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1491,7 +1491,7 @@ def add_offsets(
Args:
df (Union[pd.DataFrame, dask.dataframe.DataFrame]): Dataframe to use.
offset (Dict, optional): Dictionary of energy offset parameters.
offsets (Dict, optional): Dictionary of energy offset parameters.
constant (float, optional): The constant to shift the energy axis by.
columns (Union[str, Sequence[str]]): Name of the column(s) to apply the shift from.
weights (Union[float, Sequence[float]]): weights to apply to the columns.
Expand Down
8 changes: 4 additions & 4 deletions sed/calibrator/momentum.py
Original file line number Diff line number Diff line change
Expand Up @@ -1015,10 +1015,10 @@ def pose_adjustment(
Option to report the performed transformations. Defaults to True.
**kwds: Keyword parameters defining defaults for the transformations:
- *scale* (float): Initial value of the scaling slider.
- *xtrans* (float): Initial value of the xtrans slider.
- *ytrans* (float): Initial value of the ytrans slider.
- *angle* (float): Initial value of the angle slider.
- **scale** (float): Initial value of the scaling slider.
- **xtrans** (float): Initial value of the xtrans slider.
- **ytrans** (float): Initial value of the ytrans slider.
- **angle** (float): Initial value of the angle slider.
"""
matplotlib.use("module://ipympl.backend_nbagg")
if self.slice_corrected is None or not self.slice_corrected.any():
Expand Down
32 changes: 21 additions & 11 deletions sed/core/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@ class SedProcessor:
the config. Defaults to None.
folder (str, optional): Folder containing files to pass to the loader
defined in the config. Defaults to None.
runs (Sequence[str], optional): List of run identifiers to pass to the loader
defined in the config. Defaults to None.
collect_metadata (bool): Option to collect metadata from files.
Defaults to False.
verbose (bool, optional): Option to print out diagnostic information.
Defaults to config["core"]["verbose"] or False.
**kwds: Keyword arguments passed to the reader.
"""

Expand Down Expand Up @@ -355,6 +359,8 @@ def load(
loader. Defaults to None.
folder (str, optional): Folder path to pass to the loader.
Defaults to None.
collect_metadata (bool, optional): Option for collecting metadata in the reader.
**kwds: Keyword parameters passed to the reader.
Raises:
ValueError: Raised if no valid input is provided.
Expand Down Expand Up @@ -520,8 +526,10 @@ def define_features(
Defaults to False.
include_center (bool, optional): Option to include a point at the center
in the feature list. Defaults to True.
***kwds: Keyword arguments for MomentumCorrector.feature_extract() and
MomentumCorrector.feature_select()
apply (bool, optional): Option to directly apply the values and select the
slice. Defaults to False.
**kwds: Keyword arguments for ``MomentumCorrector.feature_extract()`` and
``MomentumCorrector.feature_select()``.
"""
if auto_detect: # automatic feature selection
sigma = kwds.pop("sigma", self._config["momentum"]["sigma"])
Expand Down Expand Up @@ -664,10 +672,10 @@ def pose_adjustment(
Defaults to config["core"]["verbose"].
**kwds: Keyword parameters defining defaults for the transformations:
- *scale* (float): Initial value of the scaling slider.
- *xtrans* (float): Initial value of the xtrans slider.
- *ytrans* (float): Initial value of the ytrans slider.
- *angle* (float): Initial value of the angle slider.
- **scale** (float): Initial value of the scaling slider.
- **xtrans** (float): Initial value of the xtrans slider.
- **ytrans** (float): Initial value of the ytrans slider.
- **angle** (float): Initial value of the angle slider.
"""
if verbose is None:
verbose = self.verbose
Expand Down Expand Up @@ -974,6 +982,7 @@ def adjust_energy_correction(
correction. Defaults to config["energy"]["correction"]["center"].
apply (bool, optional): Option to directly apply the provided or default
correction parameters. Defaults to False.
**kwds: Keyword parameters passed to ``EnergyCalibrator.adjust_energy_correction()``.
"""
if self._pre_binned is None:
print(
Expand Down Expand Up @@ -1198,7 +1207,7 @@ def find_bias_peaks(
Args:
ranges (Union[List[Tuple], Tuple]): Tuple of TOF values indicating a range.
Alternatively, a list of ranges for all traces can be given.
refid (int, optional): The id of the trace the range refers to.
ref_id (int, optional): The id of the trace the range refers to.
Defaults to 0.
infer_others (bool, optional): Whether to determine the range for the other
traces. Defaults to True.
Expand Down Expand Up @@ -1563,7 +1572,7 @@ def append_tof_ns_axis(
Defaults to False.
verbose (bool, optional): Option to print out diagnostic information.
Defaults to config["core"]["verbose"].
**kwds: additional arguments are passed to ``energy.tof_step_to_ns()``.
**kwds: additional arguments are passed to ``EnergyCalibrator.tof_step_to_ns()``.
"""
if verbose is None:
Expand Down Expand Up @@ -1618,7 +1627,7 @@ def align_dld_sectors(
Defaults to False.
verbose (bool, optional): Option to print out diagnostic information.
Defaults to config["core"]["verbose"].
**kwds: additional arguments are passed to ``energy.align_dld_sectors()``.
**kwds: additional arguments are passed to ``EnergyCalibrator.align_dld_sectors()``.
"""
if verbose is None:
verbose = self.verbose
Expand Down Expand Up @@ -1788,6 +1797,7 @@ def add_delay_offset(
Args:
constant (float, optional): The constant to shift the delay axis by.
flip_delay_axis (bool, optional): Option to reverse the direction of the delay axis.
columns (Union[str, Sequence[str]]): Name of the column(s) to apply the shift from.
weights (Union[float, Sequence[float]]): weights to apply to the columns.
Can also be used to flip the sign (e.g. -1). Defaults to 1.
Expand Down Expand Up @@ -1927,7 +1937,7 @@ def add_jitter(
jittering noise. If one number is given, the same is used for all axes.
For uniform noise (default) it will cover the interval [-amp, +amp].
Defaults to config["dataframe"]["jitter_amps"].
**kwds: additional keyword arguments passed to apply_jitter
**kwds: additional keyword arguments passed to ``apply_jitter``.
"""
if cols is None:
cols = self._config["dataframe"]["jitter_cols"]
Expand Down Expand Up @@ -1983,7 +1993,7 @@ def add_time_stamped_data(
If omitted, data are retrieved from the epics archiver.
archiver_channel (str, optional): EPICS archiver channel from which to retrieve data.
Either this or data and time_stamps have to be present.
**kwds: additional keyword arguments passed to add_time_stamped_data
**kwds: additional keyword arguments passed to ``add_time_stamped_data``.
"""
time_stamp_column = kwds.pop(
"time_stamp_column",
Expand Down

0 comments on commit 0e01998

Please sign in to comment.