From 23587b775ef6a78fcf95559b6759aec0fd3e3013 Mon Sep 17 00:00:00 2001 From: "konstantin.bosbach" Date: Fri, 26 Mar 2021 10:40:53 +0100 Subject: [PATCH] Reintroduced option to shortage calculations --- fsl_mrs_mce/mc_gen.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fsl_mrs_mce/mc_gen.py b/fsl_mrs_mce/mc_gen.py index 3207e24..fd96324 100644 --- a/fsl_mrs_mce/mc_gen.py +++ b/fsl_mrs_mce/mc_gen.py @@ -97,7 +97,8 @@ def synth_and_ana(noise_cov, def mc( n, noise_sd, df_parameter_synth, basis_path, output_path, - fit_parameters=[], fit_snr=[], fit_sdnoise=[], fit_varnoise=[] + fit_parameters=[], fit_snr=[], fit_sdnoise=[], fit_varnoise=[], + shortage=False ): """Function for calling synth_and_ana repeatedly, as in Monte-Carlo approach""" @@ -109,6 +110,14 @@ def mc( str(round(noise_sd, 3)) + "_runs_"+str(n) + ".csv" ) + if shortage: + try: + noise_fit = pd.read_csv(file_out_path) + print("Found existing file: ", file_out_path) + return noise_fit, file_out_path + except: + None + print( "Starting noise_sd", round(noise_sd, 2), " with ", round(n, 2), "repetitions"