for this_opt in my_options: m = re.search(r'^-n=(\d+),(\d+)$', this_opt) if m: nx = int(m.group(1)) ny = int(m.group(2)) print('Set sizes=',nx,ny) m = re.search(r'^-r', this_opt) if m: subtr_ref = True m = re.search(r'^-s=(\d+)$', this_opt) if m: sca = m.group(1) # Basic calculations # Size of a block N = pyirc.get_nside(formatpars) # Side lengths dx = N//nx dy = N//ny # Now get file list flist1 = os.listdir(input_dir) flist = [] slist = [] elist = [] for filename in flist1: if fnmatch.fnmatch(filename, '*1400nm*.fits'): flist.append(filename) s = e = 65535 m = re.search(r'_(\d+).fits', filename) if m: e = int(m.group(1))
filelist = [] for k in range(nfile): thisname = prefix + '/{:d}'.format(stamp) + body + '_{:03d}.fits'.format( k + 1) count = 0 while not path.exists(thisname): count += 1 thisname = prefix + '/{:d}'.format( stamp + count) + body + '_{:03d}.fits'.format(k + 1) if count == 10000: print('Failed to find file', k) exit() filelist.append(thisname) # Now get the median of the first stable frames nside = pyirc.get_nside(fileformat) firstframe = numpy.zeros((nfile, nside, nside), dtype=numpy.uint16) print(numpy.shape(firstframe)) for k in range(nfile): firstframe[k, :, :] = pyirc.load_segment(filelist[k], fileformat, [0, nside, 0, nside], [t_init], False) # Median and IQR medarray = numpy.percentile(firstframe, 50, axis=0, interpolation='linear') iqrarray = numpy.percentile(firstframe, 75, axis=0, interpolation='linear') - numpy.percentile( firstframe, 25, axis=0, interpolation='linear') del firstframe