@@ -37,7 +37,7 @@ def __init__(self,shots=None):
3737
3838 def load_from_files (self ,shot_list_dir ,shot_files ):
3939 shot_numbers ,disruption_times = ShotList .get_multiple_shots_and_disruption_times (shot_list_dir ,shot_files )
40- for number ,t in zip (shot_numbers ,disruption_times ):
40+ for number ,t in list ( zip (shot_numbers ,disruption_times ) ):
4141 self .append (Shot (number = number ,t_disrupt = t ))
4242
4343 ######Generic Methods####
@@ -46,8 +46,8 @@ def load_from_files(self,shot_list_dir,shot_files):
4646 def get_shots_and_disruption_times (shots_and_disruption_times_path ):
4747 data = np .loadtxt (shots_and_disruption_times_path ,ndmin = 1 ,dtype = {'names' :('num' ,'disrupt_times' ),
4848 'formats' :('i4' ,'f4' )})
49- shots = np .array (zip (* data )[0 ])
50- disrupt_times = np .array (zip (* data )[1 ])
49+ shots = np .array (list ( zip (* data ) )[0 ])
50+ disrupt_times = np .array (list ( zip (* data ) )[1 ])
5151 return shots , disrupt_times
5252
5353 @staticmethod
@@ -74,15 +74,15 @@ def split_train_test(self,conf):
7474 use_shots_test = int (round ((1 - train_frac )* use_shots ))
7575 if len (shot_files_test ) == 0 :
7676 shot_list_train ,shot_list_test = train_test_split (self .shots ,train_frac ,shuffle_training )
77- shot_numbers_train = [shot .number for shot in shot_list_train ]
78- shot_numbers_test = [shot .number for shot in shot_list_test ]
77+ shot_numbers_train = [shot .number for shot in shot_list_train ]
78+ shot_numbers_test = [shot .number for shot in shot_list_test ]
7979 #train and test list given
8080 else :
8181 shot_numbers_train ,_ = ShotList .get_multiple_shots_and_disruption_times (shot_list_dir ,shot_files )
8282 shot_numbers_test ,_ = ShotList .get_multiple_shots_and_disruption_times (shot_list_dir ,shot_files_test )
8383
8484
85- print (len (shot_numbers_train ),len (shot_numbers_test ))
85+ print (len (shot_numbers_train ),len (shot_numbers_test ))
8686 shots_train = self .filter_by_number (shot_numbers_train )
8787 shots_test = self .filter_by_number (shot_numbers_test )
8888 return shots_train .random_sublist (use_shots_train ),shots_test .random_sublist (use_shots_test )
0 commit comments