Exemple #1
0
def collect_final_energy(
    scan_dir: Union[Path, str],
    propagation_name: str = "propagate",
    output_file: Union[Path, str] = None,
    missing_ok: bool = True,
):
    if output_file is None:
        output_file = (Path("data") / f"{propagation_name}_final_energy" /
                       (make_path(scan_dir).name + ".txt"))

    def fetch(index, path, parameters):
        _, _, energy, _ = read_output_hdf5(
            path / propagation_name / "propagate.h5",
            "output",
        )
        return energy[-1]

    return collect_values(
        scan_dir,
        [
            Path(propagation_name) / "propagate.h5",
        ],
        output_file,
        fetch,
        missing_ok=missing_ok,
    )
Exemple #2
0
def collect_final_total_magnitude(
    scan_dir: Union[Path, str],
    fixed_ns_path: Union[str, Path],
    output_file: Union[Path, str] = None,
    missing_ok: bool = True,
):

    fixed_ns_path = make_path(fixed_ns_path).with_suffix(".fixed_ns.h5")

    if output_file is None:
        output_file = (Path("data") / "final_total_magnitude_{}".format(
            fixed_ns_path.name.replace(".fixed_ns.h5", ""), ) /
                       (make_path(scan_dir).name + ".txt"))

    def fetch(index, path, parameters):
        _, data, _, _ = read_fixed_ns_total_magnitude_hdf5(path /
                                                           fixed_ns_path)
        return data[-1]

    return collect_values(
        scan_dir,
        [
            fixed_ns_path,
        ],
        output_file,
        fetch,
        missing_ok=missing_ok,
    )
Exemple #3
0
def collect_max_depletion(
    scan_dir: Union[Path, str],
    propagation_name: str = "propagate",
    output_file: Union[Path, str] = None,
    node: int = 1,
    dof: int = 1,
    missing_ok: bool = True,
):
    if output_file is None:
        output_file = (Path("data") / "max_depletion" /
                       (make_path(scan_dir).name + ".txt"))

    def fetch(index, path, parameters):
        _, data = read_natpop_hdf5(
            path / propagation_name / "propagate.h5",
            "natpop",
            node=node,
            dof=dof,
        )
        return (1 - data[:, 0]).max()

    return collect_values(
        scan_dir,
        [
            Path(propagation_name) / "propagate.h5",
        ],
        output_file,
        fetch,
        missing_ok=missing_ok,
    )
Exemple #4
0
def collect_final_expval(
    scan_dir: Union[Path, str],
    expval: Union[Path, str],
    output_file: Union[Path, str] = None,
    node: int = 1,
    dof: int = 1,
    missing_ok: bool = True,
):
    expval = make_path(expval)

    if output_file is None:
        folder_name = "expval_" + expval.name.rstrip(".exp.h5")
        if not folder_name.startswith("final_"):
            folder_name = "final_" + folder_name
        output_file = Path("data") / (folder_name) / (
            make_path(scan_dir).name + ".txt")

    def fetch(index, path, parameters):
        _, data = numpy.array(read_expval_hdf5(path / expval))
        return data[-1].real, data[-1].imag

    return collect_values(scan_dir, [expval],
                          output_file,
                          fetch,
                          missing_ok=missing_ok)