-
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.
Add logging and usage of pattern for glob
- Loading branch information
1 parent
a1c703e
commit 98ac2b5
Showing
3 changed files
with
42 additions
and
16 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
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 |
---|---|---|
@@ -1,45 +1,67 @@ | ||
import argparse | ||
from pathlib import Path | ||
import logging | ||
|
||
from calcium_imaging_automation.core.reader import ReadAllPathsInFolder | ||
from calcium_imaging_automation.core.writer import DatashuttleWrapper | ||
|
||
|
||
def main(raw_data_path: Path, output_path: Path, filetypes_of_interest: list): | ||
def main( | ||
raw_data_path: Path, | ||
output_path: Path, | ||
filetypes_of_interest: list, | ||
folder_read_pattern: str, | ||
): | ||
""" | ||
Draft usage of the pipeline, now consisting of read and write operations. | ||
""" | ||
reader = ReadAllPathsInFolder(raw_data_path, filetypes_of_interest) | ||
logging.basicConfig( | ||
filename=output_path / "logs" / "pipeline.log", | ||
level=logging.INFO, | ||
format="%(asctime)s - %(message)s", | ||
) | ||
|
||
reader = ReadAllPathsInFolder( | ||
raw_data_path, filetypes_of_interest, folder_read_pattern | ||
) | ||
logging.info(f"Found {len(reader.datasets_paths)} datasets.") | ||
logging.info(f"Dataset names: {reader.dataset_names}") | ||
|
||
writer = DatashuttleWrapper(output_path) | ||
|
||
number_of_tiffs = reader.max_session_number(filetype="tif") | ||
writer.create_folders(reader.dataset_names, session_number=number_of_tiffs) | ||
|
||
# [Placeholder for data processing] | ||
|
||
logging.info("Pipeline finished.") | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser( | ||
description="Example usage of the pipeline manager." | ||
) | ||
|
||
parser.add_argument( | ||
"raw_data_path", type=Path, help="Path to the raw data." | ||
) | ||
parser.add_argument( | ||
"output_path", type=Path, help="Path to the output data." | ||
) | ||
parser.add_argument("raw_data_path", type=Path, help="Path to the raw data.") | ||
parser.add_argument("output_path", type=Path, help="Path to the output data.") | ||
parser.add_argument( | ||
"--filetypes", | ||
type=list, | ||
nargs="+", | ||
help="Filetypes of interest.", | ||
default=["tif", "bin"], | ||
) | ||
parser.add_argument( | ||
"--folder_read_pattern", | ||
type=str, | ||
help="Glob pattern for reading files.", | ||
default="*", | ||
) | ||
|
||
args = parser.parse_args() | ||
raw_data_path = args.raw_data_path | ||
output_path = args.output_path | ||
file_types = args.filetypes | ||
folder_read_pattern = args.folder_read_pattern | ||
|
||
main(raw_data_path, output_path, file_types) | ||
main(raw_data_path, output_path, file_types, folder_read_pattern) |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#! /bin/bash | ||
python ./examples/example_usage.py \ | ||
/Users/lauraporta/local_data/rotation/ \ | ||
/Users/lauraporta/local_data/test/ | ||
/Volumes/winstor/swc/margrie/SimonWeiler/RawData/Invivo_imaging/3photon_rotation/shared/ \ | ||
/Users/laura/local_data/calcimaut/ \ | ||
--folder_read_pattern '2*' \ |