Skip to content

Commit

Permalink
chore: ♻️ Update RIXSConverter class documentation and argument descr…
Browse files Browse the repository at this point in the history
…iptions

Update the documentation and argument descriptions in the RIXSConverter class to provide clearer explanations and improve readability. This commit also renames some argument labels for consistency and adds default values for certain arguments. The changes aim to enhance the understanding and usability of the RIXSConverter class for converting raw pickle data into JSON, TOML, or numpy formats for RIXS visualization.
  • Loading branch information
Anselmoo committed Sep 24, 2024
1 parent 0445e3f commit f8bce19
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions spectrafit/plugins/rixs_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,64 +23,62 @@


class RIXSConverter(Converter):
"""Transform the raw pkl data into a JSON, TOML, or numpy file for RIXS."""
"""Convert raw pickle data into JSON, TOML, or numpy formats."""

def get_args(self) -> Dict[str, Any]:
"""Get the arguments from the command line.
"""Retrieve command-line arguments.
Returns:
Dict[str, Any]: Return the input file arguments as a dictionary without
additional information beyond the command line arguments.
Dict[str, Any]: Dictionary of input file arguments.
"""
parser = argparse.ArgumentParser(
description="Converter for 'SpectraFit' from pkl files to a JSON, TOML, "
"or numpy file for RIXS-Visualizer.",
usage="%(prog)s [options] infile",
description="Convert 'SpectraFit' pickle files to JSON, "
"TOML, or numpy formats for RIXS-Visualizer.",
usage="%(prog)s [options] input_file",
)
parser.add_argument(
"infile",
type=Path,
help="Filename of the pkl file to convert to JSON, TOML, or numpy.",
help="Path to the pickle file to be converted.",
)
parser.add_argument(
"-f",
"--file-format",
help="File format for the optional encoding of the pickle file."
" Default is 'latin1'.",
help="Encoding format of the pickle file (default: 'latin1').",
type=str,
default="latin1",
choices=choices_fformat,
)
parser.add_argument(
"-e",
"--export-format",
help="File extension for the export.",
help="Desired export file format (default: 'json').",
type=str,
default="json",
choices=choices_export,
)
parser.add_argument(
"-ie",
"--incident_energy",
help="Name of the incident energy",
"--incident-energy",
help="Label for the incident energy.",
type=str,
)
parser.add_argument(
"-ee",
"--emission_energy",
help="Name of the emitted energy",
"--emission-energy",
help="Label for the emitted energy.",
type=str,
)
parser.add_argument(
"-rm",
"--rixs_map",
help="Name of the RIXS map",
"--rixs-map",
help="Label for the RIXS map.",
type=str,
)
parser.add_argument(
"-m",
"--mode",
help="Mode of the RIXS map post-processing, e.g. 'sum' or 'max'."
"Default is 'sum'.",
help="Post-processing mode for the RIXS map (default: 'sum').",
type=str,
default="sum",
choices=choices_mode,
Expand Down

0 comments on commit f8bce19

Please sign in to comment.