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"