version info

This commit is contained in:
Benoît Sierro
2021-06-07 09:46:53 +02:00
parent 7c0daa0787
commit e657290120
3 changed files with 12 additions and 14 deletions

View File

@@ -1,6 +1,6 @@
[metadata] [metadata]
name = scgenerator name = scgenerator
version = 0.0.1 version = 0.1.0
description = Simulated PCFs and supercontinuum generation ! description = Simulated PCFs and supercontinuum generation !
author = Benoit Sierro author = Benoit Sierro
author_email = benoit.sierro@iap.unibe.ch author_email = benoit.sierro@iap.unibe.ch

View File

@@ -4,3 +4,5 @@ from .math import abs2, argclosest, span
from .physics import fiber, materials, pulse, simulate, units from .physics import fiber, materials, pulse, simulate, units
from .physics.simulate import RK4IP, new_simulation, resume_simulations from .physics.simulate import RK4IP, new_simulation, resume_simulations
from .plotting import plot_avg, plot_results_1D, plot_results_2D, plot_spectrogram from .plotting import plot_avg, plot_results_1D, plot_results_2D, plot_spectrogram
__version__ = "0.1.0"

View File

@@ -1,24 +1,24 @@
import itertools
import os import os
from datetime import datetime
from typing import Any, Dict, Generator, List, Sequence, Tuple
import shutil import shutil
from datetime import datetime
from pathlib import Path
from typing import Any, 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 pathlib import Path
import itertools
from . import utils, env from . import __version__, env, utils
from .const import ( from .const import (
ENVIRON_KEY_BASE, ENVIRON_KEY_BASE,
PARAM_FN,
PARAM_SEPARATOR, PARAM_SEPARATOR,
PBAR_POLICY, PBAR_POLICY,
TMP_FOLDER_KEY_BASE,
SPEC1_FN, SPEC1_FN,
SPECN_FN, SPECN_FN,
TMP_FOLDER_KEY_BASE,
Z_FN, Z_FN,
PARAM_FN,
) )
from .errors import IncompleteDataFolderError from .errors import IncompleteDataFolderError
from .logger import get_logger from .logger import get_logger
@@ -65,11 +65,6 @@ class Paths:
with open(cls.get(key)) as file: with open(cls.get(key)) as file:
return file.read() return file.read()
@staticmethod
def tmp(task_id=0):
suffix = "" if task_id == 0 else str(task_id)
return ".scgenerator_tmp" + suffix
@classmethod @classmethod
def plot(cls, name): def plot(cls, name):
"""returns the paths to the specified plot. Used to save new plot """returns the paths to the specified plot. Used to save new plot
@@ -161,6 +156,7 @@ def save_parameters(param_dict: Dict[str, Any], destination_dir: Path) -> Path:
param = prepare_for_serialization(param) param = prepare_for_serialization(param)
param["datetime"] = datetime.now() param["datetime"] = datetime.now()
param["version"] = __version__
file_path.parent.mkdir(exist_ok=True) file_path.parent.mkdir(exist_ok=True)
@@ -528,4 +524,4 @@ def ensure_folder(path: Path, prevent_overwrite: bool = True) -> Path:
if not path.is_file() and (not prevent_overwrite or not path.is_dir()): if not path.is_file() and (not prevent_overwrite or not path.is_dir()):
path.mkdir(exist_ok=True) path.mkdir(exist_ok=True)
return path return path
path = path.parent / (folder_name + f"_{i}") path = path.parent / (folder_name + f"_{i}")