Commit c9f59694 authored by Julia Garriga Ferrer's avatar Julia Garriga Ferrer
Browse files

[app][ows_to_script] Add treated data option

parent ca2ad08a
Pipeline #51391 passed with stage
in 5 minutes and 11 seconds
......@@ -66,6 +66,7 @@ if __name__ == '__main__':
import argparse
import sys
import os
import glob
from darfix.core.dataset import Dataset
from silx.gui import qt
......@@ -83,9 +84,9 @@ if __name__ == '__main__':
type=str,
default=None)
parser.add_argument(
'-fs',
'--filenames',
help='List of filenames to read',
'-tr',
'--treated_data',
help='Directory to save treated data',
type=str,
default=None)
parser.add_argument(
......@@ -97,18 +98,32 @@ if __name__ == '__main__':
options = parser.parse_args(sys.argv[1:])
if not (options.file_directory or options.first_filename or options.filenames):
parser.error('Please enter the file directory, first filename or list of filenames')
if not (options.file_directory or options.first_filename):
parser.error('Please enter the file directory or first filename')
else:
_dir = options.file_directory
if options.first_filename:
_dir = _dir if _dir != None else os.path.dirname(options.first_filename)
if options.treated_data:
if not options.first_filename:
filenames = sorted([x for x in glob.glob(_dir + "/*") if os.path.isfile(x)])
_dir = options.treated_data
dataset = Dataset(_dir=_dir,
filenames=filenames,
copy_files=True, in_memory=not options.in_disk)
else:
dataset = Dataset(_dir=options.treated_data,
first_filename=options.first_filename,
copy_files=True, in_memory=not options.in_disk)
else:
_dir = _dir if _dir != None else os.path.dirname(options.filenames[0])
dataset = Dataset(_dir=_dir,
first_filename=options.first_filename,
filenames=options.filenames,
copy_files=True, in_memory=not options.in_disk)
if not options.first_filename:
filenames = sorted([x for x in glob.glob(_dir + "/*") if os.path.isfile(x)])
dataset = Dataset(_dir=_dir,
filenames=filenames,
copy_files=True, in_memory=not options.in_disk)
else:
dataset = Dataset(_dir=_dir,
first_filename=options.first_filename,
copy_files=True, in_memory=not options.in_disk)
main(input_data=(dataset, None, None, None), channel='dataset')
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment