popt, pcov = curve_fit(func, linear_dark, deviation_mean, p0=[1.2, 0.0032]) ax2.plot(linear_dark, deviation_mean, c="k") ax2.plot(linear_dark, func(linear_dark, *popt), "k--") ax1.set_ylabel("Detector counts (per pixel per accumulation)") ax2.set_ylabel("Deviation from linear fit") ax2.set_xlabel("Detector counts linear fit") fig.suptitle("SO Non Linearity") print("fit: a=%0.6f, b=%0.6f" % tuple(popt)) return linear_dark, deviation_mean if title == "SO MCO Dark": hdf5Files, hdf5Filenames, titles = makeFileList(obspaths, fileLevel) writeSteppingData(hdf5Files, hdf5Filenames, "so") if title == "LNO MCO Dark": hdf5Files, hdf5Filenames, titles = makeFileList(obspaths, fileLevel) writeSteppingData(hdf5Files, hdf5Filenames, "lno") if title == "SO Bad Pixel Map": writeBadPixelMap(obspaths, "so") if title == "LNO Bad Pixel Map": writeBadPixelMap(obspaths, "lno") if title == "SO Non Linearity Correction": linear_dark, deviation_mean = writeNonLinearity2(obspaths, "so")
plt.tight_layout() if save_figs: plt.savefig("UVIS_frame_%i_%s_raw_data.png" % (frame_to_plot, obspaths[file_index])) plt.figure(figsize=(10, 8)) plt.xlabel("Time") plt.ylabel("Signal sum") plt.plot(detector_data, "o", linewidth=0) plt.legend() plt.title(title + ": Detector column %i versus time" % pixel_column) if save_figs: plt.savefig(BASE_DIRECTORY + os.sep + title + ".png") import os import numpy as np from hdf5_functions_v03 import makeFileList DATA_DIRECTORY = os.path.normcase( r"W:\data\SATELLITE\TRACE-GAS-ORBITER\NOMAD\hdf5\test\iant\hdf5") #DATA_DIRECTORY = os.path.normcase(r"/bira-iasb/data/SATELLITE/TRACE-GAS-ORBITER/NOMAD/hdf5/") """list UVIS acquisiton modes""" #obspaths = ["*20180601*UVIS*_E"] fileLevel = "hdf5_level_0p2c" #hdf5Files, hdf5Filenames, _ = makeFileList(["*201806*UVIS*_I"], fileLevel) #for hdf5File, hdf5Filename in zip(hdf5Files, hdf5Filenames): # print(hdf5Filename + ": "+str(hdf5File["Channel/AcquisitionMode"][0])) hdf5Files, hdf5Filenames, _ = makeFileList(["*201806*UVIS*_E"], fileLevel) for hdf5File, hdf5Filename in zip(hdf5Files, hdf5Filenames): print(hdf5Filename + ": " + str(hdf5File["Channel/AcquisitionMode"][0]))
yfit = dataFitInterp[minIndex:(nPoints)] y = dataInterp[0:(nPoints - minIndex)] / yfit if plot: plt.subplot(2, 1, 2) plt.plot(x, y, label="residual") plt.ylim([0.95, 1.02]) plt.legend() plt.tight_layout() plt.show() return x, yfit, y hdf5Files, hdf5Filenames, _ = makeFileList(obspaths, fileLevel, silent=True) #from plot_animations_v01 import animateLines plt.figure() #for fileIndex, (hdf5_file, hdf5_filename) in enumerate(zip(hdf5Files, hdf5Filenames)): for fileIndex, (hdf5_file, hdf5_filename) in enumerate( zip(hdf5Files[3:4], hdf5Filenames[3:4])): detectorData = hdf5_file["Science/Y"][...] aotfFrequency = hdf5_file["Channel/AOTFFrequency"][...] exponent = hdf5_file["Channel/Exponent"][...] detectorDataMean = np.mean(detectorData[:, 12:13], axis=1) # a = animateLines([detectorDataMean]) # plotIndices = [0,1,2,3,256,257]
@author: iant """ from plot_occultations_v02 import joinTransmittanceFiles from hdf5_functions_v03 import makeFileList import numpy as np from scipy.signal import butter, lfilter import matplotlib.pyplot as plt # #hdf5Files, hdf5Filenames, _ = makeFileList(["20180421_202111_0p3a_SO_1_E_134"], "hdf5_level_0p3a", silent=True) #hdf5Files, hdf5Filenames, _ = makeFileList(["20180618_001805_0p3a_SO_1_E_134"], "hdf5_level_0p3a", silent=True) hdf5Files, hdf5Filenames, _ = makeFileList(["20180613_073640_0p3a_SO_2_I_134"], "hdf5_level_0p3a", silent=True) # # obsDict = joinTransmittanceFiles(hdf5Files[0], hdf5Filenames[0], 3, silent=False, top_of_atmosphere=60.0) def butter_lowpass(cutoff, fs, order=5): nyq = 0.5 * fs normal_cutoff = cutoff / nyq b, a = butter(order, normal_cutoff, btype='low', analog=False) return b, a