Skip to content

Commit

Permalink
add documentation about feature
Browse files Browse the repository at this point in the history
  • Loading branch information
zain-sohail committed Jan 12, 2025
1 parent b3e79c3 commit ccd5a8c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/sed/loader/flash/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ def read_dataframe(
ftype: str = "h5",
metadata: dict = {},
collect_metadata: bool = False,
filter_timed_by_electron: bool = True,
**kwds,
) -> tuple[dd.DataFrame, dd.DataFrame, dict]:
"""
Expand All @@ -320,9 +319,6 @@ def read_dataframe(
ftype (str, optional): The file extension type. Defaults to "h5".
metadata (dict, optional): Additional metadata. Defaults to None.
collect_metadata (bool, optional): Whether to collect metadata. Defaults to False.
filter_timed_by_electron (bool, optional): When True, the timed dataframe will only
contain data points where valid electron events were detected. When False, all
timed data points are included regardless of electron detection. Defaults to True.
Keyword Args:
detector (str, optional): The detector to use. Defaults to "".
Expand All @@ -334,6 +330,9 @@ def read_dataframe(
remove_invalid_files (bool, optional): Whether to exclude invalid files.
Defaults to False.
scicat_token (str, optional): The scicat token to use for fetching metadata.
filter_timed_by_electron (bool, optional): When True, the timed dataframe will only
contain data points where valid electron events were detected. When False, all
timed data points are included regardless of electron detection. Defaults to True.
Returns:
tuple[dd.DataFrame, dd.DataFrame, dict]: A tuple containing the concatenated DataFrame
Expand All @@ -349,6 +348,7 @@ def read_dataframe(
debug = kwds.pop("debug", False)
remove_invalid_files = kwds.pop("remove_invalid_files", False)
scicat_token = kwds.pop("scicat_token", None)
filter_timed_by_electron = kwds.pop("filter_timed_by_electron", True)

if len(kwds) > 0:
raise ValueError(f"Unexpected keyword arguments: {kwds.keys()}")
Expand Down
21 changes: 20 additions & 1 deletion tutorial/4_hextof_workflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@
"assert config_file.exists()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The path to the processed folder can also be defined as a keyword argument later."
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -162,7 +169,19 @@
"metadata": {},
"source": [
"### Generate the Processor instance\n",
"this cell generates an instance of the `SedProcessor` class. It will be our workhorse for the entire workflow."
"this cell generates an instance of the `SedProcessor` class. It will be our workhorse for the entire workflow.\n",
"\n",
"#### Important note\n",
"The following extra arguments are available for FlashLoader. None of which are necessary to give but helpful to know.\n",
"- **force_recreate**: Probably the most useful. In case the config is changed, this allows to reduce the raw h5 files to the the intermediate parquet format again. Otherwise, the schema between the saved dataframe and config differs.\n",
"- **debug**: Setting this runs the reduction process in serial, so the errors are easier to find.\n",
"- **remove_invalid_files**: Sometimes some critical channels defined in the config are missing in some raw files. Setting this will make sure to ignore such files.\n",
"- **filter_timed_by_electron**: Defaults to True. When True, the timed dataframe will only\n",
" contain data points where valid electron events were detected. When False, all\n",
" timed data points are included regardless of electron detection (see https://github.com/OpenCOMPES/sed/issues/307)\n",
"- **processed_dir**: Location to save the reduced parquet files. \n",
"- **scicat_token**: Token from your scicat account.\n",
"- **detector**: '1Q' and '4Q' detector for example. Useful when there are separate raw files for each detector."
]
},
{
Expand Down

0 comments on commit ccd5a8c

Please sign in to comment.