Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/pypa/gh-action-pyp…
Browse files Browse the repository at this point in the history
…i-publish-897895f1e160c830e369f9779632ebc134688e1b
  • Loading branch information
Anselmoo authored Sep 24, 2024
2 parents 8775850 + ff7636f commit 32b979d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ repos:
- id: pydocstyle
additional_dependencies: [toml>=0.10.2]
- repo: https://github.com/PyCQA/pylint
rev: "v3.2.7"
rev: "v3.3.0"
hooks:
- id: pylint
additional_dependencies: [toml>=0.10.2, numpy>=1.23.4, pydantic>=2.1]
Expand Down
19 changes: 19 additions & 0 deletions spectrafit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@
!!! info "About Versioning"
SpectraFit uses [Semantic Versioning](https://semver.org/).
!!! warning "About Python Versions"
Currently, SpectraFit only supports Python 3.8 and above. Soon, Python 3.8
will be deprecated in favor of Python 3.9 and above, see also
[Release Schedule](https://devguide.python.org/versions/#end-of-life-branches).
"""

import sys
import warnings


if sys.version_info[:2] == (3, 8):
warnings.warn(
"Support for Python 3.8 is approaching its end-of-life. "
"Please consider upgrading to Python 3.9 or newer. "
"For more details, see: "
"https://devguide.python.org/versions/#end-of-life-branches.",
DeprecationWarning,
)

__version__ = "1.0.4"
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 32b979d

Please sign in to comment.