def get_from_filelist(self, xml_file_list): from kt_simul import simul_spindle as sim from kt_simul import attachment_state as atst self.defects = {} self.mero_types = {} self.xml_file_list = xml_file_list for i, in range(len(xml_file_list))[::num_ech]: for j in num_ech: mp = sim.get_fromfile( i * num_ech + j) if i * j == 0: self.defects, were_defects = atst.defect_histories(mp.KD) balance, self.mero_types = atst.balance_histories(mp.KD) else: defects, were_defects = atst.defect_histories(mp.KD) balance, mero_types = atst.balance_histories(mp.KD) for defect in defects.keys(): self.defects[defect] = hstack((self.defects[defect], defects[defect])) for mero_type in mero_types.keys(): self.mero_types[mero_type] = hstack((self.mero_types[mero_type], mero_types[mero_type])) del defects, were_defects, balance del mp if mod(i,20) == 0: print '%i / %i'%(i, len(xml_file_list))
def compute_defects(xml_file_list, base_name): from kt_simul import simul_spindle as sim from kt_simul import attachment_state as atst all_defects = {} all_merotelic_types = {} all_pcs1s = []#load(base_name+'_pcs1s.npy') all_auroras = []#load(base_name+'_auroras.npy') #base_shape = (pcs1s.size, auroras.size) for i, fname in enumerate(xml_file_list): mp = sim.get_fromfile(os.path.join(base_name,fname)) if i == 0: all_defects, all_were_defects = atst.defect_histories(mp.KD) all_balance, all_merotelic_types = atst.balance_histories(mp.KD) else: defects, were_defects = atst.defect_histories(mp.KD) balance, merotelic_types = atst.balance_histories(mp.KD) trans_mat = atst.transition_matrix(mp.KD) for defect in defects.keys(): all_defects[defect] = hstack((all_defects[defect], defects[defect])) for mero_type in merotelic_types.keys(): all_merotelic_types[mero_type] = hstack((all_merotelic_types[mero_type], merotelic_types[mero_type])) del defects, were_defects, balance, trans_mat all_pcs1s.append(mp.KD.params['orientation']) all_auroras.append(mp.KD.params['aurora']) if mod(i,20) == 0: print '%i / %i'%(i, len(xml_file_list)) del mp return all_pcs1s, all_auroras, all_defects, all_merotelic_types