-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9cf0ac1
commit 358b6a6
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import cyclopts | ||
import yaml | ||
from pathlib import Path | ||
from rich.pretty import pprint | ||
from depiction.persistence import ImzmlReadFile, ImzmlWriteFile, ImzmlModeEnum | ||
from depiction.tools.process_spectra.config import ProcessSpectraConfig | ||
from depiction.tools.process_spectra.process import process_spectra | ||
|
||
app = cyclopts.App() | ||
|
||
|
||
@app.command | ||
def validate(config_file: Path) -> ProcessSpectraConfig: | ||
config = ProcessSpectraConfig.model_validate(yaml.safe_load(config_file.read_text())) | ||
pprint(config) | ||
return config | ||
|
||
|
||
@app.default | ||
def process(input_imzml_file: Path, output_imzml_file: Path, config_file: Path) -> None: | ||
config = validate(config_file) | ||
read_file = ImzmlReadFile(input_imzml_file) | ||
# TODO in the future we might implement logic to determine when this can still be set to CONTINUOUS | ||
write_file = ImzmlWriteFile(output_imzml_file, ImzmlModeEnum.PROCESSED) | ||
process_spectra(read_file=read_file, write_file=write_file, config=config) | ||
|
||
|
||
if __name__ == "__main__": | ||
app() |