1919
2020from physiofit .base .io import IoHandler , StandardDevs , ConfigParser
2121
22+ logger = logging .getLogger (f"physiofit" )
23+
2224def args_parse ():
2325 """
2426 Parse arguments from user input.
@@ -59,18 +61,18 @@ def args_parse():
5961 )
6062
6163 # Parse selective output path arguments (for galaxy implementation mostly)
62- parser .add_argument (
63- "-op" , "--output_pdf" , type = str ,
64- help = "Path to output the pdf file containing plots"
65- )
66- parser .add_argument (
67- "-of" , "--output_fluxes" , type = str ,
68- help = "Path to output the flux results"
69- )
70- parser .add_argument (
71- "-os" , "--output_stats" , type = str ,
72- help = "Path to output the khi² test"
73- )
64+ # parser.add_argument(
65+ # "-op", "--output_pdf", type=str,
66+ # help="Path to output the pdf file containing plots"
67+ # )
68+ # parser.add_argument(
69+ # "-of", "--output_fluxes", type=str,
70+ # help="Path to output the flux results"
71+ # )
72+ # parser.add_argument(
73+ # "-os", "--output_stats", type=str,
74+ # help="Path to output the khi² test"
75+ # )
7476 parser .add_argument (
7577 "-oc" , "--output_config" , type = str ,
7678 help = "Path to output the yaml config file"
@@ -88,11 +90,11 @@ def args_parse():
8890
8991def run (data , args , logger , experiments ):
9092
93+ io = IoHandler ()
9194 for exp in experiments :
92- io = IoHandler ()
9395 exp_data = data .loc [exp , :].sort_values ("time" ).copy ()
9496 logger .info (f"Input Data: \n { exp_data } " )
95- if hasattr ( args , ' galaxy' ) :
97+ if args . galaxy :
9698 io .wkdir = Path ('.' )
9799 else :
98100 io .wkdir = Path (args .data ).parent
@@ -129,10 +131,7 @@ def run(data, args, logger, experiments):
129131 if not io .multiple_experiments :
130132 io .multiple_experiments = []
131133 io .multiple_experiments .append (df )
132- if exp is not None :
133- res_path = io .wkdir / (io .wkdir .name + "_res" ) / exp
134- else :
135- res_path = io .wkdir / (io .wkdir .name + "_res" )
134+ res_path = io .wkdir / (io .wkdir .name + "_res" ) / exp
136135 logger .info (res_path )
137136 if not res_path .is_dir ():
138137 res_path .mkdir (parents = True )
@@ -149,13 +148,17 @@ def run(data, args, logger, experiments):
149148 # for line in dir.rglob("*"):
150149 # print(line)
151150 generate_zips (str (dir ), args .output_zip , logger )
151+ logger .debug (f"Dataframes to concatenate:\n { io .multiple_experiments } " )
152152
153153 # shutil.make_archive(
154154 # args.output_zip,
155155 # format='zip',
156156 # root_dir=str(io.home_path / (io.home_path.name + "_res"))
157157 # )
158- io .output_recap (export_path = args .output_recap , galaxy = True )
158+ if args .galaxy :
159+ io .output_recap (export_path = args .output_recap , galaxy = args .galaxy )
160+ else :
161+ io .output_recap (export_path = str (res_path .parent ), galaxy = False )
159162
160163def generate_zips (path_to_data_folder , output_path , logger ):
161164 """Generate output zip file containing results
@@ -221,16 +224,15 @@ def generate_config(args, data, logger):
221224
222225def process (args ):
223226
224- logger = logging .getLogger ()
225- logger .setLevel (logging .DEBUG )
226- out_stream = logging .StreamHandler ()
227- formatter = logging .Formatter ()
228- out_stream .setFormatter (formatter )
227+ cli_handle = logging .StreamHandler ()
228+ formatter = logging .Formatter ('%(asctime)s - %(name)s - %(levelname)s - %(message)s' )
229+ cli_handle .setFormatter (formatter )
229230 if args .debug_mode :
230- out_stream .setLevel (logging .DEBUG )
231+ cli_handle .setLevel (logging .DEBUG )
231232 else :
232- out_stream .setLevel (logging .INFO )
233- logger .addHandler (out_stream )
233+ cli_handle .setLevel (logging .INFO )
234+ logger .addHandler (cli_handle )
235+
234236
235237 if args .list :
236238 IoHandler .get_model_list ()
0 commit comments