text:
from functools import lru_cache

import cv2
import math

import numpy as np
import scipy
import scipy.integrate as integrate
from scipy.interpolate import interp1d

from visnav.algo import tools
from visnav.algo.image import ImageProc
from visnav.algo.model import Camera
from visnav.missions.didymos import DidymosSystemModel
from visnav.render.stars import Stars

class Sun:
    RADIUS = 695510e3   # in meters
    FLUX_DENSITY_AT_1AU = 1360.8    # in W/m2
    SOLID_ANGLE_AT_1AU = 6.807e-5   # in steradians
    AU = 1.495978707e11   # in meters
    TEMPERATURE = 5778  # in K
    METALLICITY = 0.012
    LOG_SURFACE_G = 4.43
    MAG_V = -26.7

    _DIFFRACTION_INTERPOLATION_N = 400
    _diffraction_relative_intensity_fun = {}
    _ssi_interp = None
    _tot_ssr_simple = None

    @staticmethod
    def sun_radius_rad(dist):
        return math.atan(Sun.RADIUS/dist)

    @staticmethod
    def _unit_circle_segment_area(r):
        alpha = math.acos(r-1)
        unit_circle_area = np.pi
        if r > 0.5:
            return unit_circle_area - unit_circle_area*alpha/np.pi + (r-0.5)**2*math.tan(alpha)
        else:
            return unit_circle_area * alpha/np.pi - (0.5-r)**2*math.tan(np.pi-alpha)

    @staticmethod
    def flux_density(cam, sun_cf, mask=None):
        """
        calculate flux density from sun hitting the camera, sun_cf in camera frame and in meters
        """

        flux_density = np.zeros((cam.height, cam.width), dtype=np.float32)
        sun_dist = np.linalg.norm(sun_cf)
        sun_cf_n = sun_cf/sun_dist
        lat, lon, _ = tools.cartesian2spherical(*sun_cf_n)

        if abs(tools.wrap_rads(lon)) > math.radians(cam.exclusion_angle_x) or abs(lat) > math.radians(cam.exclusion_angle_y):
            # baffle protected from all effects
            return flux_density

        visible_ratio, theta = Sun.direct(flux_density, cam, sun_cf, mask)
        Sun.diffraction(flux_density, cam, sun_cf, mask, visible_ratio, theta)

        # TODO: for visible_ratio take into account if cam shadowed by something while sun out of fov
        visible_ratio = 1
        Sun.scattering(flux_density, cam, sun_cf_n, visible_ratio, theta)
        Sun.ghosts(flux_density, cam, sun_cf_n, visible_ratio, theta)

        return (Sun.FLUX_DENSITY_AT_1AU * (Sun.AU / sun_dist)**2) * flux_density

    @staticmethod
    def direct(flux_density, cam, sun_cf, mask, accurate_theta=False):
        sun_dist = np.linalg.norm(sun_cf)
        sun_rad = Sun.sun_radius_rad(sun_dist)
        lat, lon, _ = tools.cartesian2spherical(*sun_cf)
        lon = tools.wrap_rads(lon)
        hfx, hfy = math.radians(cam.x_fov / 2), math.radians(cam.y_fov / 2)

        lats, lons = np.meshgrid(np.linspace(hfy, -hfy, cam.height), np.linspace(hfx, -hfx, cam.width))
        px_v_s = np.stack((lats.squeeze().T, lons.squeeze().T), axis=2)
        px_v_c = tools.spherical2cartesian_arr(px_v_s.reshape((-1, 2)), r=1)  # expensive
        theta = tools.angle_between_v_mx(sun_cf.reshape((-1, 1))/sun_dist, px_v_c, normalize=False) \
                     .reshape((cam.height, cam.width))  # expensive

        direct = (theta < sun_rad).astype(np.float32)
        full = np.sum(direct)

        if abs(lon)+sun_rad > hfx or abs(lat)+sun_rad > hfy or full == 0:
            # sun out of fov or completely behind asteroid
            return 0, theta

        if mask is not None:
            direct[np.logical_not(mask)] = 0

        # update flux_density array
        flux_density += direct

        x_ratio = 1 if abs(lon)-sun_rad < hfx else Sun._unit_circle_segment_area((hfx-abs(lon)+sun_rad)/(2*sun_rad))
        y_ratio = 1 if abs(lat)-sun_rad < hfy else Sun._unit_circle_segment_area((hfy-abs(lat)+sun_rad)/(2*sun_rad))

        # not strictly true as sun might not be in fov at all in case both x- and y-ratios are very small
        not_obscured = np.sum(direct)
        visible_ratio = not_obscured/full * x_ratio * y_ratio

        if 0 < not_obscured < full and accurate_theta:
            px_sun_v = px_v_c[(direct.reshape((-1, 1)) > 0).squeeze(), :]
            theta = np.min(tools.angle_between_mx(px_sun_v, px_v_c), axis=1).reshape((cam.height, cam.width))

        return visible_ratio, theta

    @staticmethod
    def diffraction(flux_density, cam, sun_cf, mask, visible_ratio, theta):
        # DIFFRACTION
        # from https://en.wikipedia.org/wiki/Airy_disk
        if visible_ratio == 0:
            # sun behind asteroid or out of fov, forget diffraction
            return

        sun_dist = np.linalg.norm(sun_cf)
        sun_rad = Sun.sun_radius_rad(sun_dist)
        diffraction = Sun.diffraction_relative_intensity(cam, sun_rad, theta)
        diffraction[flux_density > 0] = 0   # dont add diffraction on top of direct observation

#        if mask is not None:
#            diffraction[np.logical_not(mask)] = 0

        # update flux_denstity
        flux_density += diffraction * visible_ratio

    @staticmethod
    def scattering(flux_density, cam, sun_cf_n, visible_ratio, theta):
        # Using Rayleigh scattering, https://en.wikipedia.org/wiki/Rayleigh_scattering
        # ~ 1+cos(theta)**2 * "some coef"
        scattering = cam.scattering_coef * (1 + np.cos(theta)**2) * visible_ratio
        flux_density += scattering

    @staticmethod
    def ghosts(flux_density, cam, sun_cf_n, visible_ratio, theta):
        # TODO
        pass

    @staticmethod
    def _diffraction(lam, aperture, theta):
        x = 2*np.pi/lam * aperture/2 * 1e-3 * np.sin(theta)
        return (2*scipy.special.j1(x)/x)**2

    @staticmethod
    def diffraction_relative_intensity(cam, sun_angular_radius, theta):
        shape = theta.shape
        key = hash((cam.x_fov, cam.y_fov, cam.aperture, cam.lambda_min, cam.lambda_max, sun_angular_radius) + tuple(cam.qeff_coefs))
        if key not in Sun._diffraction_relative_intensity_fun:
            lim = math.radians(np.linalg.norm((cam.x_fov, cam.y_fov))) + sun_angular_radius*2
            examples = np.linspace(-lim, lim, Sun._DIFFRACTION_INTERPOLATION_N)
            values = np.array([Sun.diffraction_relative_intensity_single(cam.aperture, tuple(cam.qeff_coefs),
                                                                         cam.lambda_min, cam.lambda_max, th)
                               for th in examples])
            Sun._diffraction_relative_intensity_fun[key] = scipy.interpolate.interp1d(examples, values)
        return Sun._diffraction_relative_intensity_fun[key](theta.reshape((-1,))).reshape(shape)

    @staticmethod
    @lru_cache(maxsize=_DIFFRACTION_INTERPOLATION_N + 1)
    def diffraction_relative_intensity_single(aperture, qeff_coefs, lambda_min, lambda_max, theta):
        """
        Returns relative intensity for diffraction integrated over the spectra of the sun and the sensor
        """

        if theta <= 0:
            return 1

        # h = 6.626e-34  # planck constant (m2kg/s)
        # c = 3e8  # speed of light
        # k = 1.380649e-23  # Boltzmann constant
        # sun_sr = 6.807e-5  # sun steradians from earth
        # def phi(lam):
        #     # planck's law of black body radiation [W/m3/sr]
        #     r = 2*h*c**2/lam**5/(math.exp(h*c/lam/k/Sun.TEMPERATURE) - 1)
        #     return r

        qeff, _ = Camera.qeff_fn(qeff_coefs, lambda_min, lambda_max)

        def total(lam):
            return qeff(lam) * Sun.ssr_simple(lam) * Sun._diffraction(lam, aperture, theta)

        if Sun._tot_ssr_simple is None:
            tphi = integrate.quad(Sun.ssr_simple, 1.2e-7, 1e-3, limit=200)
            Sun._tot_ssr_simple = tphi[0]

        tint = integrate.quad(total, lambda_min, lambda_max, limit=50)
        return tint[0]/Sun._tot_ssr_simple

    @staticmethod
    def ssr(lam, ssi_table=None):
        """ solar spectral radiance in W/m3/sr """
        if ssi_table is None:
            ssi_table = SOLAR_SPECTRAL_IRRADIANCE
        if Sun._ssi_interp is None:
            Sun._ssi_interp = interp1d(ssi_table[:, 0], ssi_table[:, 1], kind='linear')
        return Sun._ssi_interp(lam) / Sun.SOLID_ANGLE_AT_1AU

    @staticmethod
    def ssr_simple(lam):
        """ Approximation of solar spectral radiance [W/m3/sr] using planck's law of black body radiation """
        return Stars.black_body_radiation(Sun.TEMPERATURE, lam)

# 2000 ASTM Standard Extraterrestrial Spectrum Reference E-490-00   ([m], [W m-2 m-1])
# E490_00a_AM0.xls, https://rredc.nrel.gov/solar//spectra/am0/ASTM2000.html,
# @article{astm490,
#   title={490. 2000 American Society for Testing \& Materials (ASTM) standard extraterrestrial solar spec-trum reference E-490-00 (2000)},
#   author={ASTM, E},
#   journal={from http://rredc.nrel.gov/solar/spectra/am0}
# }
# NOTE: FOR MORE ACCURACY, could use daily solar spectral irradiance from http://doi.org/10.7289/V51J97P6
SOLAR_SPECTRAL_IRRADIANCE = np.array((
    (1.195e-07, 6.190e+04),
    (1.205e-07, 5.614e+05),
    (1.215e-07, 4.901e+06),
    (1.225e-07, 1.184e+06),
    (1.235e-07, 4.770e+04),
    (1.245e-07, 3.430e+04),
    (1.255e-07, 2.880e+04),
    (1.265e-07, 3.520e+04),
    (1.275e-07, 2.130e+04),
    (1.285e-07, 1.730e+04),
    (1.295e-07, 3.990e+04),
    (1.305e-07, 1.206e+05),
    (1.315e-07, 3.980e+04),
    (1.325e-07, 4.130e+04),
    (1.335e-07, 1.680e+05),
    (1.345e-07, 4.570e+04),
    (1.355e-07, 3.800e+04),
    (1.365e-07, 3.090e+04),
    (1.375e-07, 2.920e+04),
    (1.385e-07, 3.970e+04),
    (1.395e-07, 7.560e+04),
    (1.405e-07, 6.080e+04),
    (1.415e-07, 4.210e+04),
    (1.425e-07, 4.680e+04),
    (1.435e-07, 5.110e+04),
    (1.445e-07, 5.090e+04),
    (1.455e-07, 5.540e+04),
    (1.465e-07, 7.090e+04),
    (1.475e-07, 8.490e+04),
    (1.485e-07, 8.200e+04),
    (1.495e-07, 7.960e+04),
    (1.505e-07, 8.700e+04),
    (1.515e-07, 9.270e+04),
    (1.525e-07, 1.163e+05),
    (1.535e-07, 1.299e+05),
    (1.545e-07, 2.059e+05),
    (1.555e-07, 2.144e+05),
    (1.565e-07, 1.847e+05),
    (1.575e-07, 1.717e+05),
    (1.585e-07, 1.675e+05),
    (1.595e-07, 1.754e+05),
    (1.605e-07, 1.934e+05),
    (1.615e-07, 2.228e+05),
    (1.625e-07, 2.519e+05),
    (1.635e-07, 2.841e+05),
    (1.645e-07, 2.973e+05),
    (1.655e-07, 4.302e+05),
    (1.665e-07, 3.989e+05),
    (1.675e-07, 3.875e+05),
    (1.685e-07, 4.556e+05),
    (1.695e-07, 5.877e+05),
    (1.705e-07, 6.616e+05),
    (1.715e-07, 6.880e+05),
    (1.725e-07, 7.252e+05),
    (1.735e-07, 7.645e+05),
    (1.745e-07, 9.067e+05),
    (1.755e-07, 1.079e+06),
    (1.765e-07, 1.220e+06),
    (1.775e-07, 1.403e+06),
    (1.785e-07, 1.538e+06),
    (1.795e-07, 1.576e+06),
    (1.805e-07, 1.831e+06),
    (1.815e-07, 2.233e+06),
    (1.825e-07, 2.243e+06),
    (1.835e-07, 2.244e+06),
    (1.845e-07, 2.066e+06),
    (1.855e-07, 2.311e+06),
    (1.865e-07, 2.700e+06),
    (1.875e-07, 3.009e+06),
    (1.885e-07, 3.291e+06),
    (1.895e-07, 3.569e+06),
    (1.905e-07, 3.764e+06),
    (1.915e-07, 4.165e+06),
    (1.925e-07, 4.113e+06),
    (1.935e-07, 3.808e+06),
    (1.945e-07, 5.210e+06),
    (1.955e-07, 5.427e+06),
    (1.965e-07, 6.008e+06),
    (1.975e-07, 6.191e+06),
    (1.985e-07, 6.187e+06),
    (1.995e-07, 6.664e+06),
    (2.005e-07, 7.326e+06),
    (2.015e-07, 8.023e+06),
    (2.025e-07, 8.261e+06),
    (2.035e-07, 9.217e+06),
    (2.045e-07, 1.025e+07),
    (2.055e-07, 1.054e+07),
    (2.065e-07, 1.108e+07),
    (2.075e-07, 1.265e+07),
    (2.085e-07, 1.505e+07),
    (2.095e-07, 2.138e+07),
    (2.105e-07, 2.792e+07),
    (2.115e-07, 3.354e+07),
    (2.125e-07, 3.130e+07),
    (2.135e-07, 3.315e+07),
    (2.145e-07, 4.003e+07),
    (2.155e-07, 3.615e+07),
    (2.165e-07, 3.227e+07),
    (2.175e-07, 3.529e+07),
    (2.185e-07, 4.437e+07),
    (2.195e-07, 4.692e+07),
    (2.205e-07, 4.733e+07),
    (2.215e-07, 3.958e+07),
    (2.225e-07, 4.965e+07),
    (2.235e-07, 6.301e+07),
    (2.245e-07, 5.897e+07),
    (2.255e-07, 5.229e+07),
    (2.265e-07, 3.940e+07),
    (2.275e-07, 3.992e+07),
    (2.285e-07, 5.195e+07),
    (2.295e-07, 4.771e+07),
    (2.305e-07, 5.212e+07),
    (2.315e-07, 5.097e+07),
    (2.325e-07, 5.326e+07),
    (2.335e-07, 4.474e+07),
    (2.345e-07, 3.897e+07),
    (2.355e-07, 5.142e+07),
    (2.365e-07, 4.859e+07),
    (2.375e-07, 4.844e+07),
    (2.385e-07, 4.196e+07),
    (2.395e-07, 4.412e+07),
    (2.405e-07, 3.956e+07),
    (2.415e-07, 5.148e+07),
    (2.425e-07, 7.060e+07),
    (2.435e-07, 6.653e+07),
    (2.445e-07, 6.097e+07),
    (2.455e-07, 4.939e+07),
    (2.465e-07, 5.040e+07),
    (2.475e-07, 5.550e+07),
    (2.485e-07, 4.565e+07),
    (2.495e-07, 5.638e+07),
    (2.505e-07, 6.010e+07),
    (2.515e-07, 4.601e+07),
    (2.525e-07, 4.155e+07),
    (2.535e-07, 5.155e+07),
    (2.545e-07, 5.957e+07),
    (2.555e-07, 7.930e+07),
    (2.565e-07, 1.018e+08),
    (2.575e-07, 1.254e+08),
    (2.585e-07, 1.251e+08),
    (2.595e-07, 1.040e+08),
    (2.605e-07, 8.551e+07),
    (2.615e-07, 8.980e+07),
    (2.625e-07, 1.036e+08),
    (2.635e-07, 1.658e+08),
    (2.645e-07, 2.497e+08),
    (2.655e-07, 2.527e+08),
    (2.665e-07, 2.494e+08),
    (2.675e-07, 2.508e+08),
    (2.685e-07, 2.438e+08),
    (2.695e-07, 2.389e+08),
    (2.705e-07, 2.673e+08),
    (2.715e-07, 2.244e+08),
    (2.725e-07, 1.974e+08),
    (2.735e-07, 1.965e+08),
    (2.745e-07, 1.326e+08),
    (2.755e-07, 1.751e+08),
    (2.765e-07, 2.428e+08),
    (2.775e-07, 2.338e+08),
    (2.785e-07, 1.593e+08),
    (2.795e-07, 8.555e+07),
    (2.805e-07, 9.463e+07),
    (2.815e-07, 2.083e+08),
    (2.825e-07, 2.941e+08),
    (2.835e-07, 3.135e+08),
    (2.845e-07, 2.353e+08),
    (2.855e-07, 1.631e+08),
    (2.865e-07, 3.227e+08),
    (2.875e-07, 3.363e+08),
    (2.885e-07, 3.222e+08),
    (2.895e-07, 4.727e+08),
    (2.905e-07, 6.013e+08),
    (2.915e-07, 5.808e+08),
    (2.925e-07, 5.219e+08),
    (2.935e-07, 5.355e+08),
    (2.945e-07, 5.088e+08),
    (2.955e-07, 5.532e+08),
    (2.965e-07, 5.096e+08),
    (2.975e-07, 5.073e+08),
    (2.985e-07, 4.655e+08),
    (2.995e-07, 4.840e+08),
    (3.005e-07, 4.200e+08),
    (3.015e-07, 4.555e+08),
    (3.025e-07, 4.890e+08),
    (3.035e-07, 6.206e+08),
    (3.045e-07, 6.025e+08),
    (3.055e-07, 5.948e+08),
    (3.065e-07, 5.557e+08),
    (3.075e-07, 6.150e+08),
    (3.085e-07, 6.114e+08),
    (3.095e-07, 4.965e+08),
    (3.105e-07, 6.224e+08),
    (3.115e-07, 7.292e+08),
    (3.125e-07, 6.559e+08),
    (3.135e-07, 6.999e+08),
    (3.145e-07, 6.629e+08),
    (3.155e-07, 6.330e+08),
    (3.165e-07, 6.332e+08),
    (3.175e-07, 7.739e+08),
    (3.185e-07, 6.649e+08),
    (3.195e-07, 7.105e+08),
    (3.205e-07, 8.051e+08),
    (3.215e-07, 6.995e+08),
    (3.225e-07, 6.886e+08),
    (3.235e-07, 6.613e+08),
    (3.245e-07, 7.608e+08),
    (3.255e-07, 8.758e+08),
    (3.265e-07, 9.795e+08),
    (3.275e-07, 9.527e+08),
    (3.285e-07, 9.176e+08),
    (3.295e-07, 1.061e+09),
    (3.305e-07, 1.016e+09),
    (3.315e-07, 9.657e+08),
    (3.325e-07, 9.549e+08),
    (3.335e-07, 9.216e+08),
    (3.345e-07, 9.589e+08),
    (3.355e-07, 9.434e+08),
    (3.365e-07, 8.095e+08),
    (3.375e-07, 8.418e+08),
    (3.385e-07, 9.215e+08),
    (3.395e-07, 9.581e+08),
    (3.405e-07, 1.007e+09),
    (3.415e-07, 9.238e+08),
    (3.425e-07, 9.930e+08),
    (3.435e-07, 9.506e+08),
    (3.445e-07, 7.957e+08),
    (3.455e-07, 9.392e+08),
    (3.465e-07, 9.264e+08),
    (3.475e-07, 9.017e+08),
    (3.485e-07, 8.972e+08),
    (3.495e-07, 8.898e+08),
    (3.505e-07, 1.050e+09),
    (3.515e-07, 9.795e+08),
    (3.525e-07, 9.079e+08),
    (3.535e-07, 1.033e+09),
    (3.545e-07, 1.111e+09),
    (3.555e-07, 1.045e+09),
    (3.565e-07, 9.123e+08),
    (3.575e-07, 7.960e+08),
    (3.585e-07, 6.936e+08),
    (3.595e-07, 9.911e+08),
    (3.605e-07, 9.708e+08),
    (3.615e-07, 8.781e+08),
    (3.625e-07, 9.978e+08),
    (3.635e-07, 9.969e+08),
    (3.645e-07, 1.013e+09),
    (3.655e-07, 1.152e+09),
    (3.665e-07, 1.233e+09),
    (3.675e-07, 1.180e+09),
    (3.685e-07, 1.101e+09),
    (3.695e-07, 1.226e+09),
    (3.705e-07, 1.139e+09),
    (3.715e-07, 1.175e+09),
    (3.725e-07, 1.054e+09),
    (3.735e-07, 9.202e+08),
    (3.745e-07, 9.004e+08),
    (3.755e-07, 1.062e+09),
    (3.765e-07, 1.085e+09),
    (3.775e-07, 1.282e+09),
    (3.785e-07, 1.327e+09),
    (3.795e-07, 1.066e+09),
    (3.805e-07, 1.202e+09),
    (3.815e-07, 1.082e+09),
    (3.825e-07, 7.913e+08),
    (3.835e-07, 6.841e+08),
    (3.845e-07, 9.597e+08),
    (3.855e-07, 1.008e+09),
    (3.865e-07, 1.007e+09),
    (3.875e-07, 1.004e+09),
    (3.885e-07, 9.843e+08),
    (3.895e-07, 1.174e+09),
    (3.905e-07, 1.247e+09),
    (3.915e-07, 1.342e+09),
    (3.925e-07, 1.019e+09),
    (3.935e-07, 5.823e+08),
    (3.945e-07, 1.026e+09),
    (3.955e-07, 1.314e+09),
    (3.965e-07, 8.545e+08),
    (3.975e-07, 9.288e+08),
    (3.985e-07, 1.522e+09),
    (3.995e-07, 1.663e+09),
    (4.005e-07, 1.682e+09),
    (4.015e-07, 1.746e+09),
    (4.025e-07, 1.759e+09),
    (4.035e-07, 1.684e+09),
    (4.045e-07, 1.674e+09),
    (4.055e-07, 1.667e+09),
    (4.065e-07, 1.589e+09),
    (4.075e-07, 1.628e+09),
    (4.085e-07, 1.735e+09),
    (4.095e-07, 1.715e+09),
    (4.105e-07, 1.532e+09),
    (4.115e-07, 1.817e+09),
    (4.125e-07, 1.789e+09),
    (4.135e-07, 1.756e+09),
    (4.145e-07, 1.737e+09),
    (4.155e-07, 1.734e+09),
    (4.165e-07, 1.842e+09),
    (4.175e-07, 1.665e+09),
    (4.185e-07, 1.684e+09),
    (4.195e-07, 1.701e+09),
    (4.205e-07, 1.757e+09),
    (4.215e-07, 1.797e+09),
    (4.225e-07, 1.582e+09),
    (4.235e-07, 1.711e+09),
    (4.245e-07, 1.767e+09),
    (4.255e-07, 1.695e+09),
    (4.265e-07, 1.698e+09),
    (4.275e-07, 1.569e+09),
    (4.285e-07, 1.587e+09),
    (4.295e-07, 1.475e+09),
    (4.305e-07, 1.135e+09),
    (4.315e-07, 1.686e+09),
    (4.325e-07, 1.646e+09),
    (4.335e-07, 1.731e+09),
    (4.345e-07, 1.670e+09),
    (4.355e-07, 1.723e+09),
    (4.365e-07, 1.929e+09),
    (4.375e-07, 1.806e+09),
    (4.385e-07, 1.567e+09),
    (4.395e-07, 1.825e+09),
    (4.405e-07, 1.713e+09),
    (4.415e-07, 1.931e+09),
    (4.425e-07, 1.980e+09),
    (4.435e-07, 1.909e+09),
    (4.445e-07, 1.973e+09),
    (4.455e-07, 1.821e+09),
    (4.465e-07, 1.891e+09),
    (4.475e-07, 2.077e+09),
    (4.485e-07, 1.973e+09),
    (4.495e-07, 2.027e+09),
    (4.505e-07, 2.144e+09),
    (4.515e-07, 2.109e+09),
    (4.525e-07, 1.941e+09),
    (4.535e-07, 1.970e+09),
    (4.545e-07, 1.979e+09),
    (4.555e-07, 2.034e+09),
    (4.565e-07, 2.077e+09),
    (4.575e-07, 2.100e+09),
    (4.585e-07, 1.971e+09),
    (4.595e-07, 2.009e+09),
    (4.605e-07, 2.040e+09),
    (4.615e-07, 2.055e+09),
    (4.625e-07, 2.104e+09),
    (4.635e-07, 2.040e+09),
    (4.645e-07, 1.976e+09),
    (4.655e-07, 2.042e+09),
    (4.665e-07, 1.921e+09),
    (4.675e-07, 2.015e+09),
    (4.685e-07, 1.994e+09),
    (4.695e-07, 1.990e+09),
    (4.705e-07, 1.877e+09),
    (4.715e-07, 2.018e+09),
    (4.725e-07, 2.041e+09),
    (4.735e-07, 1.991e+09),
    (4.745e-07, 2.051e+09),
    (4.755e-07, 2.016e+09),
    (4.765e-07, 1.956e+09),
    (4.775e-07, 2.075e+09),
    (4.785e-07, 2.009e+09),
    (4.795e-07, 2.076e+09),
    (4.805e-07, 2.035e+09),
    (4.815e-07, 2.090e+09),
    (4.825e-07, 2.023e+09),
    (4.835e-07, 2.019e+09),
    (4.845e-07, 1.969e+09),
    (4.855e-07, 1.830e+09),
    (4.865e-07, 1.625e+09),
    (4.875e-07, 1.830e+09),
    (4.885e-07, 1.914e+09),
    (4.895e-07, 1.960e+09),
    (4.905e-07, 2.007e+09),
    (4.915e-07, 1.896e+09),
    (4.925e-07, 1.896e+09),
    (4.935e-07, 1.888e+09),
    (4.945e-07, 2.058e+09),
    (4.955e-07, 1.926e+09),
    (4.965e-07, 2.017e+09),
    (4.975e-07, 2.018e+09),
    (4.985e-07, 1.866e+09),
    (4.995e-07, 1.970e+09),
    (5.005e-07, 1.857e+09),
    (5.015e-07, 1.812e+09),
    (5.025e-07, 1.894e+09),
    (5.035e-07, 1.934e+09),
    (5.045e-07, 1.869e+09),
    (5.055e-07, 1.993e+09),
    (5.065e-07, 1.961e+09),
    (5.075e-07, 1.906e+09),
    (5.085e-07, 1.919e+09),
    (5.095e-07, 1.916e+09),
    (5.105e-07, 1.947e+09),
    (5.115e-07, 1.997e+09),
    (5.125e-07, 1.867e+09),
    (5.135e-07, 1.861e+09),
    (5.145e-07, 1.874e+09),
    (5.155e-07, 1.900e+09),
    (5.165e-07, 1.669e+09),
    (5.175e-07, 1.726e+09),
    (5.185e-07, 1.654e+09),
    (5.195e-07, 1.828e+09),
    (5.205e-07, 1.831e+09),
    (5.215e-07, 1.906e+09),
    (5.225e-07, 1.823e+09),
    (5.235e-07, 1.894e+09),
    (5.245e-07, 1.958e+09),
    (5.255e-07, 1.930e+09),
    (5.265e-07, 1.674e+09),
    (5.275e-07, 1.828e+09),
    (5.285e-07, 1.897e+09),
    (5.295e-07, 1.918e+09),
    (5.305e-07, 1.952e+09),
    (5.315e-07, 1.963e+09),
    (5.325e-07, 1.770e+09),
    (5.335e-07, 1.923e+09),
    (5.345e-07, 1.858e+09),
    (5.355e-07, 1.990e+09),
    (5.365e-07, 1.871e+09),
    (5.375e-07, 1.882e+09),
    (5.385e-07, 1.904e+09),
    (5.395e-07, 1.832e+09),
    (5.405e-07, 1.769e+09),
    (5.415e-07, 1.881e+09),
    (5.425e-07, 1.825e+09),
    (5.435e-07, 1.879e+09),
    (5.445e-07, 1.879e+09),
    (5.455e-07, 1.901e+09),
    (5.465e-07, 1.879e+09),
    (5.475e-07, 1.833e+09),
    (5.485e-07, 1.863e+09),
    (5.495e-07, 1.895e+09),
    (5.505e-07, 1.862e+09),
    (5.515e-07, 1.871e+09),
    (5.525e-07, 1.846e+09),
    (5.535e-07, 1.882e+09),
    (5.545e-07, 1.898e+09),
    (5.555e-07, 1.897e+09),
    (5.565e-07, 1.821e+09),
    (5.575e-07, 1.846e+09),
    (5.585e-07, 1.787e+09),
    (5.595e-07, 1.808e+09),
    (5.605e-07, 1.843e+09),
    (5.615e-07, 1.824e+09),
    (5.625e-07, 1.850e+09),
    (5.635e-07, 1.861e+09),
    (5.645e-07, 1.854e+09),
    (5.655e-07, 1.798e+09),
    (5.665e-07, 1.829e+09),
    (5.675e-07, 1.887e+09),
    (5.685e-07, 1.810e+09),
    (5.695e-07, 1.860e+09),
    (5.705e-07, 1.769e+09),
    (5.715e-07, 1.823e+09),
    (5.725e-07, 1.892e+09),
    (5.735e-07, 1.876e+09),
    (5.745e-07, 1.867e+09),
    (5.755e-07, 1.830e+09),
    (5.765e-07, 1.846e+09),
    (5.775e-07, 1.857e+09),
    (5.785e-07, 1.783e+09),
    (5.795e-07, 1.828e+09),
    (5.805e-07, 1.838e+09),
    (5.815e-07, 1.853e+09),
    (5.825e-07, 1.873e+09),
    (5.835e-07, 1.857e+09),
    (5.845e-07, 1.860e+09),
    (5.855e-07, 1.783e+09),
    (5.865e-07, 1.830e+09),
    (5.875e-07, 1.848e+09),
    (5.885e-07, 1.750e+09),
    (5.895e-07, 1.612e+09),
    (5.905e-07, 1.813e+09),
    (5.915e-07, 1.787e+09),
    (5.925e-07, 1.808e+09),
    (5.935e-07, 1.796e+09),
    (5.945e-07, 1.773e+09),
    (5.955e-07, 1.782e+09),
    (5.965e-07, 1.805e+09),
    (5.975e-07, 1.780e+09),
    (5.985e-07, 1.757e+09),
    (5.995e-07, 1.774e+09),
    (6.005e-07, 1.746e+09),
    (6.015e-07, 1.751e+09),
    (6.025e-07, 1.719e+09),
    (6.035e-07, 1.787e+09),
    (6.045e-07, 1.776e+09),
    (6.055e-07, 1.763e+09),
    (6.065e-07, 1.759e+09),
    (6.075e-07, 1.757e+09),
    (6.085e-07, 1.743e+09),
    (6.095e-07, 1.744e+09),
    (6.105e-07, 1.703e+09),
    (6.115e-07, 1.746e+09),
    (6.125e-07, 1.705e+09),
    (6.135e-07, 1.683e+09),
    (6.145e-07, 1.713e+09),
    (6.155e-07, 1.713e+09),
    (6.165e-07, 1.609e+09),
    (6.175e-07, 1.707e+09),
    (6.185e-07, 1.724e+09),
    (6.195e-07, 1.707e+09),
    (6.205e-07, 1.734e+09),
    (6.215e-07, 1.690e+09),
    (6.225e-07, 1.713e+09),
    (6.235e-07, 1.666e+09),
    (6.245e-07, 1.656e+09),
    (6.255e-07, 1.632e+09),
    (6.265e-07, 1.697e+09),
    (6.275e-07, 1.697e+09),
    (6.285e-07, 1.697e+09),
    (6.295e-07, 1.677e+09),
    (6.310e-07, 1.639e+09),
    (6.330e-07, 1.651e+09),
    (6.350e-07, 1.656e+09),
    (6.370e-07, 1.654e+09),
    (6.390e-07, 1.651e+09),
    (6.410e-07, 1.614e+09),
    (6.430e-07, 1.621e+09),
    (6.450e-07, 1.627e+09),
    (6.470e-07, 1.603e+09),
    (6.490e-07, 1.558e+09),
    (6.510e-07, 1.606e+09),
    (6.530e-07, 1.599e+09),
    (6.550e-07, 1.532e+09),
    (6.570e-07, 1.384e+09),
    (6.590e-07, 1.549e+09),
    (6.610e-07, 1.571e+09),
    (6.630e-07, 1.555e+09),
    (6.650e-07, 1.560e+09),
    (6.670e-07, 1.535e+09),
    (6.690e-07, 1.546e+09),
    (6.710e-07, 1.516e+09),
    (6.730e-07, 1.521e+09),
    (6.750e-07, 1.510e+09),
    (6.770e-07, 1.508e+09),
    (6.790e-07, 1.498e+09),
    (6.810e-07, 1.492e+09),
    (6.830e-07, 1.479e+09),
    (6.850e-07, 1.455e+09),
    (6.870e-07, 1.467e+09),
    (6.890e-07, 1.461e+09),
    (6.910e-07, 1.448e+09),
    (6.930e-07, 1.448e+09),
    (6.950e-07, 1.436e+09),
    (6.970e-07, 1.416e+09),
    (6.990e-07, 1.425e+09),
    (7.010e-07, 1.386e+09),
    (7.030e-07, 1.388e+09),
    (7.050e-07, 1.415e+09),
    (7.070e-07, 1.400e+09),
    (7.090e-07, 1.384e+09),
    (7.110e-07, 1.385e+09),
    (7.130e-07, 1.373e+09),
    (7.150e-07, 1.366e+09),
    (7.170e-07, 1.354e+09),
    (7.190e-07, 1.328e+09),
    (7.210e-07, 1.331e+09),
    (7.230e-07, 1.348e+09),
    (7.250e-07, 1.350e+09),
    (7.270e-07, 1.346e+09),
    (7.290e-07, 1.319e+09),
    (7.310e-07, 1.326e+09),
    (7.330e-07, 1.318e+09),
    (7.350e-07, 1.309e+09),
    (7.370e-07, 1.307e+09),
    (7.390e-07, 1.278e+09),
    (7.410e-07, 1.258e+09),
    (7.430e-07, 1.286e+09),
    (7.450e-07, 1.279e+09),
    (7.470e-07, 1.283e+09),
    (7.490e-07, 1.270e+09),
    (7.510e-07, 1.262e+09),
    (7.530e-07, 1.259e+09),
    (7.550e-07, 1.255e+09),
    (7.570e-07, 1.248e+09),
    (7.590e-07, 1.240e+09),
    (7.610e-07, 1.237e+09),
    (7.630e-07, 1.241e+09),
    (7.650e-07, 1.221e+09),
    (7.670e-07, 1.185e+09),
    (7.690e-07, 1.203e+09),
    (7.710e-07, 1.204e+09),
    (7.730e-07, 1.208e+09),
    (7.750e-07, 1.188e+09),
    (7.770e-07, 1.196e+09),
    (7.790e-07, 1.187e+09),
    (7.810e-07, 1.187e+09),
    (7.830e-07, 1.176e+09),
    (7.850e-07, 1.180e+09),
    (7.870e-07, 1.177e+09),
    (7.890e-07, 1.174e+09),
    (7.910e-07, 1.158e+09),
    (7.930e-07, 1.143e+09),
    (7.950e-07, 1.134e+09),
    (7.970e-07, 1.152e+09),
    (7.990e-07, 1.135e+09),
    (8.010e-07, 1.142e+09),
    (8.030e-07, 1.129e+09),
    (8.050e-07, 1.115e+09),
    (8.070e-07, 1.120e+09),
    (8.090e-07, 1.095e+09),
    (8.110e-07, 1.114e+09),
    (8.130e-07, 1.115e+09),
    (8.150e-07, 1.107e+09),
    (8.170e-07, 1.104e+09),
    (8.190e-07, 1.063e+09),
    (8.210e-07, 1.080e+09),
    (8.230e-07, 1.073e+09),
    (8.250e-07, 1.075e+09),
    (8.260e-07, 1.080e+09),
    (8.280e-07, 1.081e+09),
    (8.300e-07, 1.063e+09),
    (8.320e-07, 1.051e+09),
    (8.340e-07, 1.041e+09),
    (8.360e-07, 1.052e+09),
    (8.380e-07, 1.044e+09),
    (8.400e-07, 1.040e+09),
    (8.420e-07, 1.036e+09),
    (8.440e-07, 1.024e+09),
    (8.460e-07, 1.028e+09),
    (8.480e-07, 1.023e+09),
    (8.500e-07, 9.660e+08),
    (8.520e-07, 9.961e+08),
    (8.540e-07, 8.780e+08),
    (8.560e-07, 9.755e+08),
    (8.580e-07, 1.005e+09),
    (8.600e-07, 9.969e+08),
    (8.620e-07, 9.949e+08),
    (8.640e-07, 9.993e+08),
    (8.660e-07, 8.862e+08),
    (8.680e-07, 9.395e+08),
    (8.700e-07, 9.747e+08),
    (8.720e-07, 9.833e+08),
    (8.740e-07, 9.713e+08),
    (8.760e-07, 9.640e+08),
    (8.780e-07, 9.749e+08),
    (8.800e-07, 9.554e+08),
    (8.820e-07, 9.511e+08),
    (8.840e-07, 9.579e+08),
    (8.860e-07, 9.383e+08),
    (8.880e-07, 9.443e+08),
    (8.900e-07, 9.530e+08),
    (8.920e-07, 9.394e+08),
    (8.940e-07, 9.332e+08),
    (8.960e-07, 9.387e+08),
    (8.980e-07, 9.339e+08),
    (9.000e-07, 9.158e+08),
    (9.020e-07, 8.916e+08),
    (9.040e-07, 9.285e+08),
    (9.060e-07, 9.176e+08),
    (9.080e-07, 9.025e+08),
    (9.100e-07, 8.916e+08),
    (9.120e-07, 8.967e+08),
    (9.140e-07, 9.071e+08),
    (9.160e-07, 9.004e+08),
    (9.180e-07, 8.951e+08),
    (9.200e-07, 8.908e+08),
    (9.220e-07, 8.630e+08),
    (9.240e-07, 8.585e+08),
    (9.260e-07, 8.612e+08),
    (9.280e-07, 8.769e+08),
    (9.300e-07, 8.677e+08),
    (9.320e-07, 8.651e+08),
    (9.340e-07, 8.641e+08),
    (9.360e-07, 8.547e+08),
    (9.380e-07, 8.580e+08),
    (9.400e-07, 8.438e+08),
    (9.420e-07, 8.250e+08),
    (9.440e-07, 8.324e+08),
    (9.460e-07, 8.375e+08),
    (9.480e-07, 8.407e+08),
    (9.500e-07, 8.369e+08),
    (9.520e-07, 8.317e+08),
    (9.540e-07, 8.080e+08),
    (9.560e-07, 8.082e+08),
    (9.580e-07, 8.188e+08),
    (9.600e-07, 8.151e+08),
    (9.620e-07, 8.089e+08),
    (9.640e-07, 8.013e+08),
    (9.660e-07, 7.947e+08),
    (9.680e-07, 7.969e+08),
    (9.700e-07, 7.959e+08),
    (9.720e-07, 7.936e+08),
    (9.740e-07, 7.815e+08),
    (9.760e-07, 7.825e+08),
    (9.780e-07, 7.779e+08),
    (9.800e-07, 7.746e+08),
    (9.820e-07, 7.764e+08),
    (9.840e-07, 7.698e+08),
    (9.860e-07, 7.661e+08),
    (9.880e-07, 7.615e+08),
    (9.900e-07, 7.541e+08),
    (9.920e-07, 7.567e+08),
    (9.940e-07, 7.556e+08),
    (9.960e-07, 7.525e+08),
    (9.980e-07, 7.510e+08),
    (1.000e-06, 7.479e+08),
    (1.002e-06, 7.469e+08),
    (1.004e-06, 7.261e+08),
    (1.006e-06, 7.136e+08),
    (1.008e-06, 7.335e+08),
    (1.010e-06, 7.313e+08),
    (1.012e-06, 7.262e+08),
    (1.014e-06, 7.210e+08),
    (1.016e-06, 7.139e+08),
    (1.018e-06, 7.107e+08),
    (1.020e-06, 7.041e+08),
    (1.022e-06, 7.021e+08),
    (1.024e-06, 7.054e+08),
    (1.026e-06, 7.027e+08),
    (1.028e-06, 6.989e+08),
    (1.030e-06, 6.937e+08),
    (1.032e-06, 6.905e+08),
    (1.034e-06, 6.817e+08),
    (1.036e-06, 6.840e+08),
    (1.038e-06, 6.772e+08),
    (1.040e-06, 6.761e+08),
    (1.042e-06, 6.746e+08),
    (1.044e-06, 6.714e+08),
    (1.046e-06, 6.600e+08),
    (1.048e-06, 6.644e+08),
    (1.050e-06, 6.622e+08),
    (1.052e-06, 6.586e+08),
    (1.054e-06, 6.549e+08),
    (1.056e-06, 6.557e+08),
    (1.058e-06, 6.451e+08),
    (1.060e-06, 6.415e+08),
    (1.062e-06, 6.438e+08),
    (1.064e-06, 6.459e+08),
    (1.066e-06, 6.395e+08),
    (1.068e-06, 6.317e+08),
    (1.070e-06, 6.241e+08),
    (1.072e-06, 6.326e+08),
    (1.074e-06, 6.276e+08),
    (1.076e-06, 6.280e+08),
    (1.078e-06, 6.272e+08),
    (1.080e-06, 6.247e+08),
    (1.082e-06, 6.099e+08),
    (1.084e-06, 6.180e+08),
    (1.086e-06, 6.208e+08),
    (1.088e-06, 6.103e+08),
    (1.090e-06, 6.199e+08),
    (1.092e-06, 6.159e+08),
    (1.094e-06, 5.849e+08),
    (1.096e-06, 5.983e+08),
    (1.098e-06, 5.961e+08),
    (1.100e-06, 6.042e+08),
    (1.102e-06, 5.932e+08),
    (1.104e-06, 5.974e+08),
    (1.106e-06, 5.945e+08),
    (1.108e-06, 5.916e+08),
    (1.110e-06, 5.906e+08),
    (1.112e-06, 5.843e+08),
    (1.114e-06, 5.844e+08),
    (1.116e-06, 5.831e+08),
    (1.118e-06, 5.815e+08),
    (1.120e-06, 5.741e+08),
    (1.122e-06, 5.796e+08),
    (1.124e-06, 5.769e+08),
    (1.126e-06, 5.655e+08),
    (1.128e-06, 5.700e+08),
    (1.130e-06, 5.653e+08),
    (1.132e-06, 5.678e+08),
    (1.134e-06, 5.638e+08),
    (1.136e-06, 5.658e+08),
    (1.138e-06, 5.569e+08),
    (1.140e-06, 5.530e+08),
    (1.142e-06, 5.531e+08),
    (1.144e-06, 5.514e+08),
    (1.146e-06, 5.548e+08),
    (1.148e-06, 5.525e+08),
    (1.150e-06, 5.489e+08),
    (1.152e-06, 5.458e+08),
    (1.154e-06, 5.479e+08),
    (1.156e-06, 5.455e+08),
    (1.158e-06, 5.435e+08),
    (1.160e-06, 5.320e+08),
    (1.162e-06, 5.325e+08),
    (1.164e-06, 5.332e+08),
    (1.166e-06, 5.303e+08),
    (1.168e-06, 5.312e+08),
    (1.170e-06, 5.276e+08),
    (1.172e-06, 5.315e+08),
    (1.174e-06, 5.273e+08),
    (1.176e-06, 5.184e+08),
    (1.178e-06, 5.190e+08),
    (1.180e-06, 5.239e+08),
    (1.182e-06, 5.159e+08),
    (1.184e-06, 5.103e+08),
    (1.186e-06, 5.187e+08),
    (1.188e-06, 5.075e+08),
    (1.190e-06, 5.085e+08),
    (1.192e-06, 5.161e+08),
    (1.194e-06, 5.145e+08),
    (1.196e-06, 5.084e+08),
    (1.198e-06, 4.943e+08),
    (1.200e-06, 5.003e+08),
    (1.202e-06, 5.068e+08),
    (1.204e-06, 4.948e+08),
    (1.206e-06, 5.039e+08),
    (1.208e-06, 4.890e+08),
    (1.210e-06, 4.882e+08),
    (1.212e-06, 4.933e+08),
    (1.214e-06, 4.942e+08),
    (1.216e-06, 4.930e+08),
    (1.218e-06, 4.897e+08),
    (1.220e-06, 4.875e+08),
    (1.222e-06, 4.854e+08),
    (1.224e-06, 4.846e+08),
    (1.226e-06, 4.817e+08),
    (1.228e-06, 4.771e+08),
    (1.230e-06, 4.792e+08),
    (1.232e-06, 4.750e+08),
    (1.234e-06, 4.729e+08),
    (1.236e-06, 4.719e+08),
    (1.238e-06, 4.703e+08),
    (1.240e-06, 4.653e+08),
    (1.242e-06, 4.642e+08),
    (1.244e-06, 4.619e+08),
    (1.246e-06, 4.635e+08),
    (1.248e-06, 4.633e+08),
    (1.250e-06, 4.624e+08),
    (1.252e-06, 4.571e+08),
    (1.254e-06, 4.574e+08),
    (1.256e-06, 4.551e+08),
    (1.258e-06, 4.533e+08),
    (1.260e-06, 4.530e+08),
    (1.262e-06, 4.497e+08),
    (1.264e-06, 4.478e+08),
    (1.266e-06, 4.467e+08),
    (1.268e-06, 4.417e+08),
    (1.270e-06, 4.453e+08),
    (1.272e-06, 4.452e+08),
    (1.274e-06, 4.431e+08),
    (1.276e-06, 4.451e+08),
    (1.278e-06, 4.440e+08),
    (1.280e-06, 4.356e+08),
    (1.282e-06, 4.014e+08),
    (1.284e-06, 4.259e+08),
    (1.286e-06, 4.328e+08),
    (1.288e-06, 4.314e+08),
    (1.290e-06, 4.255e+08),
    (1.292e-06, 4.254e+08),
    (1.294e-06, 4.223e+08),
    (1.296e-06, 4.224e+08),
    (1.298e-06, 4.184e+08),
    (1.300e-06, 4.186e+08),
    (1.302e-06, 4.139e+08),
    (1.304e-06, 4.111e+08),
    (1.306e-06, 4.136e+08),
    (1.308e-06, 4.123e+08),
    (1.310e-06, 4.106e+08),
    (1.312e-06, 4.033e+08),
    (1.314e-06, 4.022e+08),
    (1.316e-06, 3.979e+08),
    (1.318e-06, 4.017e+08),
    (1.320e-06, 4.016e+08),
    (1.322e-06, 3.986e+08),
    (1.324e-06, 3.981e+08),
    (1.326e-06, 3.949e+08),
    (1.328e-06, 3.908e+08),
    (1.330e-06, 3.878e+08),
    (1.332e-06, 3.863e+08),
    (1.334e-06, 3.892e+08),
    (1.336e-06, 3.866e+08),
    (1.338e-06, 3.832e+08),
    (1.340e-06, 3.790e+08),
    (1.342e-06, 3.805e+08),
    (1.344e-06, 3.798e+08),
    (1.346e-06, 3.772e+08),
    (1.348e-06, 3.766e+08),
    (1.350e-06, 3.724e+08),
    (1.352e-06, 3.742e+08),
    (1.354e-06, 3.722e+08),
    (1.356e-06, 3.675e+08),
    (1.358e-06, 3.688e+08),
    (1.360e-06, 3.673e+08),
    (1.362e-06, 3.677e+08),
    (1.364e-06, 3.657e+08),
    (1.366e-06, 3.657e+08),
    (1.368e-06, 3.628e+08),
    (1.370e-06, 3.599e+08),
    (1.372e-06, 3.621e+08),
    (1.374e-06, 3.611e+08),
    (1.376e-06, 3.561e+08),
    (1.378e-06, 3.580e+08),
    (1.380e-06, 3.579e+08),
    (1.382e-06, 3.545e+08),
    (1.384e-06, 3.547e+08),
    (1.386e-06, 3.532e+08),
    (1.388e-06, 3.530e+08),
    (1.390e-06, 3.506e+08),
    (1.392e-06, 3.513e+08),
    (1.394e-06, 3.488e+08),
    (1.396e-06, 3.487e+08),
    (1.398e-06, 3.492e+08),
    (1.400e-06, 3.427e+08),
    (1.402e-06, 3.439e+08),
    (1.404e-06, 3.428e+08),
    (1.406e-06, 3.431e+08),
    (1.408e-06, 3.427e+08),
    (1.410e-06, 3.418e+08),
    (1.412e-06, 3.348e+08),
    (1.414e-06, 3.377e+08),
    (1.416e-06, 3.385e+08),
    (1.418e-06, 3.386e+08),
    (1.420e-06, 3.357e+08),
    (1.422e-06, 3.315e+08),
    (1.424e-06, 3.311e+08),
    (1.426e-06, 3.281e+08),
    (1.428e-06, 3.285e+08),
    (1.430e-06, 3.257e+08),
    (1.432e-06, 3.300e+08),
    (1.434e-06, 3.284e+08),
    (1.436e-06, 3.285e+08),
    (1.438e-06, 3.283e+08),
    (1.440e-06, 3.188e+08),
    (1.442e-06, 3.186e+08),
    (1.444e-06, 3.197e+08),
    (1.446e-06, 3.216e+08),
    (1.448e-06, 3.216e+08),
    (1.450e-06, 3.187e+08),
    (1.452e-06, 3.154e+08),
    (1.454e-06, 3.143e+08),
    (1.456e-06, 3.131e+08),
    (1.458e-06, 3.167e+08),
    (1.460e-06, 3.156e+08),
    (1.462e-06, 3.121e+08),
    (1.464e-06, 3.105e+08),
    (1.466e-06, 3.108e+08),
    (1.468e-06, 3.114e+08),
    (1.470e-06, 3.102e+08),
    (1.472e-06, 3.073e+08),
    (1.474e-06, 3.034e+08),
    (1.476e-06, 3.048e+08),
    (1.478e-06, 3.044e+08),
    (1.480e-06, 3.068e+08),
    (1.482e-06, 3.044e+08),
    (1.484e-06, 3.039e+08),
    (1.486e-06, 3.033e+08),
    (1.488e-06, 2.855e+08),
    (1.490e-06, 3.015e+08),
    (1.492e-06, 3.018e+08),
    (1.494e-06, 3.033e+08),
    (1.496e-06, 2.972e+08),
    (1.498e-06, 2.994e+08),
    (1.500e-06, 3.011e+08),
    (1.502e-06, 2.924e+08),
    (1.504e-06, 2.799e+08),
    (1.506e-06, 2.848e+08),
    (1.508e-06, 2.919e+08),
    (1.510e-06, 2.947e+08),
    (1.512e-06, 2.913e+08),
    (1.514e-06, 2.883e+08),
    (1.516e-06, 2.882e+08),
    (1.518e-06, 2.884e+08),
    (1.520e-06, 2.866e+08),
    (1.522e-06, 2.824e+08),
    (1.524e-06, 2.835e+08),
    (1.526e-06, 2.846e+08),
    (1.528e-06, 2.846e+08),
    (1.530e-06, 2.765e+08),
    (1.532e-06, 2.823e+08),
    (1.534e-06, 2.784e+08),
    (1.536e-06, 2.806e+08),
    (1.538e-06, 2.773e+08),
    (1.540e-06, 2.730e+08),
    (1.542e-06, 2.753e+08),
    (1.544e-06, 2.778e+08),
    (1.546e-06, 2.772e+08),
    (1.548e-06, 2.711e+08),
    (1.550e-06, 2.713e+08),
    (1.552e-06, 2.731e+08),
    (1.554e-06, 2.676e+08),
    (1.556e-06, 2.671e+08),
    (1.558e-06, 2.689e+08),
    (1.560e-06, 2.683e+08),
    (1.562e-06, 2.697e+08),
    (1.564e-06, 2.669e+08),
    (1.566e-06, 2.654e+08),
    (1.568e-06, 2.633e+08),
    (1.570e-06, 2.645e+08),
    (1.572e-06, 2.673e+08),
    (1.574e-06, 2.610e+08),
    (1.576e-06, 2.536e+08),
    (1.578e-06, 2.547e+08),
    (1.580e-06, 2.650e+08),
    (1.582e-06, 2.590e+08),
    (1.584e-06, 2.591e+08),
    (1.586e-06, 2.599e+08),
    (1.588e-06, 2.490e+08),
    (1.590e-06, 2.405e+08),
    (1.592e-06, 2.526e+08),
    (1.594e-06, 2.583e+08),
    (1.596e-06, 2.506e+08),
    (1.598e-06, 2.545e+08),
    (1.600e-06, 2.512e+08),
    (1.602e-06, 2.489e+08),
    (1.604e-06, 2.497e+08),
    (1.606e-06, 2.477e+08),
    (1.608e-06, 2.491e+08),
    (1.610e-06, 2.400e+08),
    (1.612e-06, 2.430e+08),
    (1.614e-06, 2.449e+08),
    (1.616e-06, 2.374e+08),
    (1.618e-06, 2.423e+08),
    (1.620e-06, 2.369e+08),
    (1.622e-06, 2.383e+08),
    (1.624e-06, 2.416e+08),
    (1.626e-06, 2.402e+08),
    (1.628e-06, 2.418e+08),
    (1.630e-06, 2.393e+08),
    (1.632e-06, 2.387e+08),
    (1.634e-06, 2.359e+08),
    (1.636e-06, 2.357e+08),
    (1.638e-06, 2.274e+08),
    (1.640e-06, 2.262e+08),
    (1.642e-06, 2.266e+08),
    (1.644e-06, 2.278e+08),
    (1.646e-06, 2.294e+08),
    (1.648e-06, 2.292e+08),
    (1.650e-06, 2.272e+08),
    (1.652e-06, 2.268e+08),
    (1.654e-06, 2.262e+08),
    (1.656e-06, 2.260e+08),
    (1.658e-06, 2.252e+08),
    (1.660e-06, 2.245e+08),
    (1.662e-06, 2.246e+08),
    (1.664e-06, 2.227e+08),
    (1.666e-06, 2.212e+08),
    (1.668e-06, 2.193e+08),
    (1.670e-06, 2.225e+08),
    (1.672e-06, 2.173e+08),
    (1.674e-06, 2.193e+08),
    (1.676e-06, 2.161e+08),
    (1.678e-06, 2.168e+08),
    (1.680e-06, 2.080e+08),
    (1.682e-06, 2.054e+08),
    (1.684e-06, 2.129e+08),
    (1.686e-06, 2.131e+08),
    (1.688e-06, 2.120e+08),
    (1.690e-06, 2.105e+08),
    (1.692e-06, 2.123e+08),
    (1.694e-06, 2.112e+08),
    (1.696e-06, 2.100e+08),
    (1.698e-06, 2.089e+08),
    (1.700e-06, 2.063e+08),
    (1.702e-06, 2.047e+08),
    (1.704e-06, 2.052e+08),
    (1.706e-06, 2.050e+08),
    (1.708e-06, 2.017e+08),
    (1.710e-06, 2.013e+08),
    (1.712e-06, 1.982e+08),
    (1.714e-06, 2.037e+08),
    (1.716e-06, 2.022e+08),
    (1.718e-06, 2.010e+08),
    (1.720e-06, 1.993e+08),
    (1.722e-06, 1.975e+08),
    (1.724e-06, 1.954e+08),
    (1.726e-06, 1.982e+08),
    (1.728e-06, 1.971e+08),
    (1.730e-06, 1.984e+08),
    (1.732e-06, 1.936e+08),
    (1.734e-06, 1.874e+08),
    (1.736e-06, 1.827e+08),
    (1.738e-06, 1.863e+08),
    (1.740e-06, 1.905e+08),
    (1.742e-06, 1.902e+08),
    (1.744e-06, 1.907e+08),
    (1.746e-06, 1.867e+08),
    (1.748e-06, 1.872e+08),
    (1.750e-06, 1.858e+08),
    (1.752e-06, 1.850e+08),
    (1.754e-06, 1.856e+08),
    (1.756e-06, 1.849e+08),
    (1.758e-06, 1.843e+08),
    (1.760e-06, 1.831e+08),
    (1.762e-06, 1.793e+08),
    (1.764e-06, 1.807e+08),
    (1.766e-06, 1.817e+08),
    (1.768e-06, 1.802e+08),
    (1.770e-06, 1.791e+08),
    (1.772e-06, 1.794e+08),
    (1.774e-06, 1.792e+08),
    (1.776e-06, 1.763e+08),
    (1.778e-06, 1.747e+08),
    (1.780e-06, 1.756e+08),
    (1.782e-06, 1.747e+08),
    (1.784e-06, 1.735e+08),
    (1.786e-06, 1.739e+08),
    (1.788e-06, 1.747e+08),
    (1.790e-06, 1.733e+08),
    (1.792e-06, 1.721e+08),
    (1.794e-06, 1.709e+08),
    (1.796e-06, 1.706e+08),
    (1.798e-06, 1.703e+08),
    (1.800e-06, 1.699e+08),
    (1.802e-06, 1.672e+08),
    (1.804e-06, 1.688e+08),
    (1.806e-06, 1.688e+08),
    (1.808e-06, 1.685e+08),
    (1.810e-06, 1.686e+08),
    (1.812e-06, 1.675e+08),
    (1.814e-06, 1.658e+08),
    (1.816e-06, 1.605e+08),
    (1.818e-06, 1.520e+08),
    (1.820e-06, 1.596e+08),
    (1.822e-06, 1.598e+08),
    (1.824e-06, 1.624e+08),
    (1.826e-06, 1.628e+08),
    (1.828e-06, 1.611e+08),
    (1.830e-06, 1.606e+08),
    (1.832e-06, 1.593e+08),
    (1.834e-06, 1.585e+08),
    (1.836e-06, 1.581e+08),
    (1.838e-06, 1.562e+08),
    (1.840e-06, 1.562e+08),
    (1.842e-06, 1.540e+08),
    (1.844e-06, 1.541e+08),
    (1.846e-06, 1.535e+08),
    (1.848e-06, 1.510e+08),
    (1.850e-06, 1.546e+08),
    (1.852e-06, 1.534e+08),
    (1.854e-06, 1.525e+08),
    (1.856e-06, 1.509e+08),
    (1.858e-06, 1.525e+08),
    (1.860e-06, 1.503e+08),
    (1.862e-06, 1.504e+08),
    (1.864e-06, 1.509e+08),
    (1.866e-06, 1.494e+08),
    (1.868e-06, 1.492e+08),
    (1.870e-06, 1.508e+08),
    (1.872e-06, 1.473e+08),
    (1.874e-06, 1.401e+08),
    (1.876e-06, 1.299e+08),
    (1.878e-06, 1.441e+08),
    (1.880e-06, 1.462e+08),
    (1.882e-06, 1.474e+08),
    (1.884e-06, 1.464e+08),
    (1.886e-06, 1.439e+08),
    (1.888e-06, 1.453e+08),
    (1.890e-06, 1.424e+08),
    (1.892e-06, 1.408e+08),
    (1.894e-06, 1.396e+08),
    (1.896e-06, 1.373e+08),
    (1.898e-06, 1.390e+08),
    (1.900e-06, 1.397e+08),
    (1.902e-06, 1.409e+08),
    (1.904e-06, 1.386e+08),
    (1.906e-06, 1.390e+08),
    (1.908e-06, 1.377e+08),
    (1.910e-06, 1.378e+08),
    (1.912e-06, 1.354e+08),
    (1.914e-06, 1.370e+08),
    (1.916e-06, 1.360e+08),
    (1.918e-06, 1.353e+08),
    (1.920e-06, 1.333e+08),
    (1.922e-06, 1.350e+08),
    (1.924e-06, 1.341e+08),
    (1.926e-06, 1.344e+08),
    (1.928e-06, 1.322e+08),
    (1.930e-06, 1.313e+08),
    (1.932e-06, 1.308e+08),
    (1.934e-06, 1.320e+08),
    (1.936e-06, 1.328e+08),
    (1.938e-06, 1.321e+08),
    (1.940e-06, 1.299e+08),
    (1.942e-06, 1.294e+08),
    (1.944e-06, 1.203e+08),
    (1.946e-06, 1.192e+08),
    (1.948e-06, 1.271e+08),
    (1.950e-06, 1.261e+08),
    (1.952e-06, 1.255e+08),
    (1.954e-06, 1.286e+08),
    (1.956e-06, 1.276e+08),
    (1.958e-06, 1.271e+08),
    (1.960e-06, 1.261e+08),
    (1.962e-06, 1.240e+08),
    (1.964e-06, 1.222e+08),
    (1.966e-06, 1.231e+08),
    (1.968e-06, 1.240e+08),
    (1.970e-06, 1.239e+08),
    (1.972e-06, 1.213e+08),
    (1.974e-06, 1.208e+08),
    (1.976e-06, 1.224e+08),
    (1.978e-06, 1.194e+08),
    (1.980e-06, 1.196e+08),
    (1.982e-06, 1.205e+08),
    (1.984e-06, 1.197e+08),
    (1.986e-06, 1.178e+08),
    (1.988e-06, 1.195e+08),
    (1.990e-06, 1.198e+08),
    (1.992e-06, 1.180e+08),
    (1.994e-06, 1.162e+08),
    (1.996e-06, 1.173e+08),
    (1.998e-06, 1.159e+08),
    (2.000e-06, 1.170e+08),
    (2.002e-06, 1.161e+08),
    (2.004e-06, 1.148e+08),
    (2.006e-06, 1.147e+08),
    (2.008e-06, 1.154e+08),
    (2.010e-06, 1.149e+08),
    (2.012e-06, 1.145e+08),
    (2.014e-06, 1.138e+08),
    (2.016e-06, 1.137e+08),
    (2.018e-06, 1.134e+08),
    (2.020e-06, 1.116e+08),
    (2.022e-06, 1.107e+08),
    (2.024e-06, 1.116e+08),
    (2.026e-06, 1.115e+08),
    (2.028e-06, 1.107e+08),
    (2.030e-06, 1.086e+08),
    (2.032e-06, 1.098e+08),
    (2.034e-06, 1.092e+08),
    (2.036e-06, 1.083e+08),
    (2.038e-06, 1.064e+08),
    (2.040e-06, 1.078e+08),
    (2.042e-06, 1.076e+08),
    (2.044e-06, 1.076e+08),
    (2.046e-06, 1.071e+08),
    (2.048e-06, 1.063e+08),
    (2.050e-06, 1.059e+08),
    (2.052e-06, 1.047e+08),
    (2.054e-06, 1.046e+08),
    (2.056e-06, 1.046e+08),
    (2.058e-06, 1.040e+08),
    (2.060e-06, 1.028e+08),
    (2.062e-06, 1.023e+08),
    (2.064e-06, 1.005e+08),
    (2.066e-06, 1.025e+08),
    (2.068e-06, 1.019e+08),
    (2.070e-06, 1.003e+08),
    (2.072e-06, 1.004e+08),
    (2.074e-06, 1.009e+08),
    (2.076e-06, 1.006e+08),
    (2.078e-06, 1.000e+08),
    (2.080e-06, 9.878e+07),
    (2.082e-06, 9.864e+07),
    (2.084e-06, 9.772e+07),
    (2.086e-06, 9.852e+07),
    (2.088e-06, 9.835e+07),
    (2.090e-06, 9.788e+07),
    (2.092e-06, 9.567e+07),
    (2.094e-06, 9.593e+07),
    (2.096e-06, 9.580e+07),
    (2.098e-06, 9.620e+07),
    (2.100e-06, 9.606e+07),
    (2.102e-06, 9.577e+07),
    (2.104e-06, 9.559e+07),
    (2.106e-06, 9.574e+07),
    (2.108e-06, 9.513e+07),
    (2.110e-06, 9.396e+07),
    (2.112e-06, 9.452e+07),
    (2.114e-06, 9.436e+07),
    (2.116e-06, 9.331e+07),
    (2.118e-06, 9.311e+07),
    (2.120e-06, 9.275e+07),
    (2.122e-06, 9.275e+07),
    (2.124e-06, 9.189e+07),
    (2.126e-06, 9.208e+07),
    (2.128e-06, 9.225e+07),
    (2.130e-06, 9.209e+07),
    (2.132e-06, 9.210e+07),
    (2.134e-06, 9.155e+07),
    (2.136e-06, 9.012e+07),
    (2.138e-06, 9.110e+07),
    (2.140e-06, 9.083e+07),
    (2.142e-06, 9.064e+07),
    (2.144e-06, 9.006e+07),
    (2.146e-06, 8.939e+07),
    (2.148e-06, 8.979e+07),
    (2.150e-06, 8.957e+07),
    (2.152e-06, 8.913e+07),
    (2.154e-06, 8.878e+07),
    (2.156e-06, 8.874e+07),
    (2.158e-06, 8.842e+07),
    (2.160e-06, 8.781e+07),
    (2.162e-06, 8.686e+07),
    (2.164e-06, 8.456e+07),
    (2.166e-06, 7.849e+07),
    (2.168e-06, 8.300e+07),
    (2.170e-06, 8.557e+07),
    (2.172e-06, 8.591e+07),
    (2.174e-06, 8.592e+07),
    (2.176e-06, 8.532e+07),
    (2.178e-06, 8.425e+07),
    (2.180e-06, 8.497e+07),
    (2.182e-06, 8.425e+07),
    (2.184e-06, 8.457e+07),
    (2.186e-06, 8.465e+07),
    (2.188e-06, 8.277e+07),
    (2.190e-06, 8.304e+07),
    (2.192e-06, 8.377e+07),
    (2.194e-06, 8.349e+07),
    (2.196e-06, 8.318e+07),
    (2.198e-06, 8.299e+07),
    (2.200e-06, 8.265e+07),
    (2.202e-06, 8.230e+07),
    (2.204e-06, 8.211e+07),
    (2.206e-06, 7.966e+07),
    (2.208e-06, 7.966e+07),
    (2.210e-06, 8.080e+07),
    (2.212e-06, 8.105e+07),
    (2.214e-06, 8.072e+07),
    (2.216e-06, 7.994e+07),
    (2.218e-06, 7.970e+07),
    (2.220e-06, 7.997e+07),
    (2.222e-06, 7.962e+07),
    (2.224e-06, 7.926e+07),
    (2.226e-06, 7.811e+07),
    (2.228e-06, 7.826e+07),
    (2.230e-06, 7.831e+07),
    (2.232e-06, 7.815e+07),
    (2.234e-06, 7.802e+07),
    (2.236e-06, 7.758e+07),
    (2.238e-06, 7.648e+07),
    (2.240e-06, 7.639e+07),
    (2.242e-06, 7.642e+07),
    (2.244e-06, 7.624e+07),
    (2.246e-06, 7.612e+07),
    (2.248e-06, 7.520e+07),
    (2.250e-06, 7.541e+07),
    (2.252e-06, 7.512e+07),
    (2.254e-06, 7.402e+07),
    (2.256e-06, 7.422e+07),
    (2.258e-06, 7.441e+07),
    (2.260e-06, 7.421e+07),
    (2.262e-06, 7.299e+07),
    (2.264e-06, 7.329e+07),
    (2.266e-06, 7.315e+07),
    (2.268e-06, 7.327e+07),
    (2.270e-06, 7.297e+07),
    (2.272e-06, 7.277e+07),
    (2.274e-06, 7.252e+07),
    (2.276e-06, 7.239e+07),
    (2.278e-06, 7.242e+07),
    (2.280e-06, 7.165e+07),
    (2.282e-06, 7.007e+07),
    (2.284e-06, 7.125e+07),
    (2.286e-06, 7.124e+07),
    (2.288e-06, 7.127e+07),
    (2.290e-06, 7.110e+07),
    (2.292e-06, 7.067e+07),
    (2.294e-06, 6.920e+07),
    (2.296e-06, 6.908e+07),
    (2.298e-06, 6.919e+07),
    (2.300e-06, 6.953e+07),
    (2.302e-06, 6.955e+07),
    (2.304e-06, 6.931e+07),
    (2.306e-06, 6.923e+07),
    (2.308e-06, 6.901e+07),
    (2.310e-06, 6.870e+07),
    (2.312e-06, 6.867e+07),
    (2.314e-06, 6.826e+07),
    (2.316e-06, 6.779e+07),
    (2.318e-06, 6.745e+07),
    (2.320e-06, 6.768e+07),
    (2.322e-06, 6.675e+07),
    (2.324e-06, 6.536e+07),
    (2.326e-06, 6.559e+07),
    (2.328e-06, 6.629e+07),
    (2.330e-06, 6.616e+07),
    (2.332e-06, 6.584e+07),
    (2.334e-06, 6.571e+07),
    (2.336e-06, 6.536e+07),
    (2.338e-06, 6.496e+07),
    (2.340e-06, 6.520e+07),
    (2.342e-06, 6.539e+07),
    (2.344e-06, 6.509e+07),
    (2.346e-06, 6.486e+07),
    (2.348e-06, 6.472e+07),
    (2.350e-06, 6.453e+07),
    (2.352e-06, 6.289e+07),
    (2.354e-06, 6.239e+07),
    (2.356e-06, 6.282e+07),
    (2.358e-06, 6.266e+07),
    (2.360e-06, 6.308e+07),
    (2.362e-06, 6.305e+07),
    (2.364e-06, 6.295e+07),
    (2.366e-06, 6.284e+07),
    (2.368e-06, 6.263e+07),
    (2.370e-06, 6.211e+07),
    (2.372e-06, 6.207e+07),
    (2.374e-06, 6.066e+07),
    (2.376e-06, 6.164e+07),
    (2.378e-06, 6.192e+07),
    (2.380e-06, 6.172e+07),
    (2.382e-06, 6.098e+07),
    (2.384e-06, 5.885e+07),
    (2.386e-06, 5.908e+07),
    (2.388e-06, 6.004e+07),
    (2.390e-06, 6.029e+07),
    (2.392e-06, 6.008e+07),
    (2.394e-06, 6.003e+07),
    (2.396e-06, 5.996e+07),
    (2.398e-06, 5.989e+07),
    (2.400e-06, 5.944e+07),
    (2.402e-06, 5.965e+07),
    (2.404e-06, 5.945e+07),
    (2.406e-06, 5.919e+07),
    (2.408e-06, 5.915e+07),
    (2.410e-06, 5.902e+07),
    (2.412e-06, 5.894e+07),
    (2.414e-06, 5.734e+07),
    (2.416e-06, 5.599e+07),
    (2.418e-06, 5.748e+07),
    (2.420e-06, 5.770e+07),
    (2.422e-06, 5.767e+07),
    (2.424e-06, 5.726e+07),
    (2.426e-06, 5.717e+07),
    (2.428e-06, 5.712e+07),
    (2.430e-06, 5.712e+07),
    (2.432e-06, 5.702e+07),
    (2.434e-06, 5.641e+07),
    (2.436e-06, 5.618e+07),
    (2.438e-06, 5.599e+07),
    (2.440e-06, 5.639e+07),
    (2.442e-06, 5.617e+07),
    (2.444e-06, 5.603e+07),
    (2.446e-06, 5.498e+07),
    (2.448e-06, 5.457e+07),
    (2.450e-06, 5.462e+07),
    (2.452e-06, 5.432e+07),
    (2.454e-06, 5.455e+07),
    (2.456e-06, 5.370e+07),
    (2.458e-06, 5.392e+07),
    (2.460e-06, 5.457e+07),
    (2.462e-06, 5.442e+07),
    (2.464e-06, 5.435e+07),
    (2.466e-06, 5.405e+07),
    (2.468e-06, 5.390e+07),
    (2.470e-06, 5.285e+07),
    (2.472e-06, 5.330e+07),
    (2.474e-06, 5.313e+07),
    (2.476e-06, 5.343e+07),
    (2.478e-06, 5.303e+07),
    (2.480e-06, 5.177e+07),
    (2.482e-06, 5.140e+07),
    (2.484e-06, 5.219e+07),
    (2.486e-06, 5.160e+07),
    (2.488e-06, 5.169e+07),
    (2.490e-06, 5.225e+07),
    (2.492e-06, 5.198e+07),
    (2.494e-06, 5.175e+07),
    (2.496e-06, 5.152e+07),
    (2.498e-06, 5.154e+07),
    (2.500e-06, 5.155e+07),
    (2.520e-06, 4.984e+07),
    (2.540e-06, 4.814e+07),
    (2.560e-06, 4.672e+07),
    (2.580e-06, 4.550e+07),
    (2.600e-06, 4.457e+07),
    (2.620e-06, 4.305e+07),
    (2.640e-06, 4.211e+07),
    (2.660e-06, 4.079e+07),
    (2.680e-06, 3.968e+07),
    (2.700e-06, 3.867e+07),
    (2.720e-06, 3.763e+07),
    (2.740e-06, 3.663e+07),
    (2.760e-06, 3.546e+07),
    (2.780e-06, 3.468e+07),
    (2.800e-06, 3.385e+07),
    (2.820e-06, 3.297e+07),
    (2.840e-06, 3.209e+07),
    (2.860e-06, 3.119e+07),
    (2.880e-06, 3.032e+07),
    (2.900e-06, 2.969e+07),
    (2.920e-06, 2.890e+07),
    (2.940e-06, 2.817e+07),
    (2.960e-06, 2.750e+07),
    (2.980e-06, 2.682e+07),
    (3.000e-06, 2.612e+07),
    (3.020e-06, 2.547e+07),
    (3.040e-06, 2.465e+07),
    (3.060e-06, 2.422e+07),
    (3.080e-06, 2.364e+07),
    (3.100e-06, 2.306e+07),
    (3.120e-06, 2.246e+07),
    (3.140e-06, 2.198e+07),
    (3.160e-06, 2.144e+07),
    (3.180e-06, 2.096e+07),
    (3.200e-06, 2.048e+07),
    (3.220e-06, 2.000e+07),
    (3.240e-06, 1.951e+07),
    (3.260e-06, 1.907e+07),
    (3.280e-06, 1.858e+07),
    (3.300e-06, 1.802e+07),
    (3.320e-06, 1.768e+07),
    (3.340e-06, 1.737e+07),
    (3.360e-06, 1.697e+07),
    (3.380e-06, 1.659e+07),
    (3.400e-06, 1.615e+07),
    (3.420e-06, 1.584e+07),
    (3.440e-06, 1.554e+07),
    (3.460e-06, 1.520e+07),
    (3.480e-06, 1.486e+07),
    (3.500e-06, 1.456e+07),
    (3.520e-06, 1.425e+07),
    (3.540e-06, 1.393e+07),
    (3.560e-06, 1.362e+07),
    (3.580e-06, 1.334e+07),
    (3.600e-06, 1.307e+07),
    (3.620e-06, 1.281e+07),
    (3.640e-06, 1.251e+07),
    (3.660e-06, 1.222e+07),
    (3.680e-06, 1.193e+07),
    (3.700e-06, 1.162e+07),
    (3.720e-06, 1.145e+07),
    (3.740e-06, 1.108e+07),
    (3.760e-06, 1.096e+07),
    (3.780e-06, 1.078e+07),
    (3.800e-06, 1.057e+07),
    (3.820e-06, 1.038e+07),
    (3.840e-06, 1.019e+07),
    (3.860e-06, 9.983e+06),
    (3.880e-06, 9.782e+06),
    (3.900e-06, 9.599e+06),
    (3.920e-06, 9.427e+06),
    (3.940e-06, 9.233e+06),
    (3.960e-06, 9.032e+06),
    (3.980e-06, 8.857e+06),
    (4.000e-06, 8.669e+06),
    (4.020e-06, 8.557e+06),
    (4.040e-06, 8.385e+06),
    (4.060e-06, 8.217e+06),
    (4.080e-06, 8.054e+06),
    (4.100e-06, 7.894e+06),
    (4.120e-06, 7.739e+06),
    (4.140e-06, 7.587e+06),
    (4.160e-06, 7.439e+06),
    (4.180e-06, 7.294e+06),
    (4.200e-06, 7.153e+06),
    (4.220e-06, 7.015e+06),
    (4.240e-06, 6.881e+06),
    (4.260e-06, 6.749e+06),
    (4.280e-06, 6.621e+06),
    (4.300e-06, 6.496e+06),
    (4.320e-06, 6.374e+06),
    (4.340e-06, 6.254e+06),
    (4.360e-06, 6.138e+06),
    (4.380e-06, 6.024e+06),
    (4.400e-06, 5.913e+06),
    (4.420e-06, 5.804e+06),
    (4.440e-06, 5.698e+06),
    (4.460e-06, 5.594e+06),
    (4.480e-06, 5.492e+06),
    (4.500e-06, 5.393e+06),
    (4.520e-06, 5.296e+06),
    (4.540e-06, 5.201e+06),
    (4.560e-06, 5.108e+06),
    (4.580e-06, 5.018e+06),
    (4.600e-06, 4.929e+06),
    (4.620e-06, 4.842e+06),
    (4.640e-06, 4.757e+06),
    (4.660e-06, 4.674e+06),
    (4.680e-06, 4.593e+06),
    (4.700e-06, 4.514e+06),
    (4.720e-06, 4.436e+06),
    (4.740e-06, 4.360e+06),
    (4.760e-06, 4.285e+06),
    (4.780e-06, 4.212e+06),
    (4.800e-06, 4.141e+06),
    (4.820e-06, 4.071e+06),
    (4.840e-06, 4.003e+06),
    (4.860e-06, 3.936e+06),
    (4.880e-06, 3.870e+06),
    (4.900e-06, 3.806e+06),
    (4.920e-06, 3.743e+06),
    (4.940e-06, 3.681e+06),
    (4.960e-06, 3.621e+06),
    (4.980e-06, 3.562e+06),
    (5.000e-06, 3.504e+06),
    (5.050e-06, 3.394e+06),
    (5.100e-06, 3.267e+06),
    (5.150e-06, 3.146e+06),
    (5.200e-06, 3.030e+06),
    (5.250e-06, 2.920e+06),
    (5.300e-06, 2.815e+06),
    (5.350e-06, 2.715e+06),
    (5.400e-06, 2.619e+06),
    (5.450e-06, 2.527e+06),
    (5.500e-06, 2.439e+06),
    (5.550e-06, 2.355e+06),
    (5.600e-06, 2.275e+06),
    (5.650e-06, 2.198e+06),
    (5.700e-06, 2.124e+06),
    (5.750e-06, 2.054e+06),
    (5.800e-06, 1.986e+06),
    (5.850e-06, 1.921e+06),
    (5.900e-06, 1.859e+06),
    (5.950e-06, 1.799e+06),
    (6.000e-06, 1.742e+06),
    (6.050e-06, 1.687e+06),
    (6.100e-06, 1.634e+06),
    (6.150e-06, 1.583e+06),
    (6.200e-06, 1.534e+06),
    (6.250e-06, 1.487e+06),
    (6.300e-06, 1.442e+06),
    (6.350e-06, 1.399e+06),
    (6.400e-06, 1.357e+06),
    (6.450e-06, 1.317e+06),
    (6.500e-06, 1.278e+06),
    (6.550e-06, 1.240e+06),
    (6.600e-06, 1.204e+06),
    (6.650e-06, 1.170e+06),
    (6.700e-06, 1.136e+06),
    (6.750e-06, 1.104e+06),
    (6.800e-06, 1.073e+06),
    (6.850e-06, 1.043e+06),
    (6.900e-06, 1.014e+06),
    (6.950e-06, 9.862e+05),
    (7.000e-06, 9.592e+05),
    (7.050e-06, 9.331e+05),
    (7.100e-06, 9.080e+05),
    (7.150e-06, 8.836e+05),
    (7.200e-06, 8.601e+05),
    (7.250e-06, 8.374e+05),
    (7.300e-06, 8.154e+05),
    (7.350e-06, 7.942e+05),
    (7.400e-06, 7.736e+05),
    (7.450e-06, 7.537e+05),
    (7.500e-06, 7.344e+05),
    (7.550e-06, 7.158e+05),
    (7.600e-06, 6.977e+05),
    (7.650e-06, 6.802e+05),
    (7.700e-06, 6.633e+05),
    (7.750e-06, 6.469e+05),
    (7.800e-06, 6.310e+05),
    (7.850e-06, 6.156e+05),
    (7.900e-06, 6.006e+05),
    (7.950e-06, 5.862e+05),
    (8.000e-06, 5.721e+05),
    (8.050e-06, 5.585e+05),
    (8.100e-06, 5.453e+05),
    (8.150e-06, 5.324e+05),
    (8.200e-06, 5.200e+05),
    (8.250e-06, 5.079e+05),
    (8.300e-06, 4.961e+05),
    (8.350e-06, 4.847e+05),
    (8.400e-06, 4.737e+05),
    (8.450e-06, 4.629e+05),
    (8.500e-06, 4.525e+05),
    (8.550e-06, 4.423e+05),
    (8.600e-06, 4.324e+05),
    (8.650e-06, 4.228e+05),
    (8.700e-06, 4.135e+05),
    (8.750e-06, 4.044e+05),
    (8.800e-06, 3.956e+05),
    (8.850e-06, 3.870e+05),
    (8.900e-06, 3.787e+05),
    (8.950e-06, 3.706e+05),
    (9.000e-06, 3.627e+05),
    (9.050e-06, 3.550e+05),
    (9.100e-06, 3.475e+05),
    (9.150e-06, 3.402e+05),
    (9.200e-06, 3.331e+05),
    (9.250e-06, 3.262e+05),
    (9.300e-06, 3.195e+05),
    (9.350e-06, 3.129e+05),
    (9.400e-06, 3.065e+05),
    (9.450e-06, 3.003e+05),
    (9.500e-06, 2.942e+05),
    (9.550e-06, 2.883e+05),
    (9.600e-06, 2.825e+05),
    (9.650e-06, 2.769e+05),
    (9.700e-06, 2.714e+05),
    (9.750e-06, 2.661e+05),
    (9.800e-06, 2.608e+05),
    (9.850e-06, 2.558e+05),
    (9.900e-06, 2.508e+05),
    (9.950e-06, 2.460e+05),
    (1.000e-05, 2.412e+05),
    (1.100e-05, 1.635e+05),
    (1.200e-05, 1.152e+05),
    (1.300e-05, 8.340e+04),
    (1.400e-05, 6.190e+04),
    (1.500e-05, 4.690e+04),
    (1.600e-05, 3.610e+04),
    (1.700e-05, 2.830e+04),
    (1.800e-05, 2.250e+04),
    (1.900e-05, 1.810e+04),
    (2.000e-05, 1.470e+04),
    (2.500e-05, 6.050e+03),
    (3.000e-05, 2.930e+03),
    (3.500e-05, 1.580e+03),
    (4.000e-05, 9.310e+02),
    (5.000e-05, 3.830e+02),
    (6.000e-05, 1.850e+02),
    (8.000e-05, 5.880e+01),
    (1.000e-04, 2.420e+01),
    (1.200e-04, 1.170e+01),
    (1.500e-04, 4.810e+00),
    (2.000e-04, 1.530e+00),
    (2.500e-04, 6.280e-01),
    (3.000e-04, 2.950e-01),
    (4.000e-04, 1.010e-01),
    (1.000e-03, 3.380e-03),
))

if __name__ == '__main__':
    #    cam = RosettaSystemModel(focused_attenuated=False).cam
    cam = DidymosSystemModel(use_narrow_cam=False).cam

    v = tools.q_times_v(tools.ypr_to_q(0, math.radians(10), 0), [1, 0, 0])
    print('v: %s' % (v,))
    flux_density = Sun.flux_density(cam, v * Sun.AU * 1.2)  # [0.31622777, 0.9486833, 0]
    img = cam.sense(flux_density, exposure=0.001, gain=1)

    img = np.clip(img * 255, 0, 255).astype('uint8')
    # img = ImageProc.adjust_gamma(img, 1.8)

    sc = min(768 / cam.width, 768 / cam.height)
    cv2.imshow('sun', cv2.resize(img, None, fx=sc, fy=sc))
    cv2.waitKey()

max_stars_repo_name: oknuutti/visnav-py

max_issues_repo_name: oknuutti/visnav-py

max_forks_repo_name: oknuutti/visnav-py

reason: import numpy,import scipy,from scipy


text:
from sympy import Symbol, exp, log, sqrt, O, oo, sin, cos, PoleError
from sympy.abc import x

from sympy.testing.pytest import raises

def test_simple():
    # Gruntz' theses pp. 91 to 96
    # 6.6
    e = sin(1 / x + exp(-x)) - sin(1 / x)
    assert e.aseries(x) == (
        1 / (24 * x ** 4) - 1 / (2 * x ** 2) + 1 + O(x ** (-6), (x, oo))
    ) * exp(-x)

    e = exp(x) * (exp(1 / x + exp(-x)) - exp(1 / x))
    assert e.aseries(x, n=4) == 1 / (6 * x ** 3) + 1 / (2 * x ** 2) + 1 / x + 1 + O(
        x ** (-4), (x, oo)
    )

    e = exp(exp(x) / (1 - 1 / x))
    assert e.aseries(x) == exp(exp(x) / (1 - 1 / x))
    assert e.aseries(x, bound=3) == exp(exp(x) / x ** 2) * exp(exp(x) / x) * exp(
        -exp(x) + exp(x) / (1 - 1 / x) - exp(x) / x - exp(x) / x ** 2
    ) * exp(exp(x))

    e = exp(sin(1 / x + exp(-exp(x)))) - exp(sin(1 / x))
    assert e.aseries(x, n=4) == (
        -1 / (2 * x ** 3) + 1 / x + 1 + O(x ** (-4), (x, oo))
    ) * exp(-exp(x))

    e = exp(exp(x)) * (exp(sin(1 / x + 1 / exp(exp(x)))) - exp(sin(1 / x)))
    assert e.aseries(x, n=4) == -1 / (2 * x ** 3) + 1 / x + 1 + O(x ** (-4), (x, oo))

    n = Symbol("n", integer=True)
    e = (
        sqrt(n)
        * log(n) ** 2
        * exp(
            sqrt(log(n))
            * log(log(n)) ** 2
            * exp(sqrt(log(log(n))) * log(log(log(n))) ** 3)
        )
    ) / n
    assert e.aseries(n) == exp(
        exp(sqrt(log(log(n))) * log(log(log(n))) ** 3) * sqrt(log(n)) * log(log(n)) ** 2
    ) * log(n) ** 2 / sqrt(n)

def test_hierarchical():
    e = sin(1 / x + exp(-x))
    assert e.aseries(x, n=3, hir=True) == -exp(-2 * x) * sin(1 / x) / 2 + exp(-x) * cos(
        1 / x
    ) + sin(1 / x) + O(exp(-3 * x), (x, oo))

    e = sin(x) * cos(exp(-x))
    assert e.aseries(x, hir=True) == exp(-4 * x) * sin(x) / 24 - exp(-2 * x) * sin(
        x
    ) / 2 + sin(x) + O(exp(-6 * x), (x, oo))
    raises(PoleError, lambda: e.aseries(x))

ext: py

max_stars_repo_name: msgoff/sympy

max_issues_repo_name: msgoff/sympy

max_forks_repo_name: msgoff/sympy

reason: from sympy


text:
""" Utility class for saving / restoring state of the global random number generators. """
from __future__ import annotations

import random
from dataclasses import dataclass, replace
from typing import Any, Dict, List, Optional

import numpy as np

try:
    import torch
except ImportError as err:
    TORCH_INSTALLED = False
else:
    TORCH_INSTALLED = True

@dataclass(frozen=True)
class RandomState:
    """Immutable dataclass that holds the state of the various random number generators."""

    random_state: Any
    """ RNG state for the `random` module. """

    numpy_rng_state: Dict[str, Any]
    """ RNG state for the `numpy.random` module. """

    if TORCH_INSTALLED:
        torch_rng_state: torch.Tensor
        """ RNG state for the `torch` module. """

        torch_cuda_rng_state: List[torch.Tensor]
        """ RNG states for the `torch.cuda` module, for each cuda device available. """

    base_seed: Optional[int] = None
    """Base seed that was used to create this object (the `seed` argument to `RandomState.seed`)."""

    @classmethod
    def current(cls) -> RandomState:
        """Returns the current random state.

        NOTE: The `base_seed` of the returned object will be None.
        """
        kwargs: dict[str, Any] = dict(
            random_state=random.getstate(),
            numpy_rng_state=np.random.get_state(),
        )
        if TORCH_INSTALLED:
            kwargs.update(
                torch_rng_state=torch.get_rng_state(),
                torch_cuda_rng_state=torch.cuda.get_rng_state_all(),
            )
        return cls(**kwargs)

    def set(self) -> None:
        """Sets the random state using the values in `self`."""
        random.setstate(self.random_state)
        np.random.set_state(self.numpy_rng_state)
        if TORCH_INSTALLED:
            torch.random.set_rng_state(self.torch_rng_state)
            torch.cuda.set_rng_state_all(self.torch_cuda_rng_state)

    @classmethod
    def seed(cls, base_seed: Optional[int]) -> RandomState:
        """Seeds all the RNGs using the given seed, and returns the resulting RandomState object."""
        random.seed(base_seed)
        numpy_seed = random.randint(0, 2**32 - 1)
        # NOTE: Always create the torch seed, even if torch is not installed.
        torch_seed = random.randint(0, 2**32 - 1)
        np.random.seed(numpy_seed)
        if TORCH_INSTALLED:
            torch.random.manual_seed(torch_seed)
            torch.cuda.manual_seed_all(torch_seed)

        random_state = cls.current()
        if base_seed is not None:
            # Add the base_seed property in this case.
            random_state = replace(random_state, base_seed=base_seed)
        return random_state

max_stars_repo_name: dendisuhubdy/evolve

max_issues_repo_name: dendisuhubdy/evolve

max_forks_repo_name: dendisuhubdy/evolve

reason: import numpy


text:
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.
""" Tests for _prony.py"""
import pytest
import numpy
from ._prony import prony

def test_zeros():
    signal = numpy.zeros(10)
    amplitudes, phases = prony(signal)
    assert (len(amplitudes) == 5)
    assert (len(phases) == 5)
    for j in range(5):
        numpy.testing.assert_allclose(amplitudes[j], 0)
        numpy.testing.assert_allclose(phases[j], 0)

def test_signal():
    x_vec = numpy.linspace(0, 1, 11)
    y_vec = (0.5 * numpy.exp(1j * x_vec * 3) + 0.3 * numpy.exp(1j * x_vec * 5) +
             0.15 * numpy.exp(1j * x_vec * 1.5) +
             0.1 * numpy.exp(1j * x_vec * 4) +
             0.05 * numpy.exp(1j * x_vec * 1.2))
    print(y_vec)
    amplitudes, phases = prony(y_vec)
    assert (len(amplitudes) == 5)
    assert (len(phases) == 5)
    for a, p in zip(amplitudes, phases):
        print(a, numpy.angle(p))
    numpy.testing.assert_allclose(numpy.abs(amplitudes[0]), 0.5, atol=1e-6)
    numpy.testing.assert_allclose(numpy.abs(amplitudes[1]), 0.3, atol=1e-6)
    numpy.testing.assert_allclose(numpy.abs(amplitudes[2]), 0.15, atol=1e-6)
    numpy.testing.assert_allclose(numpy.abs(amplitudes[3]), 0.1, atol=1e-6)
    numpy.testing.assert_allclose(numpy.abs(amplitudes[4]), 0.05, atol=1e-6)
    numpy.testing.assert_allclose(numpy.angle(phases[0]), 0.3, atol=1e-6)
    numpy.testing.assert_allclose(numpy.angle(phases[1]), 0.5, atol=1e-6)
    numpy.testing.assert_allclose(numpy.angle(phases[2]), 0.15, atol=1e-6)
    numpy.testing.assert_allclose(numpy.angle(phases[3]), 0.4, atol=1e-6)
    numpy.testing.assert_allclose(numpy.angle(phases[4]), 0.12, atol=1e-6)

max_stars_repo_name: mpharrigan/OpenFermion

max_issues_repo_name: mpharrigan/OpenFermion

max_forks_repo_name: mpharrigan/OpenFermion


text:
################################################################################
# Copyright (C) 2015 Jaakko Luttinen
#
# This file is licensed under the MIT License.
################################################################################

"""
Unit tests for `wishart` module.
"""

import numpy as np

from scipy import special

from .. import gaussian
from bayespy.nodes import (Gaussian,
                           Wishart)

from ...vmp import VB

from bayespy.utils import misc
from bayespy.utils import linalg
from bayespy.utils import random

from bayespy.utils.misc import TestCase

def _student_logpdf(y, mu, Cov, nu):
    D = np.shape(y)[-1]
    return (special.gammaln((nu+D)/2)
            - special.gammaln(nu/2)
            - 0.5 * D * np.log(nu)
            - 0.5 * D * np.log(np.pi)
            - 0.5 * np.linalg.slogdet(Cov)[1]
            - 0.5 * (nu+D) * np.log(1+1/nu*np.einsum('...i,...ij,...j->...',
                                                     y-mu,
                                                     np.linalg.inv(Cov),
                                                     y-mu)))

class TestWishart(TestCase):

    def test_lower_bound(self):
        """
        Test the Wishart VB lower bound
        """

        #
        # By having the Wishart node as the only latent node, VB will give exact
        # results, thus the VB lower bound is the true marginal log likelihood.
        # Thus, check that they are equal. The true marginal likelihood is the
        # multivariate Student-t distribution.
        #

        np.random.seed(42)

        D = 3
        n = (D-1) + np.random.uniform(0.1, 0.5)
        V = random.covariance(D)
        Lambda = Wishart(n, V)
        mu = np.random.randn(D)
        Y = Gaussian(mu, Lambda)
        y = np.random.randn(D)
        Y.observe(y)
        Lambda.update()
        L = Y.lower_bound_contribution() + Lambda.lower_bound_contribution()
        mu = mu
        nu = n + 1 - D
        Cov = V / nu
        self.assertAllClose(L,
                            _student_logpdf(y,
                                            mu,
                                            Cov,
                                            nu))

        pass

    def test_moments(self):
        """
        Test the moments of Wishart node
        """

        np.random.seed(42)

        # Test prior moments
        D = 3
        n = (D-1) + np.random.uniform(0.1,2)
        V = random.covariance(D)
        Lambda = Wishart(n, V)
        Lambda.update()
        u = Lambda.get_moments()
        self.assertAllClose(u[0],
                            n*np.linalg.inv(V),
                            msg='Mean incorrect')
        self.assertAllClose(u[1],
                            (np.sum(special.digamma((n - np.arange(D))/2))
                             + D*np.log(2)
                             - np.linalg.slogdet(V)[1]),
                             msg='Log determinant incorrect')

        # Test posterior moments
        D = 3
        n = (D-1) + np.random.uniform(0.1,2)
        V = random.covariance(D)
        Lambda = Wishart(n, V)
        mu = np.random.randn(D)
        Y = Gaussian(mu, Lambda)
        y = np.random.randn(D)
        Y.observe(y)
        Lambda.update()
        u = Lambda.get_moments()
        n = n + 1
        V = V + np.outer(y-mu, y-mu)
        self.assertAllClose(u[0],
                            n*np.linalg.inv(V),
                            msg='Mean incorrect')
        self.assertAllClose(u[1],
                            (np.sum(special.digamma((n - np.arange(D))/2))
                             + D*np.log(2)
                             - np.linalg.slogdet(V)[1]),
                             msg='Log determinant incorrect')

        pass

max_stars_repo_name: dungvtdev/upsbayescpm

max_issues_repo_name: dungvtdev/upsbayescpm

max_forks_repo_name: dungvtdev/upsbayescpm

reason: import numpy,from scipy


text:
import os
import sys
import tensorflow as tf
import numpy as np
from PIL import Image
from object_detection import ObjectDetection
import pandas as pd
from pydub import AudioSegment
import librosa
import librosa.display
import matplotlib.pyplot as plt
from matplotlib import figure
import time
import json
import cv2
import PIL

MODEL_FILENAME = 'saved_model_w_shotgun.pb'
LABELS_FILENAME = 'labels.txt'

class TFObjectDetection(ObjectDetection):
    """Object Detection class for TensorFlow SavedModel"""

    def __init__(self, model_filename, labels):
        super(TFObjectDetection, self).__init__(labels)
        model = tf.saved_model.load(os.path.dirname(model_filename))
        self.serve = model.signatures['serving_default']

    def predict(self, preprocessed_image):
        inputs = np.array(preprocessed_image, dtype=np.float32)[np.newaxis, :, :, (2, 1, 0)]  # RGB -> BGR
        inputs = tf.convert_to_tensor(inputs)
        outputs = self.serve(inputs)
        return np.array(outputs['outputs'][0])

def main(file_path):
    # Load labels
    with open(LABELS_FILENAME, 'r') as f:
        labels = [l.strip() for l in f.readlines()]

    od_model = TFObjectDetection(MODEL_FILENAME, labels)

    detected = {
        "filename": [],
        "offset": [],
        "confidence": [],
        "tag": [],
    }

    mylist = os.listdir(file_path)
    num_detected = 0
    overlap = 6 * 1000
    twelve = 12 * 1000

    # fig, ax = plt.subplots()
    # plt.figure(figsize=(3, 3))
    fig = figure.Figure()
    ax = fig.subplots(1)

    for i in range(len(mylist)):

        print(len(mylist))
        print(i)
        print("Loading soundfile")

        start = time.time()
        print(file_path+"/"+mylist[i])
        if((file_path+"/"+mylist[i])  == ('sounds/.DS_Store')):
            print("Breaking")
            continue
        clip = AudioSegment.from_wav(file_path+"/"+mylist[i])
        end = time.time()

        print("Took",int(end-start),"seconds to load file")

        current_s = 0

        for j in range(int(clip.duration_seconds/(overlap/1000))):
            fig = figure.Figure()
            ax = fig.subplots(1)

            if((current_s+twelve)/1000 > clip.duration_seconds):
                print("Breaking, clip not in range")
                break

            short = clip[current_s:current_s+twelve]

            short.export("cache/short.wav", format="wav")

            y, sr = librosa.load("cache/short.wav")

            S = librosa.feature.melspectrogram(y=y, sr=sr, n_mels=128,fmax=1500)

            S_dB = librosa.power_to_db(S, ref=np.max)
            img = librosa.display.specshow(S_dB, sr=sr,
                                    fmax=1500, ax=ax)

            save_to = 'cache/images/'+"detected_"+mylist[i]+"_"+str((current_s/1000))+'.png'

            #start = time.time()
            #print(S_dB.shape)
            fig.savefig(save_to)
            plt.cla()
            #plt.clf()
            plt.close(fig)
            #print(time.time()-start)

            os.remove("cache/short.wav")

            image = Image.open(save_to)

            predictions = od_model.predict_image(image)
            hit = False

            for k in predictions:
                if(k['probability']>=0.70 and k['tagName'] == 'gunshot'):
                    hit = True
                    num_detected+=1
                    print(num_detected)
                    print("GUNSHOT:",current_s)
                    print(k)
                    detected['filename'].append(mylist[i])
                    detected['offset'].append(current_s)
                    detected['confidence'].append(k['probability'])
                    detected['tag'].append(k['tagName'])

                    image = cv2.imread(save_to)
                    top_left = (int(k['boundingBox']['left']*640),int(k['boundingBox']['top']*480))
                    bottom_right = (int((k['boundingBox']['left']+k['boundingBox']['width'])*640),int((k['boundingBox']['top']+k['boundingBox']['height'])*480))
                    print(top_left,bottom_right)
                    colour = (255,0,0)
                    thickness = 2
                    image = cv2.rectangle(image, bottom_right, top_left, colour,thickness)
                    cv2.imwrite(save_to, image)

                # elif(k['probability']>=0.5 and k['tagName'] == 'gunshot'):
                #     print(k['probability'], " POSSIBLE SINGLE SHOT AT ",current_s)

                if(k['probability']>=0.75 and k['tagName'] == 'shotgun'):
                    hit = True
                    num_detected+=1
                    print(num_detected)
                    print("MULTIPLE GUNSHOTS:",current_s)
                    print(k)
                    detected['filename'].append(mylist[i])
                    detected['offset'].append(current_s)
                    detected['confidence'].append(k['probability'])
                    detected['tag'].append(k['tagName'])

                    image = cv2.imread(save_to)
                    top_left = (int(k['boundingBox']['left']*640),int(k['boundingBox']['top']*480))
                    bottom_right = (int((k['boundingBox']['left']+k['boundingBox']['width'])*640),int((k['boundingBox']['top']+k['boundingBox']['height'])*480))
                    print(top_left,bottom_right)
                    colour = (0,255,0)
                    thickness = 2
                    image = cv2.rectangle(image, bottom_right, top_left, colour,thickness)
                    cv2.imwrite(save_to, image)
                # elif(k['probability']>=0.5 and k['tagName'] == 'multiple gunshots'):
                #     print(k['probability'], " POSSIBLE MULTIPLE SHOTS AT ",current_s)

            if not hit:
                os.remove(save_to)

            current_s = current_s+overlap
    print("Total detected:",num_detected)

    with open("detected.json","w") as store:
        json.dump(detected, store, indent=3)

if __name__ == '__main__':
    if len(sys.argv) <= 1:
        print('USAGE: {} sound_path'.format(sys.argv[0]))
    else:
        main(sys.argv[1])


text:
# Copyright (c) 2017, Intel Research and Development Ireland Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Functions related to networkx graph manipulation.
"""
import json
import operator
import networkx as nx
from networkx.readwrite import json_graph

def filter_nodes(graph, types, filter_these=True, json_out=True):
    """
    Filters the node types from a graph and connects the nodes as appropriate.
    The types that are filtered are decided by the types and filter_these
    parameters.  If filter_these is set to true then filter out the node types
    in the types list, if false, then filter out the other node types.
    :param graph: The graph to filter.
    :param types: The types to keep or filter from the graph.
    :param filter_these: Flag which decides whether types are filtered or kept.
    :param json_out: If true then json is returned rather than a graph.
    :return: A networkx graph as an object or as json.
    """
    graph = _graph_obj(graph)
    filter_operator = operator.not_ if filter_these else operator.truth
    new_graph = nx.DiGraph()
    end_nodes = _end_nodes(graph)
    for end_node in end_nodes:
        _filter_types(graph, new_graph, end_node, None, types, filter_operator)
    if json_out:
        return json.dumps(json_graph.node_link_data(new_graph))
    return new_graph

def _filter_types(graph, new_graph, nid, source, types, filter_operator):
    """
    Recursive method which walks, depth first, through the graph. Nodes are
    checked by their type and added if required to the new_graph.
    :param graph: graph that is being traversed through.
    :param new_graph: graph being built.
    :param nid: current node being inspected.
    :param source: last node that was added.
    :param types: list of types that are being checked against.
    :param filter_operator: comparison operator.
    :return: None
    """
    ntype = graph.node[nid]['type']
    if filter_operator(operator.contains(types, ntype)):
        new_graph.add_node(nid, **graph.node[nid])
        if source:
            new_graph.add_edge(source, nid)
        source = nid
    successors = graph.successors(nid)
    for succ in successors:
        _filter_types(graph, new_graph, succ, source, types, filter_operator)
    return

def _end_nodes(graph):
    """
    Returns all nodes with no predecessors. We filter the graph form these
    nodes.
    """
    end_nodes = []
    for node in graph:
        predecessor = graph.predecessors(node)
        if not predecessor:
            end_nodes.append(node)
    return end_nodes

def _graph_obj(graph):
    """
    converts json strings to graph objects.
    """
    if isinstance(graph, basestring):
        json_g = json.loads(graph)
        return json_graph.node_link_graph(json_g, directed=True)
    return graph

max_stars_repo_name: rlquinn/landscaper

max_issues_repo_name: rlquinn/landscaper

max_forks_repo_name: rlquinn/landscaper

reason: import networkx,from networkx