def get_mV_image(raw): im = Image.Image(raw) im.set_channel_groups((1,4)) im.FPN_correction(rowstart=0,rowstop=2999,target=0) im.RTN_correction(False,colstart=0,colstop=3999,target=0) im.multiply(-1/4000.*1200) # conversion to Vt (minus because DN = rst-sig = Vpix-Vt-DAC) return im
#rows = 3136 #columns = 4352 rows = 3000 columns = 4352 #roi = (68,3135,0,3999) col_chan = 16 n_adc = 6 col_start = n_adc * columns / 8 col_stop = col_start + columns / 8 PTNtoplot = [] for raw in [raw0, raw1]: im0 = Image.Image(raw[1], rows=rows, columns=columns) im1 = Image.Image(raw[2], rows=rows, columns=columns) im0.set_ROI(roi) im1.set_ROI(roi) im1.subtract(im0) arr = im1.get_array() # to use to split adc: #arr = arr[:,col_start:col_stop] arr = arr[:, 0:4178] arr_split = arr[:, 0::col_chan] for i in range(1, col_chan): arr_split = numpy.hstack((arr_split, arr[:, i::col_chan]))
raw0 = "F:\\INVISAGE\\PC6\\Column_response_loss\\Data\\20150821\\64A2\\image_64A2_20MHz_12dB_skew95.raw" if bdark: dark0 = "F:\\INVISAGE\\PC6\\Column_response_loss\\Data\\20150728\\Q8A752W03#31-A1\\Dark\\Dark_0000.raw" rows = 3128 columns = 4352 #rows = 3128 #columns = 768 #columns = 1280 num_channels = 4 num_columns = 64 num_cds = 16 #1st CDS skipped im0 = Image.Image(raw0, rows=rows, columns=columns) if bdark: dark0 = Image.Image(dark0, rows=rows, columns=columns) im0.subtract(dark0) im0.set_channel_groups((1, num_channels)) R_cds = numpy.zeros((num_channels, num_cds)) R_col = numpy.zeros((num_channels, num_columns)) gain_col = numpy.zeros((num_channels, num_columns)) for i_chan in range(num_channels): #for i_chan in range(1): profile_ch = im0.get_profile(axis=0, i_channel_group=i_chan) #profile_ch = profile_ch[num_columns:]
bRTN=bRTN, rtn_colstart=rtn_colstart, rtn_colstop=rtn_colstop, directory_suffix=directory_suffix, bsave=False, bfullresolution=bfullresolution, blog=blog) # cross-check on Ric's xtalk heatmap (horizontal) bxcheck = False if bxcheck: file_heatmap = "F:\\INVISAGE\\PC3\\Crosstalk\\Data\\from_Ric\\GrOverR.txt" f_heatmap = open(file_heatmap) lines_heatmap = f_heatmap.readlines() val = [] for i in range(len(lines_heatmap)): val.append(lines_heatmap[i].split(',')[:-1]) arr = numpy.array(val).astype('float32') print "Heatmap shape:", arr.shape im_heatmap = Image.Image(arr) im_heatmap.plot_image(minval=0.3, maxval=0.5, bsave=True, filename=os.path.join(directory, 'Ric_xtalk.png'))
xmin = 6 #xmin = 0 xmax = 10 #xmax = 9 channel_groups = (1,4) #channel_groups = (1,1) num_channels = channel_groups[0] * channel_groups[1] bswap = False Npixels = 10 # number of pixel histogram to plot for each channel PTN_min = 10.0 PTN_max = 10.5 im0 = Image.Image(raw0[0]) im0.set_channel_groups(channel_groups) im0.set_ROI(roi) tmp_mean = [] tmp_mean_row = [] tmp_mean_column = [] tmp_rms = [] tmp_rms_row = [] tmp_rms_column = [] for i_channel_group in range(num_channels): tmp_mean.append(im0.zeroarray(bROI=True,channel=i_channel_group)) tmp_mean_row.append(numpy.zeros(tmp_mean[-1].shape[0])) tmp_mean_column.append(numpy.zeros(tmp_mean[-1].shape[1])) tmp_rms.append(im0.zeroarray(bROI=True,channel=i_channel_group)) tmp_rms_row.append(numpy.zeros(tmp_rms[-1].shape[0]))