def intensity_export(): path = selectSaveFolder() if path == None: return dss = __DATASOURCE__.getSelectedDatasets() if len(dss) == 0: print 'Error: please select at least one data file.' prog_bar.max = len(dss) + 1 prog_bar.selection = 0 if len(dss) == 0: return fi = File(path) if not fi.exists(): if not fi.mkdir(): print 'Error: failed to make directory: ' + path return if eff_corr_enabled.value and eff_map.value != None \ and len(eff_map.value.strip()) > 0: map = lib.make_eff_map(df, str(eff_map.value)) else: map = None dss_idx = 0 for dinfo in dss: dss_idx += 1 prog_bar.selection = dss_idx df.datasets.clear() log('exporting ' + dinfo.location) ds = df[str(dinfo.location)] rds = silent_reduce(ds, map) masks = [] if reg_enabled.value : try: masks = Plot1.get_masks() except: pass if len(masks) == 0: if reg_list.value != None and reg_list.value.strip() != '': masks = str2mask(reg_list.value) vi = lib.v_intg(rds, masks) ir = lib.i_intg(vi) ir.copy_metadata_shallow(vi) ir.location = ds.location lib.i_export(ir, path) prog_bar.selection = dss_idx + 1 prog_bar.selection = 0 set_prof_value(SAVED_MASK_PRFN , str(reg_list.value)) set_prof_value(SAVED_EFFICIENCY_FILENAME_PRFN , str(eff_map.value)) save_pref() print 'Done'
def intensity_export(): path = selectSaveFolder() if path == None: return dss = __get_selected_files__() if len(dss) == 0: print 'Error: please select at least one data file.' prog_bar.max = len(dss) + 1 prog_bar.selection = 0 if len(dss) == 0: return fi = File(path) if not fi.exists(): if not fi.mkdir(): print 'Error: failed to make directory: ' + path return if eff_corr_enabled.value and eff_map.value != None \ and len(eff_map.value.strip()) > 0: map = lib.make_eff_map(df, get_calibration_path() + '/' + str(eff_map.value)) else: map = None dss_idx = 0 rfs = [] for dinfo in dss: dss_idx += 1 prog_bar.selection = dss_idx df.datasets.clear() log('exporting ' + dinfo) ds = df[str(dinfo)] rds = silent_reduce(ds, map) masks = [] if reg_enabled.value : try: masks = Plot1.get_masks() except: pass if len(masks) == 0: # if reg_list.value != None and reg_list.value.strip() != '': # masks = str2mask(reg_list.value) masks = get_mask_str() vi = lib.v_intg(rds, masks) ir = lib.i_intg(vi) ir.copy_metadata_shallow(vi) ir.location = ds.location rf = lib.i_export(ir, path) rfs.append(rf) prog_bar.selection = dss_idx + 1 prog_bar.selection = 0 set_pref_value(SAVED_MASK_PRFN , get_mask_str()) set_pref_value(SAVED_EFFICIENCY_FILENAME_PRFN , str(eff_map.value)) save_pref() # sname = 'Kowari_intensity_' + str(int(time.time() * 1000))[2:] + '.zip' # print 'compressing result in ' + sname # f_out = zipfile.ZipFile(path + '/' + sname, mode='w') # for rfn in rfs: # try: # f_out.write(rfn, arcname = rfn[rfn.rindex('/') + 1 :]) # except: # print 'failed to zip' # f_out.close() # f_out.close() # report_file(sname) zip_files(rfs, '/Kowari_int_' + str(int(time.time()))[2:] + '.zip') print 'Done'
def intensity_export(): path = selectSaveFolder() if path == None: return dss = __get_selected_files__() if len(dss) == 0: print 'Error: please select at least one data file.' prog_bar.max = len(dss) + 1 prog_bar.selection = 0 if len(dss) == 0: return fi = File(path) if not fi.exists(): if not fi.mkdir(): print 'Error: failed to make directory: ' + path return if eff_corr_enabled.value and eff_map.value != None \ and len(eff_map.value.strip()) > 0: map = lib.make_eff_map( df, get_calibration_path() + '/' + str(eff_map.value)) else: map = None dss_idx = 0 rfs = [] for dinfo in dss: dss_idx += 1 prog_bar.selection = dss_idx df.datasets.clear() log('exporting ' + dinfo) ds = df[str(dinfo)] rds = silent_reduce(ds, map) masks = [] if reg_enabled.value: try: masks = Plot1.get_masks() except: pass if len(masks) == 0: # if reg_list.value != None and reg_list.value.strip() != '': # masks = str2mask(reg_list.value) masks = get_mask_str() vi = lib.v_intg(rds, masks) ir = lib.i_intg(vi) ir.copy_metadata_shallow(vi) ir.location = ds.location rf = lib.i_export(ir, path) rfs.append(rf) prog_bar.selection = dss_idx + 1 prog_bar.selection = 0 set_pref_value(SAVED_MASK_PRFN, get_mask_str()) set_pref_value(SAVED_EFFICIENCY_FILENAME_PRFN, str(eff_map.value)) save_pref() # sname = 'Kowari_intensity_' + str(int(time.time() * 1000))[2:] + '.zip' # print 'compressing result in ' + sname # f_out = zipfile.ZipFile(path + '/' + sname, mode='w') # for rfn in rfs: # try: # f_out.write(rfn, arcname = rfn[rfn.rindex('/') + 1 :]) # except: # print 'failed to zip' # f_out.close() # f_out.close() # report_file(sname) zip_files(rfs, '/Kowari_int_' + str(int(time.time()))[2:] + '.zip') print 'Done'