Skip to content

Commit

Permalink
added openpyxl as extra dependency for filter_files_dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
comane committed Apr 8, 2024
1 parent 634e41f commit 858d246
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
24 changes: 24 additions & 0 deletions nnpdf_data/nnpdf_data/athena_utils.py
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]
5 changes: 4 additions & 1 deletion nnpdf_data/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@ exclude = [
# Data files
include = [
# The version file is ignored by git so it needs to be explicitly included
"nnpdf_data/_version.py"
"nnpdf_data/_version.py",
]

[tool.poetry.dependencies]
python = "^3.9"
"ruamel.yaml" = "<0.18"

[tool.poetry.extras]
filter_files_dependencies = ["openpyxl",]

[tool.poetry-dynamic-versioning]
enable = true
vcs = "git"
Expand Down

0 comments on commit 858d246

Please sign in to comment.