Beispiel #1
0
def interpgridnodes(Pk=5.0, kappa=np.inf, struct="pp", sampling=1):

    # 1: Extract the "spectra from the grid nodes
    grid_name = "[NII]/[SII]+;[OIII]/[SII]+"

    grid = pyqz.get_grid(
        grid_name, Pk=Pk, struct=struct, kappa=kappa, coeffs=pyqz.diagnostics[grid_name]["coeffs"], sampling=sampling
    )

    grid_nodes = grid[0][
        :, [grid[1].index("LogQ"), grid[1].index("Tot[O]+12"), grid[1].index("Mix_x"), grid[1].index("Mix_y")]
    ]

    # 2: Now, interpolate and checks the output
    interp_qs = pyqz.interp_qz(
        "LogQ",
        [grid_nodes[:, -2], grid_nodes[:, -1]],
        grid_name,
        coeffs=pyqz.diagnostics[grid_name]["coeffs"],
        Pk=Pk,
        kappa=kappa,
        struct=struct,
        sampling=sampling,
    )
    interp_zs = pyqz.interp_qz(
        "Tot[O]+12",
        [grid_nodes[:, -2], grid_nodes[:, -1]],
        grid_name,
        coeffs=pyqz.diagnostics[grid_name]["coeffs"],
        Pk=Pk,
        kappa=kappa,
        struct=struct,
        sampling=sampling,
    )

    return np.all(np.round(interp_qs, 2) == grid_nodes[:, 0]) and np.all(np.round(interp_zs, 3) == grid_nodes[:, 1])
Beispiel #2
0
def interpoffgrid(Pk=5.0, kappa=np.inf, struct="pp", sampling=1):

    grid_name = pyqz.diagnostics.keys()[0]

    interp_q = pyqz.interp_qz(
        "LogQ",
        [np.array(-1000), np.array(-1000)],
        grid_name,
        coeffs=pyqz.diagnostics[grid_name]["coeffs"],
        Pk=Pk,
        kappa=kappa,
        struct=struct,
        sampling=sampling,
    )

    return np.isnan(interp_q)