-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added openpyxl as extra dependency for filter_files_dependencies
- Loading branch information
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import pandas as pd | ||
from pathlib import Path | ||
|
||
def read_excel(path_xlsx: Path, beams: tuple) -> pd.DataFrame: | ||
"""Parse the xlsx file containing all the information regarding | ||
the projections and returns the ones corresponding to the chosen | ||
beam energies. | ||
Parameters | ||
---------- | ||
path_xlsx : Path | ||
path to the xlsx file | ||
beams: tuple | ||
tuple specifying the beam energies of the lepton & proton | ||
Returns | ||
------- | ||
pd.DataFrame | ||
returns a panda table corresponding to the chosen beams | ||
""" | ||
xdf = pd.read_excel(path_xlsx) | ||
el, ep = beams | ||
df_beam = xdf[(xdf["El"] == el) & (xdf["Eh"] == ep)] | ||
return df_beam[df_beam["y"] <= 1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters