Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hextof_workflow_steps #169

Merged
merged 61 commits into from
Nov 2, 2023
Merged
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
60053bf
unravel 8s detector to tof and sectorID in loader
steinnymir Oct 10, 2023
de0c5a2
fix loader for 8s unravelling
steinnymir Oct 10, 2023
41d5213
linting and bugfix
steinnymir Oct 10, 2023
c367637
linting and bugfix
steinnymir Oct 10, 2023
153373d
bugfix
steinnymir Oct 10, 2023
7051b8a
linting
steinnymir Oct 10, 2023
d51b01f
linting
steinnymir Oct 10, 2023
b70bee4
update default flash config
steinnymir Oct 10, 2023
9cd0d67
update test settings for flash
steinnymir Oct 11, 2023
9dbb379
fixes from suggestions and linting
steinnymir Oct 11, 2023
ccff3f8
linting and docstrings
steinnymir Oct 11, 2023
27adcc3
add rolling average and energy shift
steinnymir Oct 11, 2023
77a6ab5
local testing
steinnymir Oct 11, 2023
8f4bded
make step2ns global
steinnymir Oct 11, 2023
73d9bb5
Merge branch 'main' into hextof_workflow_steps
steinnymir Oct 11, 2023
5848a22
implement shift_energy_axis
steinnymir Oct 11, 2023
a1ccb7a
Merge branch 'hextof_workflow_steps' into hextof_energy_shifts
steinnymir Oct 11, 2023
4945d9b
Merge pull request #174 from OpenCOMPES/hextof_energy_shifts
steinnymir Oct 12, 2023
991df97
linting
steinnymir Oct 12, 2023
98c1857
moving functions to their rightful place
steinnymir Oct 12, 2023
bfd3daa
move more functions
steinnymir Oct 13, 2023
ea5c5fd
fix tof_step_to_ns
steinnymir Oct 13, 2023
c79a106
fix linting and typos
steinnymir Oct 13, 2023
b579b8f
move split_sector_id to flash loader + tests
steinnymir Oct 16, 2023
abd3de7
apply suggestions and move sector_alignment
steinnymir Oct 16, 2023
8c75446
minor fixes and tests
steinnymir Oct 18, 2023
0afe469
add smooth functions
steinnymir Oct 18, 2023
35af57c
add tutorial notebook
steinnymir Oct 18, 2023
9479ce8
fix linting and tests
steinnymir Oct 19, 2023
43776a3
add bfill and tests
steinnymir Oct 19, 2023
9edf50a
move tof_to_ns inside ec class
steinnymir Oct 19, 2023
8ba65e9
move dld_sector_correction to ec
steinnymir Oct 19, 2023
b93cd7b
fix
steinnymir Oct 19, 2023
eaeeff4
harder fix
steinnymir Oct 19, 2023
acc9c4a
fix linting
steinnymir Oct 23, 2023
a1066e5
fix linting
steinnymir Oct 23, 2023
ff7012a
Merge branch 'main' into hextof_workflow_steps
steinnymir Oct 23, 2023
b42bb3e
Merge branch 'main' into hextof_workflow_steps
steinnymir Oct 24, 2023
0d73776
add option to initialize fit params
steinnymir Oct 24, 2023
b1c158d
energy calibration notebook and config
steinnymir Oct 24, 2023
d42f2e0
partial working energy calibration
rettigl Oct 25, 2023
0433019
working energy calibration
rettigl Oct 25, 2023
4cad800
tof2ns fix units and linting
steinnymir Oct 25, 2023
5b866ca
fix energy calibration and hextof notebook
steinnymir Oct 25, 2023
fa1cd5c
refactor and move apply_energy_offset
steinnymir Oct 25, 2023
babc325
remove redundant notebooks
steinnymir Oct 25, 2023
09b2dad
linting
steinnymir Oct 25, 2023
68bf2b4
bug fix
steinnymir Oct 25, 2023
6fc47ac
linting
steinnymir Oct 25, 2023
60242a7
linting
steinnymir Oct 25, 2023
050f89c
Merge branch 'main' into hextof_workflow_steps
steinnymir Oct 27, 2023
61045d0
apply suggested changes and remove rolling avg
steinnymir Oct 30, 2023
7554c71
refactor energy offset for performance and tests
steinnymir Nov 1, 2023
3160d20
Merge branch 'main' into hextof_workflow_steps
steinnymir Nov 1, 2023
fdf12ec
linting and bugfix
steinnymir Nov 1, 2023
b8911ea
linting and more tests
steinnymir Nov 1, 2023
2538e28
test tof_ns
steinnymir Nov 1, 2023
3dafe4e
update notebook and add offset to save ecalib
steinnymir Nov 1, 2023
8308eba
test sector_alignment
steinnymir Nov 1, 2023
956de39
yet an other linting
steinnymir Nov 1, 2023
266444f
apply suggested changes
steinnymir Nov 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
make step2ns global
steinnymir committed Oct 11, 2023

Verified

This commit was signed with the committer’s verified signature.
danpat Daniel Patterson
commit 8f4bded026d96864bd9b77b2d3a501b5cfe7ea2d
29 changes: 25 additions & 4 deletions sed/calibrator/hextof.py
Original file line number Diff line number Diff line change
@@ -141,14 +141,35 @@ def dld_time_to_ns(
raise ValueError("Either tof_ns_column or config must be given.")
tof_ns_column = config["dataframe"]["tof_ns_column"]

def convert_to_ns(x):
val = x[tof_column] * tof_binwidth * 2**tof_binning
return val.astype(np.float32)

df[tof_ns_column] = df.map_partitions(
convert_to_ns, meta=(tof_column, np.float32)
step2ns, meta=(tof_column, np.float64)
)
metadata: Dict[str,Any] = {
"applied": True,
"tof_binwidth": tof_binwidth
}
return df, metadata

def step2ns(
df: Union[pd.DataFrame, dask.dataframe.DataFrame],
tof_column: str,
tof_binwidth: float,
tof_binning: int,
dtype: type = np.float64,
) -> Union[pd.DataFrame, dask.dataframe.DataFrame]:
""" Converts the time-of-flight steps to time-of-flight in nanoseconds.

designed for use with dask.dataframe.DataFrame.map_partitions.

Args:
df (Union[pd.DataFrame, dask.dataframe.DataFrame]): Dataframe to convert.
tof_column (str): Name of the column containing the time-of-flight steps.
tof_binwidth (float): Time step size in nanoseconds.
tof_binning (int): Binning of the time-of-flight steps.

Returns:
Union[pd.DataFrame, dask.dataframe.DataFrame]: Dataframe with the new column.
"""
val = df[tof_column].astype(dtype) * tof_binwidth * 2**tof_binning
return val.astype(dtype)