From e657290120222db3104062b00aad696c036dcc36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Sierro?= Date: Mon, 7 Jun 2021 09:46:53 +0200 Subject: [PATCH] version info --- setup.cfg | 2 +- src/scgenerator/__init__.py | 2 ++ src/scgenerator/io.py | 22 +++++++++------------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/setup.cfg b/setup.cfg index 0926eb8..39d428b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = scgenerator -version = 0.0.1 +version = 0.1.0 description = Simulated PCFs and supercontinuum generation ! author = Benoit Sierro author_email = benoit.sierro@iap.unibe.ch diff --git a/src/scgenerator/__init__.py b/src/scgenerator/__init__.py index 827cad8..667f0ed 100644 --- a/src/scgenerator/__init__.py +++ b/src/scgenerator/__init__.py @@ -4,3 +4,5 @@ from .math import abs2, argclosest, span from .physics import fiber, materials, pulse, simulate, units from .physics.simulate import RK4IP, new_simulation, resume_simulations from .plotting import plot_avg, plot_results_1D, plot_results_2D, plot_spectrogram + +__version__ = "0.1.0" \ No newline at end of file diff --git a/src/scgenerator/io.py b/src/scgenerator/io.py index 3a59a24..b9f7dee 100644 --- a/src/scgenerator/io.py +++ b/src/scgenerator/io.py @@ -1,24 +1,24 @@ +import itertools import os -from datetime import datetime -from typing import Any, Dict, Generator, List, Sequence, Tuple import shutil +from datetime import datetime +from pathlib import Path +from typing import Any, Dict, Generator, List, Sequence, Tuple import numpy as np import pkg_resources as pkg import toml -from pathlib import Path -import itertools -from . import utils, env +from . import __version__, env, utils from .const import ( ENVIRON_KEY_BASE, + PARAM_FN, PARAM_SEPARATOR, PBAR_POLICY, - TMP_FOLDER_KEY_BASE, SPEC1_FN, SPECN_FN, + TMP_FOLDER_KEY_BASE, Z_FN, - PARAM_FN, ) from .errors import IncompleteDataFolderError from .logger import get_logger @@ -65,11 +65,6 @@ class Paths: with open(cls.get(key)) as file: return file.read() - @staticmethod - def tmp(task_id=0): - suffix = "" if task_id == 0 else str(task_id) - return ".scgenerator_tmp" + suffix - @classmethod def plot(cls, name): """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["datetime"] = datetime.now() + param["version"] = __version__ 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()): path.mkdir(exist_ok=True) return path - path = path.parent / (folder_name + f"_{i}") \ No newline at end of file + path = path.parent / (folder_name + f"_{i}")