@@ -80,10 +80,11 @@ def fit_curve_bootstr(subjects, n_iterations=10, output_var="similarity"):
8080 for condition in [0 , 1 ]:
8181 participants_results = {"sub" : [], "results" : []}
8282 for sub in subjects :
83- print (f"Fitting curves to bootstrapped data of sub-{ sub } ..." )
83+ print (f"Fitting curves to bootstrapped data of sub-{ sub } ..." , flush = True )
84+ sys .stdout .flush ()
8485 individual_results = []
8586 p_matrix = np .load (f"{ npy_save_path } raw/sub-{ sub } _{ output_var } _{ df_var } _{ condition } .npy" )
86- for i in tqdm (range (p_matrix .shape [0 ])):
87+ for i in tqdm (range (p_matrix .shape [0 ]), file = sys . stdout ): # should be 10000
8788 x_data = p_matrix [i , :, 0 ]
8889 y_data = p_matrix [i , :, 1 ]
8990 best_fit_params , best_r2 , best_rel = run_optimization (x_data , y_data , bounds , n_iterations = n_iterations )
@@ -94,12 +95,15 @@ def fit_curve_bootstr(subjects, n_iterations=10, output_var="similarity"):
9495 with open (f"{ npy_save_path } res_curve/{ output_var } _{ df_var } _{ condition } .pkl" , "wb" ) as tf :
9596 pickle .dump (participants_results , tf )
9697
97- npy_save_path = "/Users/fzaki001/Documents /working-memory-error-dataset/derivatives/face-jitter/behavior/bootstrap/"
98+ npy_save_path = "/home/data/NDClab/datasets /working-memory-error-dataset/derivatives/face-jitter/behavior/bootstrap/"
9899pattern = re .compile (r'sub-(\d+)' )
99100subjects = sorted (list (set ([pattern .search (file ).group (1 ) for file in os .listdir (npy_save_path + "raw/" )])))
100101
102+ import sys
103+ sys .stdout = open ('output.txt' ,'wt' )
104+
101105PROCESSES = mp .cpu_count ()
102106
103107if __name__ == "__main__" :
104108 with Pool (processes = PROCESSES ) as pool :
105- pool .map (fit_curve_bootstr , [subjects ])
109+ pool .map (fit_curve_bootstr , [subjects ])
0 commit comments