diff --git a/src/cortecs/eval/eval.py b/src/cortecs/eval/eval.py index 56b41f7..d89f088 100644 --- a/src/cortecs/eval/eval.py +++ b/src/cortecs/eval/eval.py @@ -28,6 +28,7 @@ def __init__(self, opac, fitter, **eval_kwargs): self.wl = opac.wl self.P = opac.P self.T = opac.T + self.fit_kwargs = fitter.fitter_kwargs if not hasattr(fitter, "fitter_results"): raise ValueError("Fitter must be run before being passed to an Evaluator.") diff --git a/src/cortecs/eval/eval_neural_net.py b/src/cortecs/eval/eval_neural_net.py index 1d55ad6..69a14e5 100644 --- a/src/cortecs/eval/eval_neural_net.py +++ b/src/cortecs/eval/eval_neural_net.py @@ -61,7 +61,14 @@ def feed_forward(x, n_layers, weights, biases): # @jax.jit def eval_neural_net( - T, P, temperatures, pressures, wavelengths, n_layers=None, weights=None, biases=None + T, + P, + temperatures=None, + pressures=None, + wavelengths=None, + n_layers=None, + weights=None, + biases=None, ): """ evaluates the neural network at a given temperature and pressure. diff --git a/src/cortecs/eval/eval_pca.py b/src/cortecs/eval/eval_pca.py index 47a6189..485e0ff 100644 --- a/src/cortecs/eval/eval_pca.py +++ b/src/cortecs/eval/eval_pca.py @@ -40,7 +40,9 @@ def eval_pca_ind_wav(temperature_ind, pressure_ind, vectors, pca_coeffs): return xsec_val -def eval_pca(temperature, pressure, wavelength, T, P, wl, fitter_results): +def eval_pca( + temperature, pressure, wavelength, T, P, wl, fitter_results, fit_axis="pressure" +): """ Evaluates the PCA fit at a given temperature, pressure, and wavelength. @@ -64,4 +66,23 @@ def eval_pca(temperature, pressure, wavelength, T, P, wl, fitter_results): pca_vectors, pca_coeffs_all_wl = fitter_results pca_coeffs = pca_coeffs_all_wl[wavelength_ind, :, :] - return eval_pca_ind_wav(temperature_ind, pressure_ind, pca_vectors, pca_coeffs) + # todo: figure out how to order the pressure and temperature inds! + if fit_axis == "pressure": + first_arg = temperature_ind + second_arg = pressure_ind + elif fit_axis == "temperature": + first_arg = pressure_ind + second_arg = temperature_ind + elif fit_axis == "best": + T_length = len(T) + P_length = len(P) + + # todo: what if equal? + if T_length > P_length: + first_arg = pressure_ind + second_arg = temperature_ind + else: + first_arg = pressure_ind + second_arg = temperature_ind + + return eval_pca_ind_wav(first_arg, second_arg, pca_vectors, pca_coeffs) diff --git a/src/cortecs/fit/fit.py b/src/cortecs/fit/fit.py index 8046885..e53c3ff 100644 --- a/src/cortecs/fit/fit.py +++ b/src/cortecs/fit/fit.py @@ -54,7 +54,8 @@ def __init__(self, opac, method="pca", **fitter_kwargs): 'polynomial', 'pca', and 'neural_net'. The more complex the model, the larger the model size (i.e., potentially the lower the compression factor), and the more likely it is to fit well. fitter_kwargs: dict - kwargs that are passed to the fitter. + kwargs that are passed to the fitter. one kwarg, for instance, is the fit_axis: for PCA, + this determines what axis is fit against. """ self.opac = opac self.fitter_kwargs = fitter_kwargs @@ -70,6 +71,7 @@ def __init__(self, opac, method="pca", **fitter_kwargs): self.P = self.opac.P self.T = self.opac.T + # todo: figure out how to change the fitting...based on the fit axis? return def fit(self, parallel=False): diff --git a/src/cortecs/fit/fit_pca.py b/src/cortecs/fit/fit_pca.py index 7e3f482..f429f52 100644 --- a/src/cortecs/fit/fit_pca.py +++ b/src/cortecs/fit/fit_pca.py @@ -97,14 +97,14 @@ def do_pca(cube, nc=3): try: xMat, s, vh, u = do_svd(standardized_cube, nc, nx) - except np.linalg.LinAlgError: + except np.linalg.LinAlgError as e: print("SVD did not converge.") - return + raise e return xMat, standardized_cube, s, vh, u -def fit_pca(cross_section, P, T, xMat, **kwargs): +def fit_pca(cross_section, P, T, xMat, fit_axis="pressure", **kwargs): """ Fits the PCA to the opacity data. @@ -119,12 +119,41 @@ def fit_pca(cross_section, P, T, xMat, **kwargs): ------- :beta: (nc x pixels) PCA coefficients """ + print("shapes for everything:", cross_section.shape, P.shape, T.shape, xMat.shape) + cross_section = move_cross_section_axis(cross_section, fit_axis) beta = fit_mlr(cross_section, xMat) return beta -def prep_pca(cross_section, wav_ind=-1, nc=2, force_fit_constant=False): +def move_cross_section_axis(cross_section, fit_axis): + """ + todo: add docstring + :param cross_section: + :param fit_axis: + :return: + """ + fit_axis_options = ["best", "temperature", "pressure"] + if fit_axis not in fit_axis_options: + raise ValueError(f"fit_axis param must be one of: {fit_axis_options}") + + # the current shape prefers pressure. let's auto-check, though + if fit_axis == "best": + # actually want SECOND longest. + longest_axis = np.argmax(cross_section[:, :, 0].shape) + + # now move that longest axis to 0. + cross_section = np.moveaxis(cross_section, longest_axis, 1) + + elif fit_axis == "temperature": + cross_section = np.moveaxis(cross_section, 0, 1) + + return cross_section + + +def prep_pca( + cross_section, wav_ind=-1, nc=2, force_fit_constant=False, fit_axis="pressure" +): """ Prepares the opacity data for PCA. That is, it calculates the PCA components to be fit along the entire dataset by fitting the PCA to a single wavelength. @@ -144,11 +173,15 @@ def prep_pca(cross_section, wav_ind=-1, nc=2, force_fit_constant=False): :force_fit_constant: (bool) if True, will allow the PCA to fit an opacity function without temperature and pressure dependence. This usually isn't recommended, if these PCA vectors are to e used to fit other wavelengths that *do* have temperature and pressure dependence. + :fit_axis: (str) the axis to fit against. determines the shape of the final vectors and components. + if "best", chooses the largest axis. otherwise, can select "temperature" or "pressure". Returns ------- :xMat: (n_exp x nc) PCA components """ + cross_section = move_cross_section_axis(cross_section, fit_axis) + single_pres_single_temp = cross_section[:, :, wav_ind] if ( np.all(single_pres_single_temp == single_pres_single_temp[0, 0]) diff --git a/src/cortecs/opac/chunking.py b/src/cortecs/opac/chunking.py index 69d6008..b529b00 100644 --- a/src/cortecs/opac/chunking.py +++ b/src/cortecs/opac/chunking.py @@ -24,6 +24,7 @@ """ import os +from glob import glob import numpy as np from tqdm import tqdm @@ -31,9 +32,16 @@ from cortecs.opac.opac import * -def chunk_wavelengths(file, nchunks=None, wav_per_chunk=None, adjust_wavelengths=False): +def chunk_wavelengths( + file, + nchunks=None, + wav_per_chunk=None, + adjust_wavelengths=False, + loader="exotransmit", +): """ Performs wavelength-chunking. + todo: yell if the chunked results are already in the directory? Inputs ------- @@ -66,7 +74,7 @@ def chunk_wavelengths(file, nchunks=None, wav_per_chunk=None, adjust_wavelengths ) if not wav_per_chunk: - opac = Opac(file, loader="exotransmit") + opac = Opac(file, loader=loader) num_wavelengths = len(opac.wl) del opac # clean it up wav_per_chunk = round(num_wavelengths / nchunks) @@ -82,21 +90,27 @@ def chunk_wavelengths(file, nchunks=None, wav_per_chunk=None, adjust_wavelengths file_suffix = 0 # read through all lines in the opacity file. todo: from already read in opacity? - for x in tqdm(f1): + # past the header + write_to_file(header, file, file_suffix) + for x in tqdm(f1[2:]): + # print(x) if not x: continue commad = x.replace(" ", ",") - + # pdb.set_trace() if len(np.array([eval(commad)]).flatten()) == 1: # if a wavelength line ticker += 1 - elif len(x.split(" ")) == 48 and adjust_wavelengths: # this is ntemp, I believe - x = adjust_wavelength_unit(x, 1e-4, style="full") - # pass # don't need to adust wavelengths anymore! - - if ticker == wav_per_chunk: + print(x) + # print(file_suffix) + # elif len(x.split(" ")) == 48 and adjust_wavelengths: # this is ntemp, I believe + # x = adjust_wavelength_unit(x, 1e-4, style="full") + # # pass # don't need to adust wavelengths anymore! + if ticker == wav_per_chunk + 1: file_suffix += 1 # start writing to different file + ticker = 0 write_to_file(header, file, file_suffix) + write_to_file(x, file, file_suffix) f.close() @@ -191,49 +205,6 @@ def add_lams(max_lam_to_add_ind, file, next_file): return -def add_previous(num_to_add, file, previous_file): - """ - Adds a certain number of wavelength points to a file from a previous one. - - Inputs: - :num_to_add: (int) number of wavelength points to add from one file to the other. - :file: (str) (str) path to file to which wavelength points are being *added*. - :previous_file: (str) path to file from which wavelength points are being drawn. - - Outputs: - None - - Side effects: - Modifies file. - """ - try: - f = open(previous_file) - except FileNotFoundError: - print(f"{previous_file} not found. Moving on!") - return - - f1 = f.readlines()[2:] # first two files of opacity are header info - f.close() - - ticker = 0 - - # read through all lines in the opacity file - for x in f1[::-1]: - if not x: - continue - - commad = x.replace(" ", ",") - if len(np.array([eval(commad)]).flatten()) == 1: # if a wavelength line - ticker += 1 - - # append line to file - f2 = open(file, "a") - f2.write(x) - f2.close() - if ticker == num_to_add: - return - - def add_overlap(filename, v_max=11463.5): """ Adds overlap from file n+1 to file n. The last file has nothing added to it. This @@ -257,10 +228,14 @@ def add_overlap(filename, v_max=11463.5): Side effects: Modifies every 'filename*.dat' file. """ - for i in tqdm( - range(len(os.listdir()[:-1])), position=0, leave=True + print("for sure adding overlap") + files = glob(filename + "*.dat") + for i, file in tqdm( + enumerate(files), total=len(files), position=0, leave=True, desc="eeeeee" ): # don't include the last file - file = filename + str(i) + ".dat" + if file == filename + ".dat": + continue # only add over lap to the chunked file + print("for sure adding overlapppp") next_file = filename + str(i + 1) + ".dat" @@ -282,8 +257,11 @@ def add_overlap(filename, v_max=11463.5): delta_lam = 2 * max_curr_lam * v_max / c # delta_lambda/lambda = v/c # add another 20 indices to be safe! - max_lam_to_add_ind = ( - np.argmin(np.abs(next_lams - (max_curr_lam + delta_lam))) + 20 - ) + # max_lam_to_add_ind = ( + # np.argmin(np.abs(next_lams - (max_curr_lam + delta_lam))) + 20 + # ) + max_lam_to_add_ind = np.argmin(np.abs(next_lams - (max_curr_lam + delta_lam))) + print("max lam to add") + print(max_lam_to_add_ind) add_lams(max_lam_to_add_ind, file, next_file) diff --git a/src/cortecs/opac/io.py b/src/cortecs/opac/io.py index 22546a8..d217dbd 100644 --- a/src/cortecs/opac/io.py +++ b/src/cortecs/opac/io.py @@ -1,8 +1,6 @@ """ Reads opacity data from various sources. - - author: @arjunsavel """ import pickle @@ -18,19 +16,32 @@ class loader_base(object): """ loads in opacity data from various sources. To be passed on to Opac object. - """ - wl_key = "wno" - T_key = "T" - P_key = "P" - cross_section_key = "xsec" - wl_style = "wno" + todo: tutorial on how to use this? + """ - def __init__(self): + def __init__( + self, + wl_key="wno", + T_key="T", + P_key="P", + cross_section_key="xsec", + wl_style="wno", + temperature_axis=0, + pressure_axis=1, + wavelength_axis=2, + ): """ - nothing to do here + sets the keys for the loader object. """ - pass + self.wl_key = wl_key + self.T_key = T_key + self.P_key = P_key + self.cross_section_key = cross_section_key + self.wl_style = wl_style + self.temperature_axis = temperature_axis + self.pressure_axis = pressure_axis + self.wavelength_axis = wavelength_axis def load(self, filename): """ @@ -60,11 +71,29 @@ def load(self, filename): cross_section = np.array(hf[self.cross_section_key], dtype=np.float64) hf.close() + # want temperature index 0, pressure to 1, wavelength to 2 for standard usage. + cross_section = np.moveaxis( + cross_section, + [self.temperature_axis, self.pressure_axis, self.wavelength_axis], + [0, 1, 2], + ) + if self.wl_style == "wno": wl = 1e4 / wl + + if np.all(np.diff(wl)) < 0: + wl = wl[::-1] + cross_section = cross_section[:, :, ::-1] + # reverse! return wl, T, P, cross_section +class loader_chimera(loader_base): + """ + loads in opacity data that are produced with the CHIMERA code. + """ + + class loader_helios(loader_base): """ loads in opacity data that are produced with the HELIOS ktable function. @@ -323,7 +352,8 @@ def get_lams_and_opacities(self, file): opacities = [] # read through all lines in the opacity file - for x in tqdm(f1, desc="reading wavelengths"): + # skip through the header! + for x in tqdm(f1[2:], desc="reading wavelengths"): # check if blank line if not x: continue @@ -333,13 +363,17 @@ def get_lams_and_opacities(self, file): wavelengths += [eval(x[:-1])] else: # the first entry in each opacity line is the pressure - opacity_string = commad.split(" ")[1:] + opacity_string = x.split()[1:] opacity_vals = np.array([eval(opacity) for opacity in opacity_string]) opacities += [opacity_vals] f.close() + # pdb.set_trace() del f1 - return np.array(wavelengths), np.array(opacities) + try: + return np.array(wavelengths), np.array(opacities) + except: + pdb.set_trace() def load(self, filename): """ diff --git a/src/cortecs/opac/opac.py b/src/cortecs/opac/opac.py index 9c5a322..bc6fbc6 100644 --- a/src/cortecs/opac/opac.py +++ b/src/cortecs/opac/opac.py @@ -18,7 +18,7 @@ class Opac(object): """ method_dict = { - "chimera": loader_base, + "chimera": loader_chimera, "helios": loader_helios, "platon": loader_platon, "exotransmit": loader_exotransmit, @@ -28,7 +28,12 @@ class Opac(object): T = None P = None - def __init__(self, filename, loader="chimera", load_kwargs={}): + def __init__( + self, + filename, + loader="chimera", + load_kwargs={}, + ): """ wraps around the loaders. diff --git a/src/cortecs/tests/opacCH4_narrow_wl.dat b/src/cortecs/tests/opacCH4_narrow_wl.dat new file mode 100644 index 0000000..79580e4 --- /dev/null +++ b/src/cortecs/tests/opacCH4_narrow_wl.dat @@ -0,0 +1,74 @@ +100.000 200.000 300.000 400.000 500.000 600.000 700.000 800.000 900.000 1000.000 1100.000 1200.000 1300.000 1400.000 1500.000 1600.000 1700.000 1800.000 1900.000 2000.000 2100.000 2200.000 2300.000 2400.000 2500.000 2600.000 2700.000 2800.000 2900.000 3000.000 +1.000000e-06 1.000000e-05 1.000000e-04 1.000000e-03 1.000000e-02 1.000000e-01 1.000000e+00 1.000000e+01 1.000000e+02 1.000000e+03 1.000000e+04 1.000000e+05 1.000000e+06 1.000000e+07 1.000000e+08 1.000000e+09 1.000000e+10 +2.30800000e-06 +-6.000000e+00 6.838134e-32 8.203243e-28 1.410898e-26 4.835716e-26 8.794202e-26 1.165002e-25 1.290736e-25 1.276877e-25 1.172344e-25 1.022992e-25 8.615519e-26 7.076034e-26 5.708740e-26 4.547611e-26 3.590599e-26 2.817857e-26 2.202764e-26 1.718003e-26 1.338552e-26 1.042864e-26 8.130804e-27 6.347648e-27 4.964427e-27 3.891001e-27 3.057124e-27 2.408348e-27 1.902624e-27 1.507537e-27 1.198130e-27 9.551871e-28 +-5.000000e+00 6.838134e-32 8.203243e-28 1.410898e-26 4.835716e-26 8.794202e-26 1.165002e-25 1.290736e-25 1.276877e-25 1.172344e-25 1.022992e-25 8.615519e-26 7.076034e-26 5.708740e-26 4.547611e-26 3.590599e-26 2.817857e-26 2.202764e-26 1.718003e-26 1.338552e-26 1.042864e-26 8.130804e-27 6.347648e-27 4.964427e-27 3.891001e-27 3.057124e-27 2.408348e-27 1.902624e-27 1.507537e-27 1.198130e-27 9.551871e-28 +-4.000000e+00 6.838134e-32 8.203243e-28 1.410898e-26 4.835716e-26 8.794202e-26 1.165002e-25 1.290736e-25 1.276877e-25 1.172344e-25 1.022992e-25 8.615519e-26 7.076034e-26 5.708740e-26 4.547611e-26 3.590599e-26 2.817857e-26 2.202764e-26 1.718003e-26 1.338552e-26 1.042864e-26 8.130804e-27 6.347648e-27 4.964427e-27 3.891001e-27 3.057124e-27 2.408348e-27 1.902624e-27 1.507537e-27 1.198130e-27 9.551871e-28 +-3.000000e+00 6.838139e-32 8.203243e-28 1.410898e-26 4.835716e-26 8.794202e-26 1.165002e-25 1.290736e-25 1.276877e-25 1.172344e-25 1.022992e-25 8.615519e-26 7.076033e-26 5.708740e-26 4.547611e-26 3.590599e-26 2.817857e-26 2.202764e-26 1.718003e-26 1.338552e-26 1.042864e-26 8.130804e-27 6.347648e-27 4.964427e-27 3.891001e-27 3.057124e-27 2.408348e-27 1.902624e-27 1.507537e-27 1.198130e-27 9.551871e-28 +-2.000000e+00 6.838192e-32 8.203239e-28 1.410897e-26 4.835714e-26 8.794199e-26 1.165002e-25 1.290735e-25 1.276877e-25 1.172343e-25 1.022992e-25 8.615517e-26 7.076032e-26 5.708739e-26 4.547611e-26 3.590599e-26 2.817857e-26 2.202763e-26 1.718003e-26 1.338552e-26 1.042864e-26 8.130804e-27 6.347648e-27 4.964427e-27 3.891001e-27 3.057123e-27 2.408348e-27 1.902624e-27 1.507537e-27 1.198130e-27 9.551870e-28 +-1.000000e+00 6.838717e-32 8.203201e-28 1.410890e-26 4.835693e-26 8.794169e-26 1.164998e-25 1.290732e-25 1.276874e-25 1.172341e-25 1.022990e-25 8.615501e-26 7.076020e-26 5.708730e-26 4.547604e-26 3.590594e-26 2.817853e-26 2.202761e-26 1.718001e-26 1.338551e-26 1.042863e-26 8.130796e-27 6.347642e-27 4.964423e-27 3.890998e-27 3.057121e-27 2.408347e-27 1.902622e-27 1.507536e-27 1.198129e-27 9.551864e-28 +0.000000e+00 6.843967e-32 8.202824e-28 1.410821e-26 4.835484e-26 8.793869e-26 1.164962e-25 1.290696e-25 1.276842e-25 1.172315e-25 1.022969e-25 8.615342e-26 7.075900e-26 5.708640e-26 4.547538e-26 3.590545e-26 2.817817e-26 2.202735e-26 1.717982e-26 1.338537e-26 1.042853e-26 8.130720e-27 6.347586e-27 4.964381e-27 3.890967e-27 3.057098e-27 2.408329e-27 1.902609e-27 1.507526e-27 1.198122e-27 9.551806e-28 +1.000000e+00 6.896410e-32 8.199056e-28 1.410125e-26 4.833403e-26 8.790871e-26 1.164603e-25 1.290341e-25 1.276526e-25 1.172053e-25 1.022762e-25 8.613748e-26 7.074702e-26 5.707746e-26 4.546878e-26 3.590059e-26 2.817461e-26 2.202474e-26 1.717792e-26 1.338397e-26 1.042750e-26 8.129964e-27 6.347026e-27 4.963965e-27 3.890657e-27 3.056866e-27 2.408155e-27 1.902477e-27 1.507426e-27 1.198046e-27 9.551223e-28 +2.000000e+00 7.415048e-32 8.161328e-28 1.403191e-26 4.812661e-26 8.760994e-26 1.161025e-25 1.286795e-25 1.273378e-25 1.169440e-25 1.020697e-25 8.597837e-26 7.062739e-26 5.698823e-26 4.540283e-26 3.585207e-26 2.813906e-26 2.199871e-26 1.715895e-26 1.337005e-26 1.041726e-26 8.122408e-27 6.341435e-27 4.959811e-27 3.887558e-27 3.054547e-27 2.406411e-27 1.901160e-27 1.506427e-27 1.197284e-27 9.545397e-28 +3.000000e+00 1.205208e-31 7.782727e-28 1.336311e-26 4.612633e-26 8.472810e-26 1.126337e-25 1.252312e-25 1.242672e-25 1.143904e-25 1.000479e-25 8.441797e-26 6.945268e-26 5.611095e-26 4.475394e-26 3.537416e-26 2.778863e-26 2.174192e-26 1.697171e-26 1.323252e-26 1.031606e-26 8.047710e-27 6.286133e-27 4.918708e-27 3.856889e-27 3.031589e-27 2.389139e-27 1.888109e-27 1.496525e-27 1.189737e-27 9.487612e-28 +4.000000e+00 3.476189e-26 4.852360e-28 8.699277e-27 3.185995e-26 6.418053e-26 8.669942e-26 9.861241e-26 9.997245e-26 9.377900e-26 8.347271e-26 7.144501e-26 5.957743e-26 4.865761e-26 3.919024e-26 3.124234e-26 2.473702e-26 1.949099e-26 1.532174e-26 1.201381e-26 9.414618e-27 7.379157e-27 5.788983e-27 4.547659e-27 3.578953e-27 2.822785e-27 2.231507e-27 1.768620e-27 1.405591e-27 1.120224e-27 8.953973e-28 +5.000000e+00 1.814249e-25 9.754384e-26 5.944388e-26 4.692292e-26 4.533501e-26 4.732561e-26 4.859110e-26 4.769260e-26 4.463546e-26 4.021841e-26 3.505725e-26 2.987176e-26 2.499710e-26 2.062054e-26 1.675508e-26 1.357510e-26 1.095731e-26 8.762003e-27 7.006146e-27 5.590155e-27 4.459645e-27 3.556894e-27 2.838261e-27 2.266964e-27 1.815099e-27 1.453975e-27 1.166567e-27 9.384041e-28 7.563394e-28 6.110248e-28 +6.000000e+00 1.048916e-25 5.711119e-26 4.023622e-26 3.522866e-26 3.552844e-26 3.688301e-26 3.711107e-26 3.588328e-26 3.323850e-26 2.965240e-26 2.567546e-26 2.179293e-26 1.816569e-26 1.494470e-26 1.216427e-26 9.799596e-27 7.883355e-27 6.316826e-27 5.047004e-27 4.026813e-27 3.213485e-27 2.561398e-27 2.044572e-27 1.633696e-27 1.307991e-27 1.048773e-27 8.428062e-28 6.785597e-28 5.476501e-28 4.425341e-28 +7.000000e+00 5.327404e-26 2.966799e-26 2.116890e-26 1.927980e-26 2.061392e-26 2.258932e-26 2.377983e-26 2.365018e-26 2.234660e-26 2.025772e-26 1.778075e-26 1.522469e-26 1.279219e-26 1.059560e-26 8.682239e-27 7.057744e-27 5.703888e-27 4.590837e-27 3.684853e-27 2.952761e-27 2.364261e-27 1.892895e-27 1.516231e-27 1.215670e-27 9.759644e-28 7.847754e-28 6.322194e-28 5.103616e-28 4.128966e-28 3.348129e-28 +8.000000e+00 6.872268e-27 4.150509e-27 3.179343e-27 3.154449e-27 3.680868e-27 4.334436e-27 4.827763e-27 5.024926e-27 4.932134e-27 4.620180e-27 4.174154e-27 3.667781e-27 3.154880e-27 2.669804e-27 2.231376e-27 1.847443e-27 1.518801e-27 1.242151e-27 1.012134e-27 8.226409e-28 6.675874e-28 5.413393e-28 4.389032e-28 3.559826e-28 2.889558e-28 2.348144e-28 1.910863e-28 1.557556e-28 1.271881e-28 1.040644e-28 +9.000000e+00 6.900109e-28 4.178419e-28 3.210088e-28 3.197710e-28 3.748538e-28 4.433483e-28 4.957926e-28 5.179697e-28 5.102058e-28 4.795604e-28 4.346889e-28 3.831769e-28 3.306209e-28 2.806389e-28 2.352527e-28 1.953445e-28 1.610555e-28 1.320905e-28 1.079287e-28 8.796119e-29 7.157350e-29 5.819145e-29 4.730280e-29 3.846441e-29 3.130100e-29 2.549959e-29 2.080199e-29 1.699700e-29 1.391281e-29 1.141030e-29 +1.000000e+01 6.900390e-29 4.178703e-29 3.210403e-29 3.198157e-29 3.749246e-29 4.434530e-29 4.959315e-29 5.181364e-29 5.103904e-29 4.797526e-29 4.348797e-29 3.833595e-29 3.307907e-29 2.807933e-29 2.353907e-29 1.954661e-29 1.611615e-29 1.321821e-29 1.080074e-29 8.802838e-30 7.163066e-30 5.823994e-30 4.734384e-30 3.849909e-30 3.133029e-30 2.552431e-30 2.082286e-30 1.701462e-30 1.392770e-30 1.142289e-30 +2.30800231e-06 +-6.000000e+00 5.090092e-31 1.400613e-27 1.988334e-26 6.255972e-26 1.083517e-25 1.391128e-25 1.508171e-25 1.468416e-25 1.331885e-25 1.151092e-25 9.619358e-26 7.850219e-26 6.299767e-26 4.996087e-26 3.929856e-26 3.074255e-26 2.396663e-26 1.864898e-26 1.450126e-26 1.127878e-26 8.780874e-27 6.846632e-27 5.348963e-27 4.188542e-27 3.288293e-27 2.588685e-27 2.043874e-27 1.618614e-27 1.285822e-27 1.024683e-27 +-5.000000e+00 5.090092e-31 1.400613e-27 1.988334e-26 6.255972e-26 1.083517e-25 1.391128e-25 1.508171e-25 1.468416e-25 1.331885e-25 1.151092e-25 9.619358e-26 7.850219e-26 6.299767e-26 4.996087e-26 3.929856e-26 3.074255e-26 2.396663e-26 1.864898e-26 1.450126e-26 1.127878e-26 8.780874e-27 6.846632e-27 5.348963e-27 4.188542e-27 3.288293e-27 2.588685e-27 2.043874e-27 1.618614e-27 1.285822e-27 1.024683e-27 +-4.000000e+00 5.090092e-31 1.400613e-27 1.988334e-26 6.255972e-26 1.083517e-25 1.391128e-25 1.508171e-25 1.468416e-25 1.331885e-25 1.151092e-25 9.619358e-26 7.850219e-26 6.299767e-26 4.996087e-26 3.929856e-26 3.074255e-26 2.396663e-26 1.864898e-26 1.450126e-26 1.127878e-26 8.780874e-27 6.846632e-27 5.348963e-27 4.188542e-27 3.288293e-27 2.588685e-27 2.043874e-27 1.618614e-27 1.285822e-27 1.024683e-27 +-3.000000e+00 5.090092e-31 1.400613e-27 1.988333e-26 6.255971e-26 1.083517e-25 1.391128e-25 1.508171e-25 1.468416e-25 1.331885e-25 1.151092e-25 9.619358e-26 7.850219e-26 6.299767e-26 4.996087e-26 3.929856e-26 3.074255e-26 2.396663e-26 1.864898e-26 1.450126e-26 1.127878e-26 8.780874e-27 6.846632e-27 5.348963e-27 4.188542e-27 3.288293e-27 2.588685e-27 2.043874e-27 1.618614e-27 1.285822e-27 1.024683e-27 +-2.000000e+00 5.090096e-31 1.400612e-27 1.988332e-26 6.255968e-26 1.083516e-25 1.391128e-25 1.508171e-25 1.468415e-25 1.331885e-25 1.151091e-25 9.619356e-26 7.850217e-26 6.299765e-26 4.996086e-26 3.929856e-26 3.074254e-26 2.396662e-26 1.864898e-26 1.450126e-26 1.127878e-26 8.780873e-27 6.846631e-27 5.348962e-27 4.188542e-27 3.288293e-27 2.588684e-27 2.043874e-27 1.618614e-27 1.285822e-27 1.024683e-27 +-1.000000e+00 5.090130e-31 1.400596e-27 1.988316e-26 6.255931e-26 1.083511e-25 1.391123e-25 1.508166e-25 1.468411e-25 1.331882e-25 1.151089e-25 9.619336e-26 7.850203e-26 6.299755e-26 4.996078e-26 3.929850e-26 3.074250e-26 2.396659e-26 1.864896e-26 1.450124e-26 1.127876e-26 8.780865e-27 6.846625e-27 5.348957e-27 4.188538e-27 3.288290e-27 2.588682e-27 2.043872e-27 1.618613e-27 1.285821e-27 1.024682e-27 +0.000000e+00 5.090478e-31 1.400440e-27 1.988162e-26 6.255563e-26 1.083463e-25 1.391070e-25 1.508117e-25 1.468369e-25 1.331848e-25 1.151063e-25 9.619141e-26 7.850057e-26 6.299648e-26 4.996000e-26 3.929793e-26 3.074209e-26 2.396629e-26 1.864874e-26 1.450108e-26 1.127865e-26 8.780780e-27 6.846562e-27 5.348911e-27 4.188504e-27 3.288264e-27 2.588663e-27 2.043858e-27 1.618602e-27 1.285812e-27 1.024675e-27 +1.000000e+00 5.093937e-31 1.398886e-27 1.986616e-26 6.251885e-26 1.082983e-25 1.390545e-25 1.507626e-25 1.467951e-25 1.331513e-25 1.150803e-25 9.617182e-26 7.848604e-26 6.298579e-26 4.995219e-26 3.929225e-26 3.073796e-26 2.396330e-26 1.864657e-26 1.449950e-26 1.127749e-26 8.779928e-27 6.845934e-27 5.348446e-27 4.188158e-27 3.288006e-27 2.588470e-27 2.043712e-27 1.618491e-27 1.285728e-27 1.024611e-27 +2.000000e+00 5.127194e-31 1.383496e-27 1.971269e-26 6.215304e-26 1.078197e-25 1.385317e-25 1.502734e-25 1.463779e-25 1.328166e-25 1.148210e-25 9.597640e-26 7.834094e-26 6.287913e-26 4.987424e-26 3.923555e-26 3.069677e-26 2.393345e-26 1.862488e-26 1.448367e-26 1.126591e-26 8.771425e-27 6.839667e-27 5.343806e-27 4.184710e-27 3.285430e-27 2.586536e-27 2.042254e-27 1.617387e-27 1.284887e-27 1.023968e-27 +3.000000e+00 5.343483e-31 1.243795e-27 1.827952e-26 5.868322e-26 1.032483e-25 1.334976e-25 1.455374e-25 1.423232e-25 1.295544e-25 1.122880e-25 9.406361e-26 7.691837e-26 6.183194e-26 4.910795e-26 3.867763e-26 3.029107e-26 2.363917e-26 1.841092e-26 1.432745e-26 1.115156e-26 8.687392e-27 6.777695e-27 5.297899e-27 4.150579e-27 3.259921e-27 2.567383e-27 2.027809e-27 1.606439e-27 1.276551e-27 1.017591e-27 +4.000000e+00 3.781696e-26 5.824124e-28 1.016216e-26 3.669994e-26 7.295211e-26 9.778998e-26 1.103818e-25 1.112007e-25 1.038770e-25 9.192857e-26 7.842998e-26 6.512249e-26 5.303936e-26 4.260243e-26 3.389561e-26 2.678392e-26 2.107655e-26 1.653511e-26 1.294897e-26 1.013655e-26 7.937454e-27 6.221869e-27 4.884237e-27 3.841717e-27 3.028151e-27 2.392704e-27 1.895604e-27 1.505910e-27 1.199766e-27 9.586828e-28 +5.000000e+00 1.889021e-25 1.028288e-25 6.304677e-26 4.968336e-26 4.778173e-26 4.964323e-26 5.086671e-26 4.993976e-26 4.672139e-26 4.209164e-26 3.670942e-26 3.131318e-26 2.620416e-26 2.162836e-26 1.767800e-26 1.429609e-26 1.151079e-26 9.206280e-27 7.363759e-27 5.880896e-27 4.689890e-27 3.741391e-27 2.986086e-27 2.388197e-27 1.910244e-27 1.530398e-27 1.228356e-27 9.879416e-28 7.963308e-28 6.434204e-28 +6.000000e+00 1.051665e-25 5.729202e-26 4.038899e-26 3.539362e-26 3.573019e-26 3.713357e-26 3.738721e-26 3.617580e-26 3.353271e-26 2.993083e-26 2.593106e-26 2.202050e-26 1.836411e-26 1.511457e-26 1.230855e-26 9.919432e-27 7.982745e-27 6.398799e-27 5.114559e-27 4.081795e-27 3.258356e-27 2.597963e-27 2.074348e-27 1.658077e-27 1.327966e-27 1.064882e-27 8.559499e-28 6.893747e-28 5.564407e-28 4.497389e-28 +7.000000e+00 5.329011e-26 2.968036e-26 2.117975e-26 1.929130e-26 2.062769e-26 2.260580e-26 2.379844e-26 2.366983e-26 2.236616e-26 2.027628e-26 1.779774e-26 1.523980e-26 1.280534e-26 1.060684e-26 8.691735e-27 7.065683e-27 5.710477e-27 4.596274e-27 3.689321e-27 2.956423e-27 2.367257e-27 1.895344e-27 1.518231e-27 1.217304e-27 9.773003e-28 7.858684e-28 6.331149e-28 5.110963e-28 4.135004e-28 3.353099e-28 +8.000000e+00 6.872306e-27 4.150548e-27 3.179385e-27 3.154505e-27 3.680950e-27 4.334553e-27 4.827914e-27 5.025104e-27 4.932327e-27 4.620378e-27 4.174348e-27 3.667964e-27 3.155049e-27 2.669955e-27 2.231509e-27 1.847559e-27 1.518902e-27 1.242237e-27 1.012207e-27 8.227026e-28 6.676394e-28 5.413830e-28 4.389398e-28 3.560132e-28 2.889814e-28 2.348359e-28 1.911042e-28 1.557706e-28 1.272007e-28 1.040749e-28 +9.000000e+00 6.900109e-28 4.178420e-28 3.210089e-28 3.197710e-28 3.748539e-28 4.433484e-28 4.957927e-28 5.179699e-28 5.102060e-28 4.795606e-28 4.346891e-28 3.831771e-28 3.306211e-28 2.806391e-28 2.352529e-28 1.953446e-28 1.610557e-28 1.320906e-28 1.079288e-28 8.796127e-29 7.157357e-29 5.819151e-29 4.730285e-29 3.846445e-29 3.130104e-29 2.549962e-29 2.080202e-29 1.699702e-29 1.391283e-29 1.141032e-29 +1.000000e+01 6.900390e-29 4.178703e-29 3.210403e-29 3.198157e-29 3.749246e-29 4.434530e-29 4.959315e-29 5.181364e-29 5.103904e-29 4.797526e-29 4.348797e-29 3.833595e-29 3.307907e-29 2.807933e-29 2.353907e-29 1.954661e-29 1.611615e-29 1.321822e-29 1.080074e-29 8.802838e-30 7.163066e-30 5.823994e-30 4.734384e-30 3.849909e-30 3.133029e-30 2.552431e-30 2.082286e-30 1.701462e-30 1.392770e-30 1.142289e-30 +2.30800461e-06 +-6.000000e+00 1.580171e-30 1.060852e-27 1.587398e-26 5.298616e-26 9.552952e-26 1.261263e-25 1.395359e-25 1.379435e-25 1.266096e-25 1.104687e-25 9.304286e-26 7.643684e-26 6.169375e-26 4.917536e-26 3.885664e-26 3.052216e-26 2.388460e-26 1.864978e-26 1.454860e-26 1.134950e-26 8.860607e-27 6.926812e-27 5.424787e-27 4.257590e-27 3.349616e-27 2.642208e-27 2.090011e-27 1.658025e-27 1.319263e-27 1.052921e-27 +-5.000000e+00 1.580171e-30 1.060852e-27 1.587398e-26 5.298616e-26 9.552952e-26 1.261263e-25 1.395359e-25 1.379435e-25 1.266096e-25 1.104687e-25 9.304286e-26 7.643684e-26 6.169375e-26 4.917536e-26 3.885664e-26 3.052216e-26 2.388460e-26 1.864978e-26 1.454860e-26 1.134950e-26 8.860607e-27 6.926812e-27 5.424787e-27 4.257590e-27 3.349616e-27 2.642208e-27 2.090011e-27 1.658025e-27 1.319263e-27 1.052921e-27 +-4.000000e+00 1.580171e-30 1.060852e-27 1.587398e-26 5.298616e-26 9.552951e-26 1.261263e-25 1.395359e-25 1.379435e-25 1.266096e-25 1.104687e-25 9.304286e-26 7.643684e-26 6.169375e-26 4.917536e-26 3.885664e-26 3.052216e-26 2.388460e-26 1.864978e-26 1.454860e-26 1.134950e-26 8.860607e-27 6.926812e-27 5.424787e-27 4.257590e-27 3.349616e-27 2.642208e-27 2.090011e-27 1.658025e-27 1.319263e-27 1.052921e-27 +-3.000000e+00 1.580171e-30 1.060852e-27 1.587398e-26 5.298615e-26 9.552951e-26 1.261263e-25 1.395359e-25 1.379435e-25 1.266096e-25 1.104687e-25 9.304285e-26 7.643684e-26 6.169375e-26 4.917536e-26 3.885663e-26 3.052216e-26 2.388460e-26 1.864978e-26 1.454860e-26 1.134950e-26 8.860607e-27 6.926812e-27 5.424787e-27 4.257590e-27 3.349616e-27 2.642208e-27 2.090011e-27 1.658025e-27 1.319263e-27 1.052921e-27 +-2.000000e+00 1.580168e-30 1.060851e-27 1.587397e-26 5.298613e-26 9.552948e-26 1.261263e-25 1.395358e-25 1.379435e-25 1.266096e-25 1.104687e-25 9.304284e-26 7.643683e-26 6.169374e-26 4.917535e-26 3.885663e-26 3.052216e-26 2.388460e-26 1.864978e-26 1.454860e-26 1.134950e-26 8.860606e-27 6.926811e-27 5.424786e-27 4.257590e-27 3.349616e-27 2.642208e-27 2.090011e-27 1.658024e-27 1.319263e-27 1.052921e-27 +-1.000000e+00 1.580144e-30 1.060844e-27 1.587388e-26 5.298594e-26 9.552914e-26 1.261259e-25 1.395355e-25 1.379431e-25 1.266093e-25 1.104685e-25 9.304267e-26 7.643670e-26 6.169365e-26 4.917528e-26 3.885658e-26 3.052212e-26 2.388457e-26 1.864976e-26 1.454859e-26 1.134949e-26 8.860599e-27 6.926806e-27 5.424782e-27 4.257586e-27 3.349613e-27 2.642206e-27 2.090009e-27 1.658023e-27 1.319262e-27 1.052920e-27 +0.000000e+00 1.579898e-30 1.060769e-27 1.587299e-26 5.298401e-26 9.552578e-26 1.261219e-25 1.395316e-25 1.379397e-25 1.266065e-25 1.104662e-25 9.304097e-26 7.643542e-26 6.169270e-26 4.917459e-26 3.885607e-26 3.052175e-26 2.388430e-26 1.864956e-26 1.454844e-26 1.134938e-26 8.860520e-27 6.926747e-27 5.424738e-27 4.257554e-27 3.349589e-27 2.642187e-27 2.089995e-27 1.658013e-27 1.319254e-27 1.052914e-27 +1.000000e+00 1.577445e-30 1.060022e-27 1.586409e-26 5.296467e-26 9.549218e-26 1.260824e-25 1.394928e-25 1.379055e-25 1.265784e-25 1.104440e-25 9.302402e-26 7.642267e-26 6.168324e-26 4.916762e-26 3.885096e-26 3.051802e-26 2.388158e-26 1.864758e-26 1.454699e-26 1.134831e-26 8.859729e-27 6.926162e-27 5.424303e-27 4.257229e-27 3.349345e-27 2.642003e-27 2.089856e-27 1.657907e-27 1.319173e-27 1.052851e-27 +2.000000e+00 1.553235e-30 1.052592e-27 1.577552e-26 5.277235e-26 9.515754e-26 1.256882e-25 1.391057e-25 1.375639e-25 1.262978e-25 1.102225e-25 9.285488e-26 7.629541e-26 6.158879e-26 4.909812e-26 3.879999e-26 3.048076e-26 2.385449e-26 1.862775e-26 1.453245e-26 1.133762e-26 8.851838e-27 6.920315e-27 5.419956e-27 4.253980e-27 3.346906e-27 2.640165e-27 2.088463e-27 1.656846e-27 1.318362e-27 1.052229e-27 +3.000000e+00 1.339780e-30 9.818826e-28 1.493055e-26 5.094593e-26 9.193849e-26 1.218734e-25 1.353452e-25 1.342354e-25 1.235573e-25 1.080541e-25 9.119685e-26 7.504615e-26 6.066049e-26 4.841423e-26 3.829797e-26 3.011345e-26 2.358724e-26 1.843199e-26 1.438882e-26 1.123190e-26 8.773789e-27 6.862454e-27 5.376917e-27 4.221803e-27 3.322742e-27 2.621938e-27 2.074649e-27 1.646328e-27 1.310317e-27 1.046046e-27 +4.000000e+00 4.129187e-26 5.490776e-28 9.412187e-27 3.981549e-26 6.946583e-26 9.371465e-26 1.065671e-25 1.080679e-25 1.015724e-25 9.034846e-26 7.746696e-26 6.456481e-26 5.278331e-26 4.255273e-26 3.395567e-26 2.691051e-26 2.124125e-26 1.670179e-26 1.311148e-26 1.028632e-26 8.071990e-27 6.339632e-27 4.986297e-27 3.928542e-27 3.101652e-27 2.454580e-27 1.947381e-27 1.549120e-27 1.235747e-27 9.885869e-28 +5.000000e+00 1.966774e-25 1.084665e-25 6.692804e-26 5.261095e-26 5.022823e-26 5.184726e-26 5.291363e-26 5.183358e-26 4.850404e-26 4.361129e-26 3.804137e-26 3.243631e-26 2.714364e-26 2.243016e-26 1.831765e-26 1.481705e-26 1.193160e-26 9.571696e-27 7.637488e-27 6.099789e-27 4.867668e-27 3.882225e-27 3.102765e-27 2.479038e-27 1.983258e-27 1.589170e-27 1.275733e-27 1.026202e-27 8.273481e-28 6.685272e-28 +6.000000e+00 1.054412e-25 5.747205e-26 4.054057e-26 3.555733e-26 3.593219e-26 3.737618e-26 3.778196e-26 3.646833e-26 3.382696e-26 3.020915e-26 2.618656e-26 2.225202e-26 1.856321e-26 1.528502e-26 1.245262e-26 1.005824e-26 8.082664e-27 6.481210e-27 5.182241e-27 4.137160e-27 3.303560e-27 2.634879e-27 2.104382e-27 1.682534e-27 1.347898e-27 1.081137e-27 8.692206e-28 7.002229e-28 5.653812e-28 4.570224e-28 +7.000000e+00 5.330617e-26 2.969273e-26 2.119059e-26 1.930280e-26 2.064146e-26 2.262227e-26 2.381705e-26 2.368947e-26 2.238571e-26 2.029484e-26 1.781472e-26 1.525490e-26 1.281847e-26 1.061808e-26 8.701224e-27 7.073617e-27 5.717061e-27 4.601707e-27 3.693787e-27 2.960083e-27 2.370251e-27 1.897790e-27 1.520229e-27 1.218937e-27 9.786349e-28 7.869604e-28 6.340095e-28 5.118302e-28 4.141035e-28 3.358065e-28 +8.000000e+00 6.872344e-27 4.150587e-27 3.179427e-27 3.154560e-27 3.681033e-27 4.334670e-27 4.828065e-27 5.025281e-27 4.932521e-27 4.620576e-27 4.174542e-27 3.668147e-27 3.155217e-27 2.670106e-27 2.231643e-27 1.847676e-27 1.519002e-27 1.242323e-27 1.012280e-27 8.227642e-28 6.676914e-28 5.414266e-28 4.389764e-28 3.560439e-28 2.890070e-28 2.348573e-28 1.911221e-28 1.557856e-28 1.272133e-28 1.040854e-28 +9.000000e+00 6.900109e-28 4.178420e-28 3.210089e-28 3.197711e-28 3.748540e-28 4.433485e-28 4.957929e-28 5.179701e-28 5.102062e-28 4.795609e-28 4.346894e-28 3.831773e-28 3.306213e-28 2.806393e-28 2.352531e-28 1.953448e-28 1.610558e-28 1.320907e-28 1.079289e-28 8.796135e-29 7.157364e-29 5.819157e-29 4.730290e-29 3.846449e-29 3.130107e-29 2.549964e-29 2.080204e-29 1.699704e-29 1.391285e-29 1.141034e-29 +1.000000e+01 6.900390e-29 4.178703e-29 3.210403e-29 3.198157e-29 3.749246e-29 4.434530e-29 4.959315e-29 5.181364e-29 5.103904e-29 4.797526e-29 4.348797e-29 3.833595e-29 3.307907e-29 2.807933e-29 2.353907e-29 1.954661e-29 1.611615e-29 1.321822e-29 1.080074e-29 8.802838e-30 7.163066e-30 5.823994e-30 4.734384e-30 3.849909e-30 3.133029e-30 2.552431e-30 2.082286e-30 1.701462e-30 1.392770e-30 1.142289e-30 +2.30800692e-06 +-6.000000e+00 1.100051e-30 3.990788e-28 7.595551e-27 3.075774e-26 6.254792e-26 8.946846e-26 1.047702e-25 1.080699e-25 1.025290e-25 9.187660e-26 7.911199e-26 6.621891e-26 5.431429e-26 4.390640e-26 3.512670e-26 2.789899e-26 2.204931e-26 1.737120e-26 1.366118e-26 1.073575e-26 8.437683e-27 6.636577e-27 5.226587e-27 4.123072e-27 3.259044e-27 2.581872e-27 2.050399e-27 1.632549e-27 1.303370e-27 1.043470e-27 +-5.000000e+00 1.100051e-30 3.990788e-28 7.595551e-27 3.075774e-26 6.254792e-26 8.946846e-26 1.047702e-25 1.080699e-25 1.025290e-25 9.187660e-26 7.911199e-26 6.621891e-26 5.431429e-26 4.390640e-26 3.512670e-26 2.789899e-26 2.204931e-26 1.737120e-26 1.366118e-26 1.073575e-26 8.437683e-27 6.636577e-27 5.226587e-27 4.123072e-27 3.259044e-27 2.581872e-27 2.050399e-27 1.632549e-27 1.303370e-27 1.043470e-27 +-4.000000e+00 1.100051e-30 3.990788e-28 7.595551e-27 3.075774e-26 6.254792e-26 8.946846e-26 1.047702e-25 1.080699e-25 1.025290e-25 9.187660e-26 7.911199e-26 6.621891e-26 5.431429e-26 4.390640e-26 3.512670e-26 2.789899e-26 2.204931e-26 1.737120e-26 1.366118e-26 1.073575e-26 8.437683e-27 6.636577e-27 5.226587e-27 4.123072e-27 3.259044e-27 2.581872e-27 2.050399e-27 1.632549e-27 1.303370e-27 1.043470e-27 +-3.000000e+00 1.100051e-30 3.990789e-28 7.595551e-27 3.075774e-26 6.254791e-26 8.946845e-26 1.047702e-25 1.080699e-25 1.025290e-25 9.187660e-26 7.911199e-26 6.621891e-26 5.431429e-26 4.390640e-26 3.512670e-26 2.789899e-26 2.204931e-26 1.737120e-26 1.366118e-26 1.073575e-26 8.437683e-27 6.636577e-27 5.226587e-27 4.123071e-27 3.259044e-27 2.581872e-27 2.050399e-27 1.632549e-27 1.303370e-27 1.043470e-27 +-2.000000e+00 1.100050e-30 3.990792e-28 7.595553e-27 3.075775e-26 6.254791e-26 8.946844e-26 1.047702e-25 1.080698e-25 1.025290e-25 9.187658e-26 7.911198e-26 6.621890e-26 5.431429e-26 4.390640e-26 3.512669e-26 2.789899e-26 2.204931e-26 1.737120e-26 1.366118e-26 1.073575e-26 8.437682e-27 6.636577e-27 5.226587e-27 4.123071e-27 3.259044e-27 2.581872e-27 2.050399e-27 1.632549e-27 1.303370e-27 1.043469e-27 +-1.000000e+00 1.100040e-30 3.990826e-28 7.595572e-27 3.075780e-26 6.254788e-26 8.946834e-26 1.047700e-25 1.080697e-25 1.025289e-25 9.187647e-26 7.911189e-26 6.621883e-26 5.431423e-26 4.390635e-26 3.512666e-26 2.789896e-26 2.204929e-26 1.737119e-26 1.366117e-26 1.073574e-26 8.437676e-27 6.636572e-27 5.226583e-27 4.123069e-27 3.259042e-27 2.581870e-27 2.050398e-27 1.632548e-27 1.303370e-27 1.043469e-27 +0.000000e+00 1.099940e-30 3.991163e-28 7.595762e-27 3.075830e-26 6.254757e-26 8.946733e-26 1.047686e-25 1.080682e-25 1.025275e-25 9.187530e-26 7.911094e-26 6.621807e-26 5.431364e-26 4.390591e-26 3.512632e-26 2.789871e-26 2.204910e-26 1.737105e-26 1.366106e-26 1.073566e-26 8.437616e-27 6.636527e-27 5.226549e-27 4.123043e-27 3.259023e-27 2.581855e-27 2.050386e-27 1.632539e-27 1.303363e-27 1.043464e-27 +1.000000e+00 1.098942e-30 3.994528e-28 7.597656e-27 3.076331e-26 6.254441e-26 8.945723e-26 1.047547e-25 1.080536e-25 1.025139e-25 9.186367e-26 7.910140e-26 6.621053e-26 5.430779e-26 4.390144e-26 3.512295e-26 2.789619e-26 2.204722e-26 1.736963e-26 1.366001e-26 1.073487e-26 8.437019e-27 6.636078e-27 5.226209e-27 4.122785e-27 3.258826e-27 2.581705e-27 2.050271e-27 1.632450e-27 1.303294e-27 1.043410e-27 +2.000000e+00 1.089005e-30 4.027499e-28 7.616154e-27 3.081281e-26 6.251250e-26 8.935612e-26 1.046159e-25 1.079075e-25 1.023777e-25 9.174749e-26 7.900619e-26 6.613516e-26 5.424938e-26 4.385688e-26 3.508926e-26 2.787106e-26 2.202837e-26 1.735552e-26 1.364943e-26 1.072694e-26 8.431055e-27 6.631584e-27 5.222810e-27 4.120205e-27 3.256861e-27 2.580202e-27 2.049117e-27 1.631562e-27 1.302606e-27 1.042876e-27 +3.000000e+00 9.940901e-31 4.295185e-28 7.760273e-27 3.125404e-26 6.215882e-26 8.833546e-26 1.032346e-25 1.064614e-25 1.010330e-25 9.060068e-26 7.806637e-26 6.539102e-26 5.367241e-26 4.341645e-26 3.475619e-26 2.762246e-26 2.184183e-26 1.721579e-26 1.354467e-26 1.064833e-26 8.371917e-27 6.587021e-27 5.189091e-27 4.094603e-27 3.237358e-27 2.565284e-27 2.037662e-27 1.622732e-27 1.295773e-27 1.037567e-27 +4.000000e+00 4.526687e-26 4.224026e-28 7.217706e-27 3.303819e-26 5.721408e-26 7.828737e-26 9.061611e-26 9.360912e-26 8.919087e-26 8.052923e-26 6.979390e-26 5.881551e-26 4.854933e-26 3.948598e-26 3.176866e-26 2.538336e-26 2.015357e-26 1.594535e-26 1.258812e-26 9.927679e-27 7.827758e-27 6.175581e-27 4.876776e-27 3.856779e-27 3.055690e-27 2.425979e-27 1.930446e-27 1.539910e-27 1.231547e-27 9.875717e-28 +5.000000e+00 2.047447e-25 1.144760e-25 7.111134e-26 5.572630e-26 5.271840e-26 5.394819e-26 5.473500e-26 5.342169e-26 4.992211e-26 4.479652e-26 3.901937e-26 3.324970e-26 2.781668e-26 2.297789e-26 1.876309e-26 1.520032e-26 1.222489e-26 9.804061e-27 7.843777e-27 6.249169e-27 4.987580e-27 3.983446e-27 3.180306e-27 2.541451e-27 2.033575e-27 1.629792e-27 1.308590e-27 1.052906e-27 8.489777e-28 6.861317e-28 +6.000000e+00 1.057157e-25 5.765127e-26 4.069127e-26 3.572245e-26 3.613200e-26 3.761775e-26 3.806454e-26 3.676214e-26 3.411859e-26 3.050759e-26 2.644220e-26 2.248037e-26 1.876250e-26 1.545595e-26 1.259720e-26 1.018013e-26 8.184460e-27 6.564319e-27 5.255208e-27 4.197649e-27 3.349076e-27 2.672004e-27 2.135741e-27 1.707877e-27 1.368009e-27 1.097537e-27 8.826149e-28 7.111761e-28 5.743567e-28 4.646447e-28 +7.000000e+00 5.332222e-26 2.970508e-26 2.120143e-26 1.931429e-26 2.065523e-26 2.263873e-26 2.383564e-26 2.370910e-26 2.240525e-26 2.031339e-26 1.783169e-26 1.526999e-26 1.283160e-26 1.062931e-26 8.710707e-27 7.081545e-27 5.723640e-27 4.607136e-27 3.698249e-27 2.963740e-27 2.373242e-27 1.900234e-27 1.522235e-27 1.220568e-27 9.799682e-28 7.880514e-28 6.349032e-28 5.125634e-28 4.147060e-28 3.363025e-28 +8.000000e+00 6.872382e-27 4.150626e-27 3.179469e-27 3.154616e-27 3.681115e-27 4.334787e-27 4.828216e-27 5.025458e-27 4.932713e-27 4.620774e-27 4.174735e-27 3.668330e-27 3.155385e-27 2.670258e-27 2.231776e-27 1.847792e-27 1.519103e-27 1.242409e-27 1.012353e-27 8.228259e-28 6.677433e-28 5.414702e-28 4.390129e-28 3.560745e-28 2.890326e-28 2.348787e-28 1.911401e-28 1.558006e-28 1.272258e-28 1.040960e-28 +9.000000e+00 6.900110e-28 4.178421e-28 3.210089e-28 3.197712e-28 3.748541e-28 4.433487e-28 4.957931e-28 5.179703e-28 5.102065e-28 4.795611e-28 4.346896e-28 3.831775e-28 3.306215e-28 2.806394e-28 2.352532e-28 1.953449e-28 1.610559e-28 1.320908e-28 1.079290e-28 8.796143e-29 7.157371e-29 5.819163e-29 4.730295e-29 3.846453e-29 3.130110e-29 2.549967e-29 2.080207e-29 1.699706e-29 1.391287e-29 1.141035e-29 +1.000000e+01 6.900390e-29 4.178703e-29 3.210403e-29 3.198157e-29 3.749246e-29 4.434530e-29 4.959315e-29 5.181364e-29 5.103904e-29 4.797526e-29 4.348797e-29 3.833595e-29 3.307907e-29 2.807933e-29 2.353907e-29 1.954661e-29 1.611615e-29 1.321822e-29 1.080074e-29 8.802838e-30 7.163066e-30 5.823994e-30 4.734384e-30 3.849909e-30 3.133029e-30 2.552431e-30 2.082286e-30 1.701462e-30 1.392770e-30 1.142289e-30 diff --git a/src/cortecs/tests/test_chunking.py b/src/cortecs/tests/test_chunking.py new file mode 100644 index 0000000..f1c072b --- /dev/null +++ b/src/cortecs/tests/test_chunking.py @@ -0,0 +1,159 @@ +""" +just do a few tests for chunking... +""" +import unittest +import os +import numpy as np +from cortecs.opac.chunking import chunk_wavelengths, add_overlap +from cortecs.opac.opac import Opac + + +class TestIntegration(unittest.TestCase): + opacity_file = os.path.abspath(".") + "/src/cortecs/tests/opacCH4_narrow_wl.dat" + first_file = os.path.abspath(".") + "/src/cortecs/tests/" + "opacCH4_narrow_wl0.dat" + second_file = ( + os.path.abspath(".") + "/src/cortecs/tests/" + "opacCH4_narrow_wl1.dat" + ) + file_base = os.path.abspath(".") + "/src/cortecs/tests/" + "opacCH4_narrow_wl" + + def test_chunking_two_files(self): + """ + Test the chunking function. + """ + chunk_wavelengths( + self.opacity_file, wav_per_chunk=2 + ) # evenly split into two chunks + + # now test that the two files were created + + self.assertTrue( + os.path.exists(self.first_file) and os.path.exists(self.second_file) + ) + + def test_wls_of_each_created_file(self): + """ + Test that the number of wavelengths in each file is EXACTLY the same. + """ + # clean up the files already made!! + os.remove(self.first_file) + os.remove(self.second_file) + + chunk_wavelengths(self.opacity_file, wav_per_chunk=2) + + # now get the wavelengths of each file + opac_obj_ref = Opac(self.opacity_file, loader="exotransmit") + opac_obj0 = Opac( + self.first_file, + loader="exotransmit", + ) + opac_obj1 = Opac( + self.second_file, + loader="exotransmit", + ) + np.testing.assert_array_equal( + opac_obj_ref.wl, np.concatenate((opac_obj0.wl, opac_obj1.wl)) + ) + + def test_vals_of_each_created_file(self): + """ + Test that the opacity values together are concatenated! + """ + # clean up the files already made!! + os.remove(self.first_file) + os.remove(self.second_file) + + chunk_wavelengths(self.opacity_file, wav_per_chunk=2) + + # now get the wavelengths of each file + opac_obj_ref = Opac(self.opacity_file, loader="exotransmit") + opac_obj0 = Opac( + self.first_file, + loader="exotransmit", + ) + opac_obj1 = Opac( + self.second_file, + loader="exotransmit", + ) + # pdb.set_trace() + np.testing.assert_array_equal( + opac_obj_ref.cross_section, + np.concatenate((opac_obj0.cross_section, opac_obj1.cross_section)), + ) + + # self.assertEqual(opac_obj_ref.wl), len(opac_obj0.wl) + len(opac_obj1.wl)) + + def test_add_overlap_wl_increase_or_same(self): + """ + Test that the overlap is added to the end of the first file. + """ + # clean up the files already made!! + # os.remove(self.first_file) + # os.remove(self.second_file) + + chunk_wavelengths(self.opacity_file, wav_per_chunk=2) + opac_obj0_orig = Opac( + self.first_file, + loader="exotransmit", + ) + opac_obj1_orig = Opac( + self.second_file, + loader="exotransmit", + ) + + add_overlap(self.file_base, v_max=0.0) + + # now get the wavelengths of each file + opac_obj_ref = Opac(self.opacity_file, loader="exotransmit") + opac_obj0 = Opac( + self.first_file, + loader="exotransmit", + ) + opac_obj1 = Opac( + self.second_file, + loader="exotransmit", + ) + # pdb.set_trace() + self.assertTrue( + len(opac_obj0.wl) >= len(opac_obj0_orig.wl) + and len(opac_obj1.wl) >= len(opac_obj1_orig.wl) + ) + + def add_overlap_with_single_overlap_point(self): + """ + just overlap a single point and make sure that works. + :return: + """ + # os.remove(self.first_file) + # os.remove(self.second_file) + + chunk_wavelengths(self.opacity_file, wav_per_chunk=2) + opac_obj0_orig = Opac( + self.first_file, + loader="exotransmit", + ) + opac_obj1_orig = Opac( + self.second_file, + loader="exotransmit", + ) + + # calculate the vmax so that one point is changed + # velocity is C * delta lambda over lambda + c = 3e8 + max_curr_lam = np.max(opac_obj0_orig.wl) + v_max = c * (opac_obj1_orig.wl[0] - max_curr_lam) / max_curr_lam + add_overlap(self.file_base, v_max=v_max) + + # now get the wavelengths of each file + opac_obj_ref = Opac(self.opacity_file, loader="exotransmit") + opac_obj0 = Opac( + self.first_file, + loader="exotransmit", + ) + opac_obj1 = Opac( + self.second_file, + loader="exotransmit", + ) + self.assertTrue( + len(opac_obj1.wl.min) == len(opac_obj0.wl.max()) + and len(opac_obj1.wl) == 1 + len(opac_obj1_orig.wl) + ) diff --git a/src/cortecs/tests/test_fit.py b/src/cortecs/tests/test_fit.py index 722d80a..220b23b 100644 --- a/src/cortecs/tests/test_fit.py +++ b/src/cortecs/tests/test_fit.py @@ -7,6 +7,7 @@ from cortecs.fit.fit_pca import * import os import sys +import numpy as np sys.path.insert(0, os.path.abspath(".")) @@ -56,3 +57,49 @@ def test_available_methods_assigned_func(self): fitter = Fitter(self.opac, method="pca") self.assertEqual(fitter.fit_func, fit_pca) + + +class TestFitUtils(unittest.TestCase): + """ + Test the fitter object itself + """ + + T_filename = os.path.abspath(".") + "/src/cortecs/tests/temperatures.npy" + P_filename = os.path.abspath(".") + "/src/cortecs/tests/pressures.npy" + wl_filename = os.path.abspath(".") + "/src/cortecs/tests/wavelengths.npy" + cross_sec_filename = ( + os.path.abspath(".") + "/src/cortecs/tests/absorb_coeffs_C2H4.npy" + ) + + load_kwargs = { + "T_filename": T_filename, + "P_filename": P_filename, + "wl_filename": wl_filename, + } + opac = Opac(cross_sec_filename, loader="platon", load_kwargs=load_kwargs) + + def test_nan_pca_cube_errors(self): + """ + if i pass nans, should fail. + :return: + """ + bad_cube = np.zeros((3, 3)) * np.nan + + self.assertRaises( + ValueError, + do_pca, + bad_cube, + ) + + def test_nan_pca_cube_errors(self): + """ + i want to make a linalg errror! + :return: + """ + bad_cube = np.zeros((3, 3)) * np.inf + + self.assertRaises( + ValueError, + do_pca, + bad_cube, + )