Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def plotIV(coordinate=None, sample_size=100, set_region=(0,999,0,999), showPosition=False, inset=False, figsize=(30,30), savepng=False, dpi=None, savepdf=False, annotations=False, data_processing=1, return_only=False):
- start = time.time()
- # voltages
- voltages = [-1000, -500, -200, -100, 0, 100, 200, 500, 600]
- # scans (ordered by voltages)
- scans_ordered = [ 189, 188, 185, 183,181,182, 186, 187, 190]
- # convert list to array
- voltages, scans_ordered = np.array(voltages), np.array(scans_ordered)
- current_array_list = []
- current_mean = []
- # plot either with or without negative values and select if the solar cell channel should be selected for the current
- options_dic = {
- 1: (False, False, "Lock in R , ohne Negativwerte"),
- 2: (False, True, "Lock in R, mit Negativwerten"),
- 3: (True, False, "solar cell channel, ohne Negativwerte"),
- 4: (True, True, "solar cell channel, mit Negativwerten")
- }
- if not return_only:
- print(options_dic[data_processing][2])
- A = 2 # plot only from scan_ordered[A] to ...
- B = -2 # ... scan_ordered[B]
- counter = 0
- for scan in scans_ordered[A:B]:
- positions = load_h5(scan, "positions")
- y_axis_h5 = positions["/data/encoder_fast/data"]
- z_axis_h5 = positions["/data/encoder_slow/data"]
- y_axis = np.array(y_axis_h5)
- z_axis = np.array(z_axis_h5)
- current = counts2amps(scan,solar_cell_channel_only=options_dic[data_processing][0], negative=options_dic[data_processing][1])
- y_grid, z_grid, current_array = supergrid(y_axis,z_axis,current,1000)
- if scan != 181:
- warp_matrix = ImageRegistrationDic[scan]
- current_array = cv2.warpAffine(current_array, warp_matrix, (1000, 1000), flags = cv2.INTER_LINEAR + cv2.WARP_INVERSE_MAP, borderValue = float("NaN")).astype(np.float32)
- current_array_list.append(current_array)
- current_mean.append(np.nanmean(current_array))
- print(current_mean[counter])
- print(f"Mean current for scan {scan} is {current_mean[counter]} nA. Its min/max current is {np.nanmin(current_array)}/{np.nanmax(current_array)} nA.")
- counter += 1
- pixelplotting_array = np.stack(current_array_list)
- if return_only:
- return current_array_list, pixelplotting_array
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement