You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.1 KiB
53 lines
1.1 KiB
""" Sensospot Data Parser |
|
|
|
Parsing the numerical output from Sensovations Sensospot image analysis. |
|
""" |
|
|
|
__version__ = "0.6.0" |
|
|
|
|
|
import sys |
|
from pathlib import Path |
|
|
|
import click |
|
|
|
from .parser import parse_file, parse_folder # noqa: F401 |
|
from .parameters import ExposureInfo # noqa: F401 |
|
|
|
|
|
@click.command() |
|
@click.argument( |
|
"source", |
|
type=click.Path( |
|
exists=True, |
|
file_okay=False, |
|
dir_okay=True, |
|
readable=True, |
|
writable=True, |
|
), |
|
) |
|
@click.option( |
|
"-o", |
|
"--outfile", |
|
default="collected_data.csv", |
|
help=( |
|
"Output file name, use a dash '-' for stdout, " |
|
"default: 'collected_data.csv'" |
|
), |
|
) |
|
@click.option( |
|
"-q", |
|
"--quiet", |
|
is_flag=True, |
|
default=False, |
|
help="Ignore Sanity Check", |
|
) |
|
def run(source, outfile, quiet=False): |
|
source_path = Path(source) |
|
# read the raw data of a folder |
|
raw_data = parse_folder(source_path, quiet=quiet) |
|
if outfile.strip() == "-": |
|
raw_data.to_csv(sys.stdout, sep="\t") |
|
else: |
|
csv_file = source_path / outfile |
|
raw_data.to_csv(csv_file, sep="\t")
|
|
|