Best Python code snippet using localstack_python
db_access.py
Source:db_access.py
...13class FlyDB(dict):14 def __init__(self,root_dir):15 dict.__init__(self)16 self.root_dir = root_dir17 def create_group(self,flynum):18 self[flynum] = h5py.File(self.root_dir+'Fly%04d'%(int(flynum))+'/fly_record.hdf5','w')19 def close(self):20 for key in self.keys():21 self[key].close()22 print self[key]23 def flush(self):24 for key in self.keys():25 self[key].flush()26def main():27 import cPickle28 fn = 'fly_db_init.cpkl'29 f = open(fn,'wb')30 cPickle.dump(fly_db,f)31 f.close()32def get_db():33 #fly_db = h5py.File('/Volumes/FlyDataB/FlyDB/flydb.hdf5','a')34 flydirs = filter(lambda s:'Fly' in s,os.listdir(root_dir))35 initialized_flies = filter(lambda s:'fly_record.hdf5' in os.listdir(root_dir+'/'+s),flydirs)36 fly_db = FlyDB(root_dir)37 for fly in initialized_flies:38 flynum = int(fly.split('Fly')[1])39 #print flynum40 fly_db[flynum] = h5py.File(root_dir+fly+'/fly_record.hdf5','a')41 return fly_db42starfield_pattern_names_6_0_2014 = ['equator_000.mat',43 'equator_030.mat',44 'equator_060.mat',45 'equator_090.mat',46 'equator_120.mat',47 'equator_150.mat',48 'equator_180.mat',49 'equator_210.mat',50 'equator_240.mat',51 'equator_270.mat',52 'equator_300.mat',53 'equator_330.mat',54 'coromeridian_030.mat',55 'coromeridian_060.mat',56 'coromeridian_090.mat',57 'coromeridian_120.mat',58 'coromeridian_150.mat',59 'coromeridian_210.mat',60 'coromeridian_240.mat',61 'coromeridian_270.mat',62 'coromeridian_300.mat',63 'coromeridian_330.mat',64 'sagimeridian_030.mat',65 'sagimeridian_060.mat',66 'sagimeridian_120.mat',67 'sagimeridian_150.mat',68 'sagimeridian_210.mat',69 'sagimeridian_240.mat',70 'sagimeridian_300.mat',71 'sagimeridian_330.mat']72starfield_pattern_names_6_29_2014 = ['translate_forward.mat',73 'translate_backward.mat',74 'translate_up.mat',75 'translate_down.mat',76 'spin_equator_000.mat',77 'spin_equator_030.mat',78 'spin_equator_060.mat',79 'spin_equator_090.mat',80 'spin_equator_120.mat',81 'spin_equator_150.mat',82 'spin_equator_180.mat',83 'spin_equator_210.mat',84 'spin_equator_240.mat',85 'spin_equator_270.mat',86 'spin_equator_300.mat',87 'spin_equator_330.mat']88l = [[x,x,x] for x in starfield_pattern_names_6_29_2014]89starfield_pattern_names_6_29_2014 = [item for sublist in l for item in sublist]90class FlySwitch(dict):91 def __getitem__(self,flynum):92 return self.__getattribute__('initfly_'+str(flynum))(flynum)93class InitDB(FlySwitch):94 #fly_db = h5py.File("/Volumes/FlyDataB/FlyDB/flydb.hdf5", "w")95 def __init__(self):96 self.fly_db = FlyDB(root_dir)97 def init_all(self):98 import inspect99 initfuncts = filter(lambda t:'initfly' in t[0],inspect.getmembers(self))100 flynums = [int(x[0].split('initfly_')[1]) for x in initfuncts]101 #############################################################################################fly_record = dict()102 def initfly_111(self,flynum):103 fly_db = self.fly_db104 fly_db.create_group(flynum)105 fly_record =fly_db[flynum]106 fly_record['flynum'] = flynum107 fly_record.create_group('experiments')108 fly_record['experiments'].create_group('lr_blob_expansion')109 fly_record['experiments']['lr_blob_expansion']['photron_seq_nums'] = [1,2,3,4,5,6]110 fly_record['experiments']['lr_blob_expansion']['axon_file_names'] = ['fly01_lr_blob_expansion_14401000.abf']111 fly_record['experiments']['lr_blob_expansion']['photron_date_string'] = ['20140401']112 fly_record['experiments']['lr_blob_expansion']['kine_filename'] = ['WBkin.mat']113 fly_record['experiments']['lr_blob_expansion']['solution_format_string'] = ['20140401_S%04d/']114 fly_record['experiments']['lr_blob_expansion']['photron_frame_rate_Hz'] = 6000115 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_volts'] = np.linspace(1,10,12)116 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_vals'] = np.concatenate(([np.nan],np.arange(0,12)*30))117 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_ID'] = 'b1'118 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_side'] = 'l'119 fly_record['experiments']['lr_blob_expansion'].create_group('sequences')120 #############################################################################################121 def initfly_112(self,flynum):122 fly_db = self.fly_db123 fly_db.create_group(flynum)124 fly_record =fly_db[flynum]125 fly_record['flynum'] = flynum126 fly_record.create_group('experiments')127 fly_record['experiments'].create_group('lr_blob_expansion')128 fly_record['experiments']['lr_blob_expansion']['photron_seq_nums'] = [7,8,9,10,11,12]129 fly_record['experiments']['lr_blob_expansion']['axon_file_names'] = ['fly02_lr_blob_expansion_14401002.abf']130 fly_record['experiments']['lr_blob_expansion']['photron_date_string'] = ['20140401']131 fly_record['experiments']['lr_blob_expansion']['kine_filename'] = ['WBkin.mat']132 fly_record['experiments']['lr_blob_expansion']['solution_format_string'] = ['20140401_S%04d/']133 fly_record['experiments']['lr_blob_expansion']['photron_frame_rate_Hz'] = 6000134 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_volts'] = np.linspace(1,10,12)135 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_vals'] = np.concatenate(([np.nan],np.arange(0,12)*30))136 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_ID'] = 'b1'137 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_side'] = 'l'138 fly_record['experiments']['lr_blob_expansion'].create_group('sequences')139 #############################################################################################140 def initfly_114(self,flynum):141 fly_db = self.fly_db142 fly_db.create_group(flynum)143 fly_record =fly_db[flynum]144 fly_record['flynum'] = flynum145 fly_record.create_group('experiments')146 fly_record['experiments'].create_group('lr_blob_expansion')147 fly_record['experiments']['lr_blob_expansion']['photron_seq_nums'] = [13,14,15,16,17,18]148 fly_record['experiments']['lr_blob_expansion']['axon_file_names'] = ['fly04_lr_blob_expansion_14401012.abf']149 fly_record['experiments']['lr_blob_expansion']['photron_date_string'] = ['20140401']150 fly_record['experiments']['lr_blob_expansion']['kine_filename'] = ['WBkin.mat']151 fly_record['experiments']['lr_blob_expansion']['solution_format_string'] = ['20140401_S%04d/']152 fly_record['experiments']['lr_blob_expansion']['photron_frame_rate_Hz'] = 6000153 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_volts'] = np.linspace(1,10,12)154 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_vals'] = np.concatenate(([np.nan],np.arange(0,12)*30))155 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_ID'] = 'b1'156 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_side'] = 'l'157 fly_record['experiments']['lr_blob_expansion'].create_group('sequences')158 #############################################################################################159 def initfly_115(self,flynum):160 fly_db = self.fly_db161 fly_db.create_group(flynum)162 fly_record =fly_db[flynum]163 fly_record['flynum'] = flynum164 fly_record.create_group('experiments')165 fly_record['experiments'].create_group('lr_blob_expansion')166 fly_record['experiments']['lr_blob_expansion']['photron_seq_nums'] = [1,2,3,4,5,6]167 fly_record['experiments']['lr_blob_expansion']['axon_file_names'] = ['fly01_lr_blob_expansion_14402001.abf']168 fly_record['experiments']['lr_blob_expansion']['photron_date_string'] = ['20140402']169 fly_record['experiments']['lr_blob_expansion']['kine_filename'] = ['WBkin.mat']170 fly_record['experiments']['lr_blob_expansion']['solution_format_string'] = ['20140402_S%04d/']171 fly_record['experiments']['lr_blob_expansion']['photron_frame_rate_Hz'] = 6000172 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_volts'] = np.linspace(1,10,12)173 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_vals'] = np.concatenate(([np.nan],np.arange(0,12)*30))174 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_ID'] = 'b1'175 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_side'] = 'l'176 fly_record['experiments']['lr_blob_expansion'].create_group('sequences')177 #############################################################################################178 def initfly_116(self,flynum):179 fly_db = self.fly_db180 fly_db.create_group(flynum)181 fly_record =fly_db[flynum]182 fly_record['flynum'] = flynum183 fly_record.create_group('experiments')184 fly_record['experiments'].create_group('lr_blob_expansion')185 fly_record['experiments']['lr_blob_expansion']['photron_seq_nums'] = [1,2,3,4,5,6]186 fly_record['experiments']['lr_blob_expansion']['axon_file_names'] = ['fly01_lr_blob_expansion_14410000.abf']187 fly_record['experiments']['lr_blob_expansion']['photron_date_string'] = ['20140410']188 fly_record['experiments']['lr_blob_expansion']['kine_filename'] = ['WBkin.mat']189 fly_record['experiments']['lr_blob_expansion']['solution_format_string'] = ['20140410_S%04d/']190 fly_record['experiments']['lr_blob_expansion']['photron_frame_rate_Hz'] = 6000191 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_volts'] = np.linspace(1,10,12)192 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_vals'] = np.concatenate(([np.nan],np.arange(0,12)*30))193 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_ID'] = 'b1'194 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_side'] = 'l'195 fly_record['experiments']['lr_blob_expansion'].create_group('sequences')196 #############################################################################################197 def initfly_117(self,flynum):198 fly_db = self.fly_db199 fly_db.create_group(flynum)200 fly_record =fly_db[flynum]201 fly_record['flynum'] = flynum202 fly_record.create_group('experiments')203 fly_record['experiments'].create_group('lr_blob_expansion')204 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')205 fly_record['experiments']['lr_blob_expansion']['photron_seq_nums'] = [7,8,9,10,11,12]206 fly_record['experiments']['lr_blob_expansion']['axon_file_names'] = ['fly02_lr_blob_expansion_14410002.abf']207 fly_record['experiments']['lr_blob_expansion']['photron_date_string'] = ['20140410']208 fly_record['experiments']['lr_blob_expansion']['kine_filename'] = ['WBkin.mat']209 fly_record['experiments']['lr_blob_expansion']['solution_format_string'] = ['20140410_S%04d/']210 fly_record['experiments']['lr_blob_expansion']['photron_frame_rate_Hz'] = 6000211 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_volts'] = np.linspace(1,10,12)212 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_vals'] = np.concatenate(([np.nan],np.arange(0,12)*30))213 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_ID'] = 'b1'214 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_side'] = 'l'215 fly_record['experiments']['lr_blob_expansion'].create_group('sequences')216 #############################################################################################217 def initfly_118(self,flynum):218 fly_db = self.fly_db219 fly_db.create_group(flynum)220 fly_record =fly_db[flynum]221 fly_record['flynum'] = flynum222 fly_record.create_group('experiments')223 fly_record['experiments'].create_group('lr_blob_expansion')224 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')225 fly_record['experiments']['lr_blob_expansion']['photron_seq_nums'] = [13,14,15,16,17]226 fly_record['experiments']['lr_blob_expansion']['axon_file_names'] = ['fly03_lr_blob_expansion_14410003.abf']227 fly_record['experiments']['lr_blob_expansion']['photron_date_string'] = ['20140410']228 fly_record['experiments']['lr_blob_expansion']['kine_filename'] = ['WBkin.mat']229 fly_record['experiments']['lr_blob_expansion']['solution_format_string'] = ['20140410_S%04d/']230 fly_record['experiments']['lr_blob_expansion']['photron_frame_rate_Hz'] = 6000231 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_volts'] = np.linspace(1,10,12)232 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_vals'] = np.concatenate(([np.nan],np.arange(0,12)*30))233 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_ID'] = 'b1'234 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_side'] = 'l'235 fly_record['experiments']['lr_blob_expansion'].create_group('sequences')236 #############################################################################################237 def initfly_122(self,flynum):238 fly_db = self.fly_db239 fly_db.create_group(flynum)240 fly_record =fly_db[flynum]241 fly_record['flynum'] = flynum242 fly_record.create_group('experiments')243 fly_record['experiments'].create_group('lr_blob_expansion')244 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')245 fly_record['experiments']['lr_blob_expansion']['photron_seq_nums'] = [1,2,3,4,5,6]246 fly_record['experiments']['lr_blob_expansion']['axon_file_names'] = ['fly01_lr_blob_expansion_14428000.abf']247 fly_record['experiments']['lr_blob_expansion']['photron_date_string'] = ['20140428']248 fly_record['experiments']['lr_blob_expansion']['kine_filename'] = ['WBkin.mat']249 fly_record['experiments']['lr_blob_expansion']['solution_format_string'] = ['20140428_S%04d/']250 fly_record['experiments']['lr_blob_expansion']['photron_frame_rate_Hz'] = 6000251 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_volts'] = np.linspace(1,10,12)252 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_vals'] = np.concatenate(([np.nan],np.arange(0,12)*30))253 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_ID'] = 'b1'254 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_side'] = 'r'255 fly_record['experiments']['lr_blob_expansion'].create_group('sequences')256 #############################################################################################257 def initfly_123(self,flynum):258 fly_db = self.fly_db259 fly_db.create_group(flynum)260 fly_record =fly_db[flynum]261 fly_record['flynum'] = flynum262 fly_record.create_group('experiments')263 fly_record['experiments'].create_group('lr_blob_expansion')264 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')265 fly_record['experiments']['lr_blob_expansion']['photron_seq_nums'] = [7,8,9,10,11]266 fly_record['experiments']['lr_blob_expansion']['axon_file_names'] = ['fly02_lr_blob_expansion_14428001.abf']267 fly_record['experiments']['lr_blob_expansion']['photron_date_string'] = ['20140428']268 fly_record['experiments']['lr_blob_expansion']['kine_filename'] = ['WBkin.mat']269 fly_record['experiments']['lr_blob_expansion']['solution_format_string'] = ['20140428_S%04d/']270 fly_record['experiments']['lr_blob_expansion']['photron_frame_rate_Hz'] = 6000271 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_volts'] = np.linspace(1,10,12)272 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_vals'] = np.concatenate(([np.nan],np.arange(0,12)*30))273 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_ID'] = 'b1'274 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_side'] = 'r'275 fly_record['experiments']['lr_blob_expansion'].create_group('sequences')276 #############################################################################################277 def initfly_124(self,flynum):278 fly_db = self.fly_db279 fly_db.create_group(flynum)280 fly_record =fly_db[flynum]281 fly_record['flynum'] = flynum282 fly_record.create_group('experiments')283 fly_record['experiments'].create_group('lr_blob_expansion')284 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')285 fly_record['experiments']['lr_blob_expansion']['photron_seq_nums'] = [2,3,4,5,6]286 fly_record['experiments']['lr_blob_expansion']['axon_file_names'] = ['fly01_lr_blob_expansion_14429001.abf']287 fly_record['experiments']['lr_blob_expansion']['photron_date_string'] = ['20140429']288 fly_record['experiments']['lr_blob_expansion']['kine_filename'] = ['WBkin.mat']289 fly_record['experiments']['lr_blob_expansion']['solution_format_string'] = ['20140429_S%04d/']290 fly_record['experiments']['lr_blob_expansion']['photron_frame_rate_Hz'] = 6000291 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_volts'] = np.linspace(1,10,12)292 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_vals'] = np.concatenate(([np.nan],np.arange(0,12)*30))293 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_ID'] = 'b1'294 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_side'] = 'r'295 fly_record['experiments']['lr_blob_expansion'].create_group('sequences')296 #############################################################################################297 def initfly_125(self,flynum):298 fly_db = self.fly_db299 fly_db.create_group(flynum)300 fly_record =fly_db[flynum]301 fly_record['flynum'] = flynum302 fly_record.create_group('experiments')303 fly_record['experiments'].create_group('lr_blob_expansion')304 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')305 fly_record['experiments']['lr_blob_expansion']['photron_seq_nums'] = [7,8,9,10,11,12]306 fly_record['experiments']['lr_blob_expansion']['axon_file_names'] = ['fly02_lr_blob_expansion_14429004.abf']307 fly_record['experiments']['lr_blob_expansion']['photron_date_string'] = ['20140429']308 fly_record['experiments']['lr_blob_expansion']['kine_filename'] = ['WBkin.mat']309 fly_record['experiments']['lr_blob_expansion']['solution_format_string'] = ['20140429_S%04d/']310 fly_record['experiments']['lr_blob_expansion']['photron_frame_rate_Hz'] = 6000311 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_volts'] = np.linspace(1,10,12)312 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_vals'] = np.concatenate(([np.nan],np.arange(0,12)*30))313 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_ID'] = 'b1'314 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_side'] = 'r'315 fly_record['experiments']['lr_blob_expansion'].create_group('sequences')316 def initfly_130(self,flynum):317 fly_db = self.fly_db318 fly_db.create_group(flynum)319 fly_record =fly_db[flynum]320 fly_record['flynum'] = flynum321 fly_record.create_group('experiments')322 fly_record['experiments'].create_group('lr_blob_expansion')323 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')324 fly_record['experiments']['lr_blob_expansion']['photron_seq_nums'] = [1,2,3,4,5,6]325 fly_record['experiments']['lr_blob_expansion']['axon_file_names'] = ['fly01_lr_blob_expansion_14506005.abf']326 fly_record['experiments']['lr_blob_expansion']['photron_date_string'] = ['20140506']327 fly_record['experiments']['lr_blob_expansion']['kine_filename'] = ['WBkin.mat']328 fly_record['experiments']['lr_blob_expansion']['solution_format_string'] = ['20140506_S%04d/']329 fly_record['experiments']['lr_blob_expansion']['photron_frame_rate_Hz'] = 6000330 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_volts'] = np.linspace(1,10,12)331 fly_record['experiments']['lr_blob_expansion']['Ypos_trial_vals'] = np.concatenate(([np.nan],np.arange(0,12)*30))332 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_ID'] = 'i1'333 fly_record['experiments']['lr_blob_expansion']['AMsysCh1_side'] = 'r'334 fly_record['experiments']['lr_blob_expansion'].create_group('sequences')335 def initfly_151(self,flynum):336 fly_db = self.fly_db337 fly_db.create_group(flynum)338 fly_record =fly_db[flynum]339 fly_record['flynum'] = flynum340 fly_record.create_group('experiments')341 fly_record['experiments'].create_group('img_starfield_t2_rep1')342 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')343 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0151_rotating_starfield_imaging_T2_trial_1_14529002.abf']344 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/trial1/trial1_MMStack.ome.tif']345 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014346 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70347 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5348 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')349 def initfly_153(self,flynum):350 fly_db = self.fly_db351 fly_db.create_group(flynum)352 fly_record =fly_db[flynum]353 fly_record['flynum'] = flynum354 fly_record.create_group('experiments')355 fly_record['experiments'].create_group('img_starfield_t2_rep1')356 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')357 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0153_rotating_starfield_imaging_T2_trial_1_14530005.abf']358 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']359 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014360 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70361 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5362 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')363 def initfly_154(self,flynum):364 fly_db = self.fly_db365 fly_db.create_group(flynum)366 fly_record =fly_db[flynum]367 fly_record['flynum'] = flynum368 fly_record.create_group('experiments')369 fly_record['experiments'].create_group('img_starfield_t2_rep1')370 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')371 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0154_rotating_starfield_imaging_T2_trial_1_14530007.abf']372 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']373 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014374 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70375 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5376 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')377 def initfly_155(self,flynum):378 fly_db = self.fly_db379 fly_db.create_group(flynum)380 fly_record =fly_db[flynum]381 fly_record['flynum'] = flynum382 fly_record.create_group('experiments')383 fly_record['experiments'].create_group('img_starfield_t2_rep1')384 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')385 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0155_rotating_starfield_imaging_T2_trial_1_14530009.abf']386 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']387 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014388 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70389 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5390 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')391 def initfly_156(self,flynum):392 fly_db = self.fly_db393 fly_db.create_group(flynum)394 fly_record =fly_db[flynum]395 fly_record['flynum'] = flynum396 fly_record.create_group('experiments')397 fly_record['experiments'].create_group('img_starfield_t2_rep1')398 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')399 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0156_rotating_starfield_imaging_T2_trial_1_14530011.abf']400 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']401 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014402 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70403 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5404 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')405 def initfly_157(self,flynum):406 fly_db = self.fly_db407 fly_db.create_group(flynum)408 fly_record =fly_db[flynum]409 fly_record['flynum'] = flynum410 fly_record.create_group('experiments')411 fly_record['experiments'].create_group('img_starfield_t2_rep1')412 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')413 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0157_rotating_starfield_imaging_T2_trial_1_14602000.abf']414 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']415 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014416 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70417 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5418 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')419 def initfly_158(self,flynum):420 fly_db = self.fly_db421 fly_db.create_group(flynum)422 fly_record =fly_db[flynum]423 fly_record['flynum'] = flynum424 fly_record.create_group('experiments')425 fly_record['experiments'].create_group('img_starfield_t2_rep1')426 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')427 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0158_rotating_starfield_imaging_T2_trial_1_14602002.abf']428 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']429 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014430 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70431 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5432 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')433 def initfly_159(self,flynum):434 fly_db = self.fly_db435 fly_db.create_group(flynum)436 fly_record =fly_db[flynum]437 fly_record['flynum'] = flynum438 fly_record.create_group('experiments')439 fly_record['experiments'].create_group('img_starfield_t2_rep1')440 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')441 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0159_rotating_starfield_imaging_T2_trial_1_14602004.abf']442 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']443 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014444 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70445 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5446 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')447 def initfly_160(self,flynum):448 fly_db = self.fly_db449 fly_db.create_group(flynum)450 fly_record =fly_db[flynum]451 fly_record['flynum'] = flynum452 fly_record.create_group('experiments')453 fly_record['experiments'].create_group('img_starfield_t2_rep1')454 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')455 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0160_rotating_starfield_imaging_T2_trial_1_14602007.abf']456 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']457 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014458 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70459 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5460 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')461 def initfly_161(self,flynum):462 fly_db = self.fly_db463 fly_db.create_group(flynum)464 fly_record =fly_db[flynum]465 fly_record['flynum'] = flynum466 fly_record.create_group('experiments')467 fly_record['experiments'].create_group('img_starfield_t2_rep1')468 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')469 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0161_rotating_starfield_imaging_T2_trial_1_14603000.abf']470 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']471 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014472 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70473 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5474 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')475 def initfly_162(self,flynum):476 fly_db = self.fly_db477 fly_db.create_group(flynum)478 fly_record =fly_db[flynum]479 fly_record['flynum'] = flynum480 fly_record.create_group('experiments')481 fly_record['experiments'].create_group('img_starfield_t2_rep1')482 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')483 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0162_rotating_starfield_imaging_T2_trial_1_14603003.abf']484 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']485 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014486 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70487 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5488 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')489 def initfly_163(self,flynum):490 fly_db = self.fly_db491 fly_db.create_group(flynum)492 fly_record =fly_db[flynum]493 fly_record['flynum'] = flynum494 fly_record.create_group('experiments')495 fly_record['experiments'].create_group('img_starfield_t2_rep1')496 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')497 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0163_rotating_starfield_imaging_T2_trial_1_14603009.abf']498 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']499 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014500 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70501 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5502 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')503 def initfly_164(self,flynum):504 fly_db = self.fly_db505 fly_db.create_group(flynum)506 fly_record =fly_db[flynum]507 fly_record['flynum'] = flynum508 fly_record.create_group('experiments')509 fly_record['experiments'].create_group('img_starfield_t2_rep1')510 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')511 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0164_rotating_starfield_imaging_T2_trial_1_14603012.abf']512 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']513 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014514 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70515 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5516 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')517 def initfly_165(self,flynum):518 fly_db = self.fly_db519 fly_db.create_group(flynum)520 fly_record =fly_db[flynum]521 fly_record['flynum'] = flynum522 fly_record.create_group('experiments')523 fly_record['experiments'].create_group('img_starfield_t2_rep1')524 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')525 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0165_rotating_starfield_imaging_T2_trial_1_14603017.abf']526 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']527 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014528 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70529 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5530 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')531 def initfly_166(self,flynum):532 fly_db = self.fly_db533 fly_db.create_group(flynum)534 fly_record =fly_db[flynum]535 fly_record['flynum'] = flynum536 fly_record.create_group('experiments')537 fly_record['experiments'].create_group('img_starfield_t2_rep1')538 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')539 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0166_rotating_starfield_imaging_T2_trial_1_14605000.abf']540 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']541 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014542 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70543 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5544 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')545 def initfly_167(self,flynum):546 fly_db = self.fly_db547 fly_db.create_group(flynum)548 fly_record =fly_db[flynum]549 fly_record['flynum'] = flynum550 fly_record.create_group('experiments')551 fly_record['experiments'].create_group('img_starfield_t2_rep1')552 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')553 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0167_rotating_starfield_imaging_T2_trial_1_14605001.abf']554 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']555 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014556 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70557 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5558 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')559 def initfly_168(self,flynum):560 fly_db = self.fly_db561 fly_db.create_group(flynum)562 fly_record =fly_db[flynum]563 fly_record['flynum'] = flynum564 fly_record.create_group('experiments')565 fly_record['experiments'].create_group('img_starfield_t2_rep1')566 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')567 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0168_rotating_starfield_imaging_T2_trial_1_14605002.abf']568 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']569 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014570 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70571 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5572 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')573 def initfly_169(self,flynum):574 fly_db = self.fly_db575 fly_db.create_group(flynum)576 fly_record =fly_db[flynum]577 fly_record['flynum'] = flynum578 fly_record.create_group('experiments')579 fly_record['experiments'].create_group('img_starfield_t2_rep1')580 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')581 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0169_rotating_starfield_imaging_T2_trial_1_14605004.abf']582 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']583 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014584 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70585 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5586 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')587 #######588 #######589 #######590 def initfly_170(self,flynum):591 fly_db = self.fly_db592 fly_db.create_group(flynum)593 fly_record =fly_db[flynum]594 fly_record['flynum'] = flynum595 fly_record.create_group('experiments')596 fly_record['experiments'].create_group('img_starfield_t2_rep1')597 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')598 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0170_rotating_starfield_imaging_T2_trial_1_14605004.abf']599 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']600 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014601 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70602 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5603 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')604 def initfly_171(self,flynum):605 fly_db = self.fly_db606 fly_db.create_group(flynum)607 fly_record =fly_db[flynum]608 fly_record['flynum'] = flynum609 fly_record.create_group('experiments')610 fly_record['experiments'].create_group('img_starfield_t2_rep1')611 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')612 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0171_rotating_starfield_imaging_T2_trial_1_14605004.abf']613 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']614 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014615 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70616 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5617 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')618 def initfly_172(self,flynum):619 fly_db = self.fly_db620 fly_db.create_group(flynum)621 fly_record =fly_db[flynum]622 fly_record['flynum'] = flynum623 fly_record.create_group('experiments')624 fly_record['experiments'].create_group('img_starfield_t2_rep1')625 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')626 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0172_rotating_starfield_imaging_T2_trial_1_14605004.abf']627 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']628 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014629 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70630 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5631 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')632 def initfly_173(self,flynum):633 fly_db = self.fly_db634 fly_db.create_group(flynum)635 fly_record =fly_db[flynum]636 fly_record['flynum'] = flynum637 fly_record.create_group('experiments')638 fly_record['experiments'].create_group('img_starfield_t2_rep1')639 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')640 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0173_rotating_starfield_imaging_T2_trial_1_14605004.abf']641 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']642 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014643 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70644 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5645 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')646 def initfly_174(self,flynum):647 fly_db = self.fly_db648 fly_db.create_group(flynum)649 fly_record =fly_db[flynum]650 fly_record['flynum'] = flynum651 fly_record.create_group('experiments')652 fly_record['experiments'].create_group('img_starfield_t2_rep1')653 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')654 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0174_rotating_starfield_imaging_T2_trial_1_14605004.abf']655 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']656 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014657 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70658 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5659 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')660 def initfly_175(self,flynum):661 fly_db = self.fly_db662 fly_db.create_group(flynum)663 fly_record =fly_db[flynum]664 fly_record['flynum'] = flynum665 fly_record.create_group('experiments')666 fly_record['experiments'].create_group('img_starfield_t2_rep1')667 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')668 fly_record['experiments']['img_starfield_t2_rep1']['axon_file_names'] = ['fly0175_rotating_starfield_imaging_T2_trial_1_14605004.abf']669 fly_record['experiments']['img_starfield_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']670 fly_record['experiments']['img_starfield_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_0_2014671 fly_record['experiments']['img_starfield_t2_rep1']['imaging_frame_rate_guess'] = 70672 fly_record['experiments']['img_starfield_t2_rep1']['ol_epoch_duration'] = 4.5673 fly_record['experiments']['img_starfield_t2_rep1'].create_group('sequences')674 def initfly_176(self,flynum):675 fly_db = self.fly_db676 fly_db.create_group(flynum)677 fly_record =fly_db[flynum]678 fly_record['flynum'] = flynum679 fly_record.create_group('experiments')680 fly_record['experiments'].create_group('img_starfields2_t2_rep1')681 fly_record['experiments']['img_starfields2_t2_rep1']['axon_file_names'] = ['T2_trial1_14630005.abf']682 fly_record['experiments']['img_starfields2_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']683 fly_record['experiments']['img_starfields2_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_29_2014684 fly_record['experiments']['img_starfields2_t2_rep1']['imaging_frame_rate_guess'] = 70685 fly_record['experiments']['img_starfields2_t2_rep1']['ol_epoch_duration'] = 3.5686 fly_record['experiments']['img_starfields2_t2_rep1'].create_group('sequences')687 fly_record['experiments'].create_group('img_starfields2_t2_rep2')688 fly_record['experiments']['img_starfields2_t2_rep2']['axon_file_names'] = ['T2_trial2_14630008.abf']689 fly_record['experiments']['img_starfields2_t2_rep2']['tiff_file_names'] = ['/T2_trial2/T2_trial2_MMStack.ome.tif']690 fly_record['experiments']['img_starfields2_t2_rep2']['sequence_pattern_names'] = starfield_pattern_names_6_29_2014691 fly_record['experiments']['img_starfields2_t2_rep2']['imaging_frame_rate_guess'] = 70692 fly_record['experiments']['img_starfields2_t2_rep2']['ol_epoch_duration'] = 3.5693 fly_record['experiments']['img_starfields2_t2_rep2'].create_group('sequences')694 def initfly_177(self,flynum):695 fly_db = self.fly_db696 fly_db.create_group(flynum)697 fly_record =fly_db[flynum]698 fly_record['flynum'] = flynum699 fly_record.create_group('experiments')700 fly_record['experiments'].create_group('img_starfields2_t2_rep1')701 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')702 fly_record['experiments']['img_starfields2_t2_rep1']['axon_file_names'] = ['T2_trial1_14630009.abf']703 fly_record['experiments']['img_starfields2_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']704 fly_record['experiments']['img_starfields2_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_29_2014705 fly_record['experiments']['img_starfields2_t2_rep1']['imaging_frame_rate_guess'] = 70706 fly_record['experiments']['img_starfields2_t2_rep1']['ol_epoch_duration'] = 3.5707 fly_record['experiments']['img_starfields2_t2_rep1'].create_group('sequences')708 fly_record['experiments'].create_group('img_starfields2_t2_rep2')709 fly_record['experiments']['img_starfields2_t2_rep2']['axon_file_names'] = ['T2_trial2_14630010.abf']710 fly_record['experiments']['img_starfields2_t2_rep2']['tiff_file_names'] = ['/T2_trial2/T2_trial2_MMStack.ome.tif']711 fly_record['experiments']['img_starfields2_t2_rep2']['sequence_pattern_names'] = starfield_pattern_names_6_29_2014712 fly_record['experiments']['img_starfields2_t2_rep2']['imaging_frame_rate_guess'] = 70713 fly_record['experiments']['img_starfields2_t2_rep2']['ol_epoch_duration'] = 3.5714 fly_record['experiments']['img_starfields2_t2_rep2'].create_group('sequences')715 def initfly_178(self,flynum):716 fly_db = self.fly_db717 fly_db.create_group(flynum)718 fly_record =fly_db[flynum]719 fly_record['flynum'] = flynum720 fly_record.create_group('experiments')721 fly_record['experiments'].create_group('img_starfields2_t2_rep1')722 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')723 fly_record['experiments']['img_starfields2_t2_rep1']['axon_file_names'] = ['T2_trial1_14630014.abf']724 fly_record['experiments']['img_starfields2_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']725 fly_record['experiments']['img_starfields2_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_29_2014726 fly_record['experiments']['img_starfields2_t2_rep1']['imaging_frame_rate_guess'] = 70727 fly_record['experiments']['img_starfields2_t2_rep1']['ol_epoch_duration'] = 3.5728 fly_record['experiments']['img_starfields2_t2_rep1'].create_group('sequences')729 fly_record['experiments'].create_group('img_starfields2_t2_rep2')730 fly_record['experiments']['img_starfields2_t2_rep2']['axon_file_names'] = ['T2_trial2_14630016.abf']731 fly_record['experiments']['img_starfields2_t2_rep2']['tiff_file_names'] = ['/T2_trial2/T2_trial2_MMStack.ome.tif']732 fly_record['experiments']['img_starfields2_t2_rep2']['sequence_pattern_names'] = starfield_pattern_names_6_29_2014733 fly_record['experiments']['img_starfields2_t2_rep2']['imaging_frame_rate_guess'] = 70734 fly_record['experiments']['img_starfields2_t2_rep2']['ol_epoch_duration'] = 3.5735 fly_record['experiments']['img_starfields2_t2_rep2'].create_group('sequences')736 def initfly_179(self,flynum):737 fly_db = self.fly_db738 fly_db.create_group(flynum)739 fly_record =fly_db[flynum]740 fly_record['flynum'] = flynum741 fly_record.create_group('experiments')742 fly_record['experiments'].create_group('img_starfields2_t2_rep1')743 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')744 fly_record['experiments']['img_starfields2_t2_rep1']['axon_file_names'] = ['T2_trial1_14701000.abf']745 fly_record['experiments']['img_starfields2_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']746 fly_record['experiments']['img_starfields2_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_29_2014747 fly_record['experiments']['img_starfields2_t2_rep1']['imaging_frame_rate_guess'] = 70748 fly_record['experiments']['img_starfields2_t2_rep1']['ol_epoch_duration'] = 3.5749 fly_record['experiments']['img_starfields2_t2_rep1'].create_group('sequences')750 fly_record['experiments'].create_group('img_starfields2_t2_rep2')751 fly_record['experiments']['img_starfields2_t2_rep2']['axon_file_names'] = ['T2_trial2_14701001.abf']752 fly_record['experiments']['img_starfields2_t2_rep2']['tiff_file_names'] = ['/T2_trial2/T2_trial2_MMStack.ome.tif']753 fly_record['experiments']['img_starfields2_t2_rep2']['sequence_pattern_names'] = starfield_pattern_names_6_29_2014754 fly_record['experiments']['img_starfields2_t2_rep2']['imaging_frame_rate_guess'] = 70755 fly_record['experiments']['img_starfields2_t2_rep2']['ol_epoch_duration'] = 3.5756 fly_record['experiments']['img_starfields2_t2_rep2'].create_group('sequences')757 def initfly_180(self,flynum):758 fly_db = self.fly_db759 fly_db.create_group(flynum)760 fly_record =fly_db[flynum]761 fly_record['flynum'] = flynum762 fly_record.create_group('experiments')763 fly_record['experiments'].create_group('img_starfields2_t2_rep1')764 fly_record['experiments']['img_starfields2_t2_rep1']['axon_file_names'] = ['T2_trial1_14701006.abf']765 fly_record['experiments']['img_starfields2_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']766 fly_record['experiments']['img_starfields2_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_29_2014767 fly_record['experiments']['img_starfields2_t2_rep1']['imaging_frame_rate_guess'] = 70768 fly_record['experiments']['img_starfields2_t2_rep1']['ol_epoch_duration'] = 3.5769 fly_record['experiments']['img_starfields2_t2_rep1'].create_group('sequences')770 fly_record['experiments'].create_group('img_starfields2_t2_rep2')771 fly_record['experiments']['img_starfields2_t2_rep2']['axon_file_names'] = ['T2_trial2_14701008.abf']772 fly_record['experiments']['img_starfields2_t2_rep2']['tiff_file_names'] = ['/T2_trial2/T2_trial2_MMStack.ome.tif']773 fly_record['experiments']['img_starfields2_t2_rep2']['sequence_pattern_names'] = starfield_pattern_names_6_29_2014774 fly_record['experiments']['img_starfields2_t2_rep2']['imaging_frame_rate_guess'] = 70775 fly_record['experiments']['img_starfields2_t2_rep2']['ol_epoch_duration'] = 3.5776 fly_record['experiments']['img_starfields2_t2_rep2'].create_group('sequences')777 778 def initfly_181(self,flynum):779 fly_db = self.fly_db780 fly_db.create_group(flynum)781 fly_record =fly_db[flynum]782 fly_record['flynum'] = flynum783 fly_record.create_group('experiments')784 fly_record['experiments'].create_group('img_starfields2_t2_rep1')785 #fly_record['experiments'].create_group('b1_azm_expansion_tuning')786 fly_record['experiments']['img_starfields2_t2_rep1']['axon_file_names'] = ['T2_trial1_14701009.abf']787 fly_record['experiments']['img_starfields2_t2_rep1']['tiff_file_names'] = ['/T2_trial1/T2_trial1_MMStack.ome.tif']788 fly_record['experiments']['img_starfields2_t2_rep1']['sequence_pattern_names'] = starfield_pattern_names_6_29_2014789 fly_record['experiments']['img_starfields2_t2_rep1']['imaging_frame_rate_guess'] = 70790 fly_record['experiments']['img_starfields2_t2_rep1']['ol_epoch_duration'] = 3.5791 fly_record['experiments']['img_starfields2_t2_rep1'].create_group('sequences')792 fly_record['experiments'].create_group('img_starfields2_t2_rep2')793 fly_record['experiments']['img_starfields2_t2_rep2']['axon_file_names'] = ['T2_trial2_14701010.abf']794 fly_record['experiments']['img_starfields2_t2_rep2']['tiff_file_names'] = ['/T2_trial2/T2_trial2_MMStack.ome.tif']795 fly_record['experiments']['img_starfields2_t2_rep2']['sequence_pattern_names'] = starfield_pattern_names_6_29_2014796 fly_record['experiments']['img_starfields2_t2_rep2']['imaging_frame_rate_guess'] = 70797 fly_record['experiments']['img_starfields2_t2_rep2']['ol_epoch_duration'] = 3.5...
test_instance_group.py
Source:test_instance_group.py
1# Licensed under the Apache License, Version 2.0 (the "License"); you may2# not use this file except in compliance with the License. You may obtain3# a copy of the License at4#5# http://www.apache.org/licenses/LICENSE-2.06#7# Unless required by applicable law or agreed to in writing, software8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the10# License for the specific language governing permissions and limitations11# under the License.12import mock13from oslo_utils.fixture import uuidsentinel as uuids14from oslo_versionedobjects import fixture as ovo_fixture15from nova import context16from nova.db.sqlalchemy import api_models17from nova import exception18from nova import objects19from nova.objects import base20from nova import test21class InstanceGroupObjectTestCase(test.TestCase):22 def setUp(self):23 super(InstanceGroupObjectTestCase, self).setUp()24 self.context = context.RequestContext('fake-user', 'fake-project')25 def _api_group(self, **values):26 group = objects.InstanceGroup(context=self.context,27 user_id=self.context.user_id,28 project_id=self.context.project_id,29 name='foogroup',30 policy='anti-affinity',31 rules={'max_server_per_host': 1},32 members=['memberfoo'])33 group.update(values)34 group.create()35 return group36 def test_create(self):37 create_group = self._api_group()38 db_group = create_group._get_from_db_by_uuid(self.context,39 create_group.uuid)40 self.assertIsInstance(db_group.policy, api_models.InstanceGroupPolicy)41 self.assertEqual(create_group.policies[0], db_group.policy.policy)42 self.assertEqual(create_group.id, db_group.policy.group_id)43 ovo_fixture.compare_obj(44 self, create_group, db_group,45 comparators={'policy': lambda a, b: b == a.policy},46 allow_missing=('deleted', 'deleted_at', 'policies', '_rules'))47 self.assertEqual({'max_server_per_host': 1}, create_group.rules)48 def test_destroy(self):49 create_group = self._api_group()50 create_group.destroy()51 self.assertRaises(exception.InstanceGroupNotFound,52 create_group._get_from_db_by_uuid, self.context,53 create_group.uuid)54 @mock.patch('nova.compute.utils.notify_about_server_group_update')55 def test_save(self, _mock_notify):56 create_group = self._api_group()57 create_group.members = ['memberbar1', 'memberbar2']58 create_group.name = 'anewname'59 create_group.save()60 db_group = create_group._get_from_db_by_uuid(self.context,61 create_group.uuid)62 ovo_fixture.compare_obj(63 self, create_group, db_group,64 comparators={'policy': lambda a, b: b == a.policy},65 allow_missing=('deleted', 'deleted_at', 'policies', '_rules'))66 self.assertEqual({'max_server_per_host': 1}, create_group.rules)67 def test_add_members(self):68 create_group = self._api_group()69 new_member = ['memberbar']70 objects.InstanceGroup.add_members(self.context, create_group.uuid,71 new_member)72 db_group = create_group._get_from_db_by_uuid(self.context,73 create_group.uuid)74 self.assertEqual(create_group.members + new_member, db_group.members)75 def test_add_members_to_group_with_no_members(self):76 create_group = self._api_group(members=[])77 new_member = ['memberbar']78 objects.InstanceGroup.add_members(self.context, create_group.uuid,79 new_member)80 db_group = create_group._get_from_db_by_uuid(self.context,81 create_group.uuid)82 self.assertEqual(new_member, db_group.members)83 def test_remove_members(self):84 create_group = self._api_group(members=[])85 # Add new members.86 new_members = [uuids.instance1, uuids.instance2, uuids.instance3]87 objects.InstanceGroup.add_members(self.context, create_group.uuid,88 new_members)89 # We already have tests for adding members, so we don't have to90 # verify they were added.91 # Remove the first two members we added.92 objects.InstanceGroup._remove_members_in_db(self.context,93 create_group.id,94 new_members[:2])95 # Refresh the group from the database.96 db_group = create_group._get_from_db_by_uuid(self.context,97 create_group.uuid)98 # We should have one new member left.99 self.assertEqual([uuids.instance3], db_group.members)100 def test_get_by_uuid(self):101 create_group = self._api_group()102 get_group = objects.InstanceGroup.get_by_uuid(self.context,103 create_group.uuid)104 self.assertTrue(base.obj_equal_prims(create_group, get_group))105 def test_get_by_name(self):106 create_group = self._api_group()107 get_group = objects.InstanceGroup.get_by_name(self.context,108 create_group.name)109 self.assertTrue(base.obj_equal_prims(create_group, get_group))110 def test_get_by_instance_uuid(self):111 create_group = self._api_group(members=[uuids.instance])112 get_group = objects.InstanceGroup.get_by_instance_uuid(self.context,113 uuids.instance)114 self.assertTrue(base.obj_equal_prims(create_group, get_group))115 def test_get_by_project_id(self):116 create_group = self._api_group()117 get_groups = objects.InstanceGroupList.get_by_project_id(118 self.context, self.context.project_id)119 self.assertEqual(1, len(get_groups))120 self.assertTrue(base.obj_equal_prims(create_group, get_groups[0]))121 ovo_fixture.compare_obj(self, get_groups[0], create_group)122 def test_get_all(self):123 create_group = self._api_group()124 get_groups = objects.InstanceGroupList.get_all(self.context)125 self.assertEqual(1, len(get_groups))126 self.assertTrue(base.obj_equal_prims(create_group, get_groups[0]))127 ovo_fixture.compare_obj(self, get_groups[0], create_group)128 def test_get_counts(self):129 # _api_group() creates a group with project_id and user_id from130 # self.context by default131 self._api_group()132 self._api_group(project_id='foo')133 self._api_group(user_id='bar')134 # Count only across a project135 counts = objects.InstanceGroupList.get_counts(self.context, 'foo')136 self.assertEqual(1, counts['project']['server_groups'])137 self.assertNotIn('user', counts)138 # Count across a project and a user139 counts = objects.InstanceGroupList.get_counts(140 self.context, self.context.project_id,141 user_id=self.context.user_id)142 self.assertEqual(2, counts['project']['server_groups'])...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!