def plotMiniscan0p1a(obspaths, fileLevel): 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] # cmap = plt.get_cmap('jet') # colours = [cmap(i) for i in aotfFrequency[np.asarray(plotIndices)]] # for plotIndex in plotIndices: ## plt.plot(detectorDataMean[plotIndex,:], label=aotfFrequency[plotIndex]) plt.plot(aotfFrequency, detectorDataMean[:, 100] / np.mean(detectorDataMean, axis=1)) plt.plot(aotfFrequency, detectorDataMean[:, 200] / np.mean(detectorDataMean, axis=1))
def searchForMiniscans(regex, fileLevel): hdf5Files, hdf5Filenames, titles = makeFileList(regex, fileLevel, open_files=False, silent=True) for hdf5_filename in hdf5Filenames: hdf5_filename_split = hdf5_filename.split("_") if len(hdf5_filename_split) == 6: if hdf5_filename_split[-1] == "S": name, hdf5_file = getFile(hdf5_filename, fileLevel, 0, silent=True) detectorData = hdf5_file["Science/Y"][...] nSpectra = detectorData.shape[0] alts = hdf5_file["Geometry/Point0/TangentAltAreoid"][:, 0] if alts[0] > 250.0 and alts[-1] > 250.0: print("Warning: merged occultation") print("nSpectra=%i, hdf5_filename=%s, orders=" % (nSpectra, hdf5_filename)) print( list(set(list( hdf5_file["Channel/DiffractionOrder"][...]))))
from fit_absorption_band_v01 import fit_gaussian_absorption from hdf5_functions_v04 import BASE_DIRECTORY, DATA_DIRECTORY, LOCAL_DIRECTORY, FIG_X, FIG_Y, makeFileList from plot_solar_line_simulations_lno import smoothHighRes #, nu_mp, t_p0 SMOOTHING_LEVEL = 600 #must be even number MAKE_CALIBRATION_TABLE = True #MAKE_CALIBRATION_TABLE = False regex = re.compile( "(20161121_233000_0p1a_LNO_1|20180702_112352_0p1a_LNO_1|20181101_213226_0p1a_LNO_1|20190314_021825_0p1a_LNO_1|20190609_011514_0p1a_LNO_1|20191207_051654_0p1a_LNO_1)" ) fileLevel = "hdf5_level_0p1a" hdf5Files, hdf5Filenames, titles = makeFileList(regex, fileLevel) #new values from order 118 solar line #Q0=-10.159 #Q1=-0.8688 #new values from mean gradient/offset of best orders: 142, 151, 156, 162, 166, 167, 178, 189, 194 Q0 = -10.13785778 Q1 = -0.829174444 #old values #Q0=-6.267734 #Q1=-7.299039e-1 Q2 = 0.0 def t_p0(t, Q0=Q0, Q1=Q1, Q2=Q2): """instrument temperature to pixel0 shift"""
detectorData = hdf5_file["Science/Y"][...] nSpectra = detectorData.shape[0] alts = hdf5_file["Geometry/Point0/TangentAltAreoid"][:, 0] if alts[0] > 250.0 and alts[-1] > 250.0: print("Warning: merged occultation") print("nSpectra=%i, hdf5_filename=%s, orders=" % (nSpectra, hdf5_filename)) print( list(set(list( hdf5_file["Channel/DiffractionOrder"][...])))) """search for specific miniscans in dataset""" #searchForMiniscans(regex, fileLevel) """plot miniscans""" hdf5Files, hdf5Filenames, _ = makeFileList(regex, fileLevel, silent=True) hdf5_file = hdf5Files[0] hdf5_filename = hdf5Filenames[0] plt.figure(figsize=(FIG_X, FIG_Y)) alts = hdf5_file["Geometry/Point0/TangentAltAreoid"][:, 0] if alts[0] > 250.0 and alts[-1] > 250.0: isMerged = True halfLength = int(len(alts) / 2) if isMerged: alts = alts[0:halfLength] detectorData = hdf5_file["Science/Y"][0:halfLength, 50:]