tmp dir auto-del, removed default in pulse shape
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
__version__ = "0.1.0"
|
__version__ = "0.1.1"
|
||||||
|
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ from typing import Any, Callable, Dict, Generator, List, Sequence, Tuple
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import pkg_resources as pkg
|
import pkg_resources as pkg
|
||||||
import toml
|
import toml
|
||||||
|
from send2trash import send2trash
|
||||||
|
|
||||||
from . import env, utils
|
from . import env, utils
|
||||||
from .const import PARAM_FN, PARAM_SEPARATOR, SPEC1_FN, SPECN_FN, Z_FN, __version__
|
from .const import PARAM_FN, PARAM_SEPARATOR, SPEC1_FN, SPECN_FN, Z_FN, __version__
|
||||||
@@ -424,7 +425,7 @@ def merge_spectra(
|
|||||||
yield z, np.atleast_2d(spectra)
|
yield z, np.atleast_2d(spectra)
|
||||||
|
|
||||||
|
|
||||||
def merge(destination: os.PathLike, path_trees: List[PathTree] = None):
|
def merge(destination: os.PathLike, path_trees: List[PathTree] = None, delete_tmp: bool = True):
|
||||||
|
|
||||||
destination = ensure_folder(Path(destination))
|
destination = ensure_folder(Path(destination))
|
||||||
|
|
||||||
@@ -447,6 +448,13 @@ def merge(destination: os.PathLike, path_trees: List[PathTree] = None):
|
|||||||
pbars.reset(1)
|
pbars.reset(1)
|
||||||
iden = PARAM_SEPARATOR.join(path_tree[-1][0].name.split()[2:-2])
|
iden = PARAM_SEPARATOR.join(path_tree[-1][0].name.split()[2:-2])
|
||||||
merge_path_tree(path_tree, destination / iden, z_callback=lambda i: pbars.update(1))
|
merge_path_tree(path_tree, destination / iden, z_callback=lambda i: pbars.update(1))
|
||||||
|
if delete_tmp:
|
||||||
|
for branch in path_tree:
|
||||||
|
for path in branch:
|
||||||
|
try:
|
||||||
|
send2trash(path.parent)
|
||||||
|
except OSError:
|
||||||
|
continue
|
||||||
|
|
||||||
|
|
||||||
def sim_dirs(path_trees: List[PathTree]) -> Generator[Path, None, None]:
|
def sim_dirs(path_trees: List[PathTree]) -> Generator[Path, None, None]:
|
||||||
|
|||||||
@@ -338,12 +338,12 @@ def correct_wavelength(init_wavelength: float, w_c: np.ndarray, field_0: np.ndar
|
|||||||
return units.m.inv(units.m(init_wavelength) - delta_w)
|
return units.m.inv(units.m(init_wavelength) - delta_w)
|
||||||
|
|
||||||
|
|
||||||
def E0_to_P0(E0, t0, shape="gaussian"):
|
def E0_to_P0(E0, t0, shape):
|
||||||
"""convert an initial total pulse energy to a pulse peak peak_power"""
|
"""convert an initial total pulse energy to a pulse peak peak_power"""
|
||||||
return E0 / (t0 * P0T0_to_E0_fac[shape])
|
return E0 / (t0 * P0T0_to_E0_fac[shape])
|
||||||
|
|
||||||
|
|
||||||
def P0_to_E0(P0, t0, shape="gaussian"):
|
def P0_to_E0(P0, t0, shape):
|
||||||
"""converts initial peak peak_power to pulse energy"""
|
"""converts initial peak peak_power to pulse energy"""
|
||||||
return P0 * t0 * P0T0_to_E0_fac[shape]
|
return P0 * t0 * P0T0_to_E0_fac[shape]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user