def main(): """Main program. Args: Returns: Raises: """ # Get options args = options() # Variables ########################################### # Database upload file name prefix # Use user inputs to make filenames prefix = 'plantcv' # check if there are meta_fields to filter dataset by if next(iter(args.imgtype)) != 'None': kv_list = [] for key in args.imgtype: kv_list.append(key + str(args.imgtype[key])) prefix = prefix + '_' + '_'.join(map(str, kv_list)) if args.dates: prefix = prefix + '_' + args.dates ########################################### # Open log files error_log = open(prefix + '_errors_' + args.start_time + '.log', 'w') # Run info ########################################### # Read image file names ########################################### jobcount, meta = pcvp.metadata_parser(data_dir=args.dir, meta_fields=args.fields, valid_meta=args.valid_meta, meta_filters=args.imgtype, date_format=args.timestampformat, start_date=args.start_date, end_date=args.end_date, error_log=error_log, delimiter=args.delimiter, file_type=args.type, coprocess=args.coprocess) ########################################### # Process images ########################################### # Job builder start time job_builder_start_time = time.time() print("Building job list... ", file=sys.stderr) jobs = pcvp.job_builder(meta=meta, valid_meta=args.valid_meta, workflow=args.workflow, job_dir=args.jobdir, out_dir=args.outdir, coprocess=args.coprocess, other_args=args.other_args, writeimg=args.writeimg) # Job builder clock time job_builder_clock_time = time.time() - job_builder_start_time print("took " + str(job_builder_clock_time) + '\n', file=sys.stderr) # Parallel image processing time multi_start_time = time.time() print("Processing images... ", file=sys.stderr) pcvp.multiprocess(jobs, args.cpu) # Parallel clock time multi_clock_time = time.time() - multi_start_time print("took " + str(multi_clock_time) + '\n', file=sys.stderr) ########################################### # Compile image analysis results ########################################### # Process results start time process_results_start_time = time.time() print("Processing results... ", file=sys.stderr) pcvp.process_results(job_dir=args.jobdir, json_file=args.json) # Process results clock time process_results_clock_time = time.time() - process_results_start_time print("took " + str(process_results_clock_time) + '\n', file=sys.stderr) ########################################### # Cleanup ########################################### error_log.close()
def main(): """Main program. Args: Returns: Raises: """ # Get options args = options() # Variables ########################################### # Database upload file name prefix # Use user inputs to make filenames prefix = 'plantcv' if args.imgtype is not None: kv_list = [] for key in args.imgtype: kv_list.append(key + str(args.imgtype[key])) prefix = prefix + '_' + '_'.join(map(str, kv_list)) if args.dates: prefix = prefix + '_' + args.dates ########################################### # Open log files error_log = open(prefix + '_errors_' + args.start_time + '.log', 'w') # Run info ########################################### # Read image file names ########################################### jobcount, meta = pcvp.metadata_parser(data_dir=args.dir, meta_fields=args.fields, valid_meta=args.valid_meta, meta_filters=args.imgtype, start_date=args.start_date, end_date=args.end_date, error_log=error_log, delimiter=args.delimiter, file_type=args.type, coprocess=args.coprocess) ########################################### # Process images ########################################### # Job builder start time job_builder_start_time = time.time() print("Building job list... ", file=sys.stderr) jobs = pcvp.job_builder(meta=meta, valid_meta=args.valid_meta, workflow=args.workflow, job_dir=args.jobdir, out_dir=args.outdir, coprocess=args.coprocess, other_args=args.other_args, writeimg=args.writeimg) # Job builder clock time job_builder_clock_time = time.time() - job_builder_start_time print("took " + str(job_builder_clock_time) + '\n', file=sys.stderr) # Parallel image processing time multi_start_time = time.time() print("Processing images... ", file=sys.stderr) pcvp.multiprocess(jobs, args.cpu) # Parallel clock time multi_clock_time = time.time() - multi_start_time print("took " + str(multi_clock_time) + '\n', file=sys.stderr) ########################################### # Compile image analysis results ########################################### # Process results start time process_results_start_time = time.time() print("Processing results... ", file=sys.stderr) pcvp.process_results(valid_meta=args.valid_meta, job_dir=args.jobdir, json_file=args.json) # Process results clock time process_results_clock_time = time.time() - process_results_start_time print("took " + str(process_results_clock_time) + '\n', file=sys.stderr) ########################################### # Cleanup ########################################### error_log.close()