Skip to content

Commit

Permalink
fix config references
Browse files Browse the repository at this point in the history
  • Loading branch information
rettigl committed Dec 21, 2024
1 parent 0f39523 commit d76deab
Show file tree
Hide file tree
Showing 22 changed files with 32 additions and 30 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ jobs:
- name: copy tutorial files to docs
run: |
cp -r $GITHUB_WORKSPACE/tutorial $GITHUB_WORKSPACE/docs/
cp -r $GITHUB_WORKSPACE/config $GITHUB_WORKSPACE/docs/
mkdir -p $GITHUB_WORKSPACE/docs/src/sed
cp -r $GITHUB_WORKSPACE/src/sed/config $GITHUB_WORKSPACE/docs/src/sed/
- name: download RAW data
# if: steps.cache-primes.outputs.cache-hit != 'true'
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/benchmark_sed.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def test_splinewarp() -> None:
"""Run a benchmark for the generation of the inverse dfield correction"""
processor = SedProcessor(
dataframe=dataframe.copy(),
config=package_dir + "/../../config/mpes_example_config.yaml",
config=package_dir + "/config/mpes_example_config.yaml",
folder_config={},
user_config={},
system_config={},
Expand All @@ -116,7 +116,7 @@ def test_workflow_1d() -> None:
"""Run a benchmark for 1d binning of converted data"""
processor = SedProcessor(
dataframe=dataframe.copy(),
config=package_dir + "/../../config/mpes_example_config.yaml",
config=package_dir + "/config/mpes_example_config.yaml",
folder_config={},
user_config={},
system_config={},
Expand Down Expand Up @@ -152,7 +152,7 @@ def test_workflow_4d() -> None:
"""Run a benchmark for 4d binning of converted data"""
processor = SedProcessor(
dataframe=dataframe.copy(),
config=package_dir + "/../../config/mpes_example_config.yaml",
config=package_dir + "/config/mpes_example_config.yaml",
folder_config={},
user_config={},
system_config={},
Expand Down
2 changes: 1 addition & 1 deletion docs/sed/dataset.rst
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ we can remove one instance
Default datasets.json
---------------------

.. literalinclude:: ../../sed/dataset/datasets.json
.. literalinclude:: ../../src/sed/config/datasets.json
:language: json

API
Expand Down
6 changes: 3 additions & 3 deletions docs/user_guide/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ The config mechanism returns the combined dictionary, and reports the loaded con

## Default configuration settings

```{literalinclude} ../../config/default.yaml
```{literalinclude} ../../src/sed/config/default.yaml
:language: yaml
```

## Example configuration file for mpes (METIS momentum microscope at FHI-Berlin)

```{literalinclude} ../../config/mpes_example_config.yaml
```{literalinclude} ../../src/sed/config/mpes_example_config.yaml
:language: yaml
```

## Example configuration file for flash (HEXTOF momentum microscope at FLASH, Desy)

```{literalinclude} ../../config/flash_example_config.yaml
```{literalinclude} ../../src/sed/config/flash_example_config.yaml
:language: yaml
```
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[tool.poetry]
name = "sed-processor"
packages = [{include = "sed", from = "src"}]
include = ["config"]
version = "1.0.0a0"
description = "Single Event Data Frame Processor: Backend to handle photoelectron resolved datastreams"
authors = ["OpenCOMPES team <[email protected]>"]
Expand Down
2 changes: 1 addition & 1 deletion src/sed/config/flash_example_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,4 @@ dataframe:
nexus:
reader: "mpes"
definition: "NXmpes"
input_files: ["../config/NXmpes_config-HEXTOF.json"]
input_files: ["../src/sed/config/NXmpes_config-HEXTOF.json"]
2 changes: 1 addition & 1 deletion src/sed/config/mpes_example_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -310,4 +310,4 @@ nexus:
definition: "NXmpes"
# List containing additional input files to be handed to the pynxtools converter tool,
# e.g. containing a configuration file, and additional metadata.
input_files: ["../config/NXmpes_config.json"]
input_files: ["../src/sed/config/NXmpes_config.json"]
2 changes: 1 addition & 1 deletion src/sed/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def parse_config(
folder_config: dict | str = None,
user_config: dict | str = None,
system_config: dict | str = None,
default_config: (dict | str) = f"{package_dir}/../../config/default.yaml",
default_config: (dict | str) = f"{package_dir}/config/default.yaml",
verbose: bool = True,
verify_config: bool = True,
) -> dict:
Expand Down
4 changes: 2 additions & 2 deletions src/sed/core/dfops.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ def map_columns_2d(
x_column (str): The X column of the dataframe to apply mapping to.
y_column (str): The Y column of the dataframe to apply mapping to.
**kwds:
- *new_x_column": Name of the new x-column. Default is to overwrite the x-column.
- *new_y_column": Name of the new y-column. Default is to overwrite the y-column.
- *new_x_column*: Name of the new x-column. Default is to overwrite the x-column.
- *new_y_column*: Name of the new y-column. Default is to overwrite the y-column.
Additional keyword argument are passed to the 2D mapping function.
Expand Down
4 changes: 3 additions & 1 deletion src/sed/dataset/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import shutil
import zipfile
from datetime import datetime
from importlib.util import find_spec

import requests
from tqdm.auto import tqdm
Expand All @@ -20,6 +21,7 @@
from sed.core.config import USER_CONFIG_PATH
from sed.core.logging import setup_logging

package_dir = os.path.dirname(find_spec("sed").origin)

# Configure logging
logger = setup_logging("dataset")
Expand All @@ -32,7 +34,7 @@ class DatasetsManager:
FILENAME = NAME + ".json"
json_path = {}
json_path["user"] = os.path.join(USER_CONFIG_PATH, FILENAME)
json_path["module"] = os.path.join(os.path.dirname(__file__), "../../../config", FILENAME)
json_path["module"] = os.path.join(package_dir, "config", FILENAME)
json_path["folder"] = "./" + FILENAME

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from sed.dataset import DatasetsManager as dm

package_dir = os.path.dirname(find_spec("sed").origin)
json_path = os.path.join(package_dir, "../../config/datasets.json")
json_path = os.path.join(package_dir, "config/datasets.json")


@pytest.fixture
Expand Down
8 changes: 4 additions & 4 deletions tests/test_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ def test_add_time_stamped_data() -> None:
"""Test the function to add time-stamped data"""
processor = SedProcessor(
folder=df_folder + "../mpes/",
config=package_dir + "/../../config/mpes_example_config.yaml",
config=package_dir + "/config/mpes_example_config.yaml",
folder_config={},
user_config={},
system_config={},
Expand Down Expand Up @@ -1090,7 +1090,7 @@ def test_save(caplog) -> None:
config = parse_config(
config={"dataframe": {"tof_binning": 1}},
folder_config={},
user_config=package_dir + "/../../config/mpes_example_config.yaml",
user_config=package_dir + "/config/mpes_example_config.yaml",
system_config={},
verify_config=False,
)
Expand All @@ -1099,7 +1099,7 @@ def test_save(caplog) -> None:
] = 21.0
config["metadata"]["lens_mode_config"]["6kV_kmodem4.0_30VTOF_453ns_focus.sav"]["Z1"] = 2450
config["metadata"]["lens_mode_config"]["6kV_kmodem4.0_30VTOF_453ns_focus.sav"]["F"] = 69.23
config["nexus"]["input_files"] = [package_dir + "/../../config/NXmpes_config.json"]
config["nexus"]["input_files"] = [package_dir + "/config/NXmpes_config.json"]
processor = SedProcessor(
folder=df_folder,
config=config,
Expand Down Expand Up @@ -1147,7 +1147,7 @@ def test_save(caplog) -> None:
yaml.dump({"Instrument": {"undocumented_field": "undocumented entry"}}, f)
with open("temp_config.json", "w") as f:
with open(
package_dir + "/../../config/NXmpes_config.json",
package_dir + "/config/NXmpes_config.json",
encoding="utf-8",
) as stream:
config_dict = json.load(stream)
Expand Down
2 changes: 1 addition & 1 deletion tutorial/10_hextof_workflow_trXPS_bam_correction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"outputs": [],
"source": [
"# pick the default configuration file for hextof@FLASH\n",
"config_file = Path('../config/flash_example_config.yaml')\n",
"config_file = Path('../src/sed/config/flash_example_config.yaml')\n",
"assert config_file.exists()"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"outputs": [],
"source": [
"# pick the default configuration file for hextof@FLASH\n",
"config_file = Path('../config/flash_example_config.yaml')\n",
"config_file = Path('../src/sed/config/flash_example_config.yaml')\n",
"assert config_file.exists()"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"outputs": [],
"source": [
"# create sed processor using the config file:\n",
"sp = sed.SedProcessor(folder=scandir, config=\"../config/mpes_example_config.yaml\", system_config={}, verbose=True)"
"sp = sed.SedProcessor(folder=scandir, config=\"../src/sed/config/mpes_example_config.yaml\", system_config={}, verbose=True)"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion tutorial/3_metadata_collection_and_export_to_NeXus.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
"outputs": [],
"source": [
"# create sed processor using the config file, and collect the meta data from the files:\n",
"sp = sed.SedProcessor(folder=scandir, config=\"../config/mpes_example_config.yaml\", system_config={}, metadata=metadata, collect_metadata=True)"
"sp = sed.SedProcessor(folder=scandir, config=\"../src/sed/config/mpes_example_config.yaml\", system_config={}, metadata=metadata, collect_metadata=True)"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion tutorial/4_hextof_workflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"outputs": [],
"source": [
"# pick the default configuration file for hextof@FLASH\n",
"config_file = Path('../config/flash_example_config.yaml')\n",
"config_file = Path('../src/sed/config/flash_example_config.yaml')\n",
"assert config_file.exists()"
]
},
Expand Down
2 changes: 1 addition & 1 deletion tutorial/5_sxp_workflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"outputs": [],
"source": [
"# pick the default configuration file for SXP@XFEL\n",
"config_file = Path('../config/sxp_example_config.yaml')\n",
"config_file = Path('../src/sed/config/sxp_example_config.yaml')\n",
"assert config_file.exists()"
]
},
Expand Down
2 changes: 1 addition & 1 deletion tutorial/6_binning_with_time-stamped_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"outputs": [],
"source": [
"# create sed processor using the config file with time-stamps:\n",
"sp = sed.SedProcessor(folder=scandir, user_config=\"../config/mpes_example_config.yaml\", system_config={}, time_stamps=True, verbose=True)"
"sp = sed.SedProcessor(folder=scandir, user_config=\"../src/sed/config/mpes_example_config.yaml\", system_config={}, time_stamps=True, verbose=True)"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion tutorial/7_correcting_orthorhombic_symmetry.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"outputs": [],
"source": [
"# create sed processor using the config file with time-stamps:\n",
"sp = sed.SedProcessor(folder=scandir, user_config=\"../config/mpes_example_config.yaml\", system_config={}, time_stamps=True, verbose=True)\n",
"sp = sed.SedProcessor(folder=scandir, user_config=\"../src/sed/config/mpes_example_config.yaml\", system_config={}, time_stamps=True, verbose=True)\n",
"sp.add_jitter()"
]
},
Expand Down
2 changes: 1 addition & 1 deletion tutorial/8_jittering_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"outputs": [],
"source": [
"# create sed processor using the config file:\n",
"sp = sed.SedProcessor(folder=scandir, config=\"../config/mpes_example_config.yaml\", system_config={})"
"sp = sed.SedProcessor(folder=scandir, config=\"../src/sed/config/mpes_example_config.yaml\", system_config={})"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion tutorial/9_hextof_workflow_trXPD.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"outputs": [],
"source": [
"# pick the default configuration file for hextof@FLASH\n",
"config_file = Path('../config/flash_example_config.yaml')\n",
"config_file = Path('../src/sed/config/flash_example_config.yaml')\n",
"assert config_file.exists()"
]
},
Expand Down

0 comments on commit d76deab

Please sign in to comment.