cellpy 0.4.2.post4__tar.gz → 0.4.2.post6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/PKG-INFO +1 -1
- cellpy-0.4.2.post6/cellpy/_version.py +1 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/log.py +141 -141
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/arbin_res.py +8 -9
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy.egg-info/PKG-INFO +1 -1
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy.egg-info/SOURCES.txt +17 -9
- cellpy-0.4.2.post6/docs/_build/.doctrees/nbsphinx/examples_and_tutorials_notebooks_tutorial_simple_plot_2_0.png +0 -0
- cellpy-0.4.2.post6/docs/_build/_images/examples_and_tutorials_notebooks_tutorial_simple_plot_2_0.png +0 -0
- cellpy-0.4.2.post6/docs/_build/_images/graphviz-22185705e237fa530df24e4af50cb25833165e25.png +0 -0
- cellpy-0.4.2.post6/docs/_build/_images/graphviz-246f2486cd940f2ea40a07f847c86c22b2607ca8.png +0 -0
- cellpy-0.4.2.post6/docs/_build/_images/graphviz-42e9bc826d476a3d361a7f410e989ed34dc1aa85.png +0 -0
- cellpy-0.4.2.post6/docs/_build/_images/graphviz-619216a42370fd49669c083549129b8470c8fae1.png +0 -0
- cellpy-0.4.2.post6/docs/_build/_images/graphviz-6deb64a460668e8ef9bf0ca653314119adeeae66.png +0 -0
- cellpy-0.4.2.post6/docs/_build/_images/graphviz-83b62e03ef369ff0a30f027892dba95b91ea8b6c.png +0 -0
- cellpy-0.4.2.post6/docs/_build/_images/graphviz-ce8a9fe2ba01194aed847e0248d749db4093aca1.png +0 -0
- cellpy-0.4.2.post6/docs/_build/_images/graphviz-e94a5352318e02fcc5ef1f813e02a526c39af791.png +0 -0
- cellpy-0.4.2.post6/docs/adapted_readme.rst +57 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/conf.py +332 -327
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/index.rst +51 -51
- cellpy-0.4.2.post4/cellpy/_version.py +0 -1
- cellpy-0.4.2.post4/docs/_build/.doctrees/nbsphinx/notebooks_tutorial_simple_plot_2_0.png +0 -0
- cellpy-0.4.2.post4/docs/_build/_images/notebooks_tutorial_simple_plot_2_0.png +0 -0
- cellpy-0.4.2.post4/docs/readme.rst +0 -1
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/AUTHORS.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/CONTRIBUTING.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/HISTORY.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/LICENSE +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/MANIFEST.in +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/README.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/__init__.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/cli.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/exceptions.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/logging.json +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/parameters/.cellpy_prms_default.conf +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/parameters/__init__.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/parameters/internal_settings.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/parameters/internal_settings_old.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/parameters/legacy/__init__.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/parameters/legacy/internal_settings.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/parameters/prmreader.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/parameters/prms.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/__init__.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/cellreader.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/core.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/dbreader.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/filefinder.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/__init__.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/arbin_sql.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/arbin_sql_csv.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/arbin_sql_xlsx.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/backup_arbin.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/base.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/biologics_mpr.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/configurations/__init__.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/configurations/maccor_txt_four.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/configurations/maccor_txt_one.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/configurations/maccor_txt_three.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/configurations/maccor_txt_two.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/configurations/maccor_txt_zero.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/custom.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/delete_these_in_february2022/__init__.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/delete_these_in_february2022/_testing_txt.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/delete_these_in_february2022/maccor_txt_old.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/ext_nda_reader.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/loader_specific_modules/__init__.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/loader_specific_modules/biologic_file_format.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/local_instrument.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/maccor_txt.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/old_custom.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/pec_csv.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/processors/__init__.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/processors/post_processors.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/readers/instruments/processors/pre_processors.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/utils/__init__.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/utils/batch.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/utils/batch_tools/__init__.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/utils/batch_tools/batch_analyzers.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/utils/batch_tools/batch_core.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/utils/batch_tools/batch_experiments.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/utils/batch_tools/batch_exporters.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/utils/batch_tools/batch_helpers.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/utils/batch_tools/batch_journals.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/utils/batch_tools/batch_plotters.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/utils/batch_tools/batch_reporters.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/utils/batch_tools/dumpers.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/utils/batch_tools/engines.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/utils/data/20160805_test001_45_cc.h5 +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/utils/data/raw/20160805_test001_45_cc_01.res +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/utils/diagnostics.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/utils/easyplot.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/utils/example_data.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/utils/helpers.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/utils/ica.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/utils/live.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/utils/ocv_rlx.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy/utils/plotutils.py +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy.egg-info/dependency_links.txt +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy.egg-info/entry_points.txt +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy.egg-info/not-zip-safe +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy.egg-info/requires.txt +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/cellpy.egg-info/top_level.txt +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/Makefile +0 -0
- /cellpy-0.4.2.post4/docs/_build/.doctrees/nbsphinx/notebooks_tutorial_get_cap_6_0.png → /cellpy-0.4.2.post6/docs/_build/.doctrees/nbsphinx/examples_and_tutorials_notebooks_tutorial_get_cap_6_0.png +0 -0
- /cellpy-0.4.2.post4/docs/_build/.doctrees/nbsphinx/notebooks_tutorial_get_cap_7_0.png → /cellpy-0.4.2.post6/docs/_build/.doctrees/nbsphinx/examples_and_tutorials_notebooks_tutorial_get_cap_7_0.png +0 -0
- /cellpy-0.4.2.post4/docs/_build/.doctrees/nbsphinx/notebooks_tutorial_get_cap_8_0.png → /cellpy-0.4.2.post6/docs/_build/.doctrees/nbsphinx/examples_and_tutorials_notebooks_tutorial_get_cap_8_0.png +0 -0
- /cellpy-0.4.2.post4/docs/_build/_images/notebooks_tutorial_get_cap_6_0.png → /cellpy-0.4.2.post6/docs/_build/_images/examples_and_tutorials_notebooks_tutorial_get_cap_6_0.png +0 -0
- /cellpy-0.4.2.post4/docs/_build/_images/notebooks_tutorial_get_cap_7_0.png → /cellpy-0.4.2.post6/docs/_build/_images/examples_and_tutorials_notebooks_tutorial_get_cap_7_0.png +0 -0
- /cellpy-0.4.2.post4/docs/_build/_images/notebooks_tutorial_get_cap_8_0.png → /cellpy-0.4.2.post6/docs/_build/_images/examples_and_tutorials_notebooks_tutorial_get_cap_8_0.png +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/_build/_images/templates_jupyterlab_001.png +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/_build/_images/tutorials_utils_plotting_fig1.png +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/_build/_images/tutorials_utils_plotting_fig2.png +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/_build/_static/file.png +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/_build/_static/minus.png +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/_build/_static/plus.png +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/authors.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/basics.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/contributing.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/developers/dev_cellpy_data_structure.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/developers/dev_cellpy_folder_structure.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/developers/dev_various.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/developers_guide.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/examples.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/formats.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/history.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/installation.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/make.bat +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/notebooks.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/source/cellpy.parameters.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/source/cellpy.readers.instruments.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/source/cellpy.readers.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/source/cellpy.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/source/cellpy.utils.batch_tools.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/source/cellpy.utils.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/source/modules.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/tips_and_tricks.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/tutorials/basic_interaction.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/tutorials/configuring.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/tutorials/data_mining.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/tutorials/getting_started_tutorial.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/tutorials/pandas.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/tutorials/the_cellpy_cmd.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/usage.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/utils/batch.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/utils/custom_file_loader.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/utils/easyplot.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/utils/figures/tutorials_utils_plotting_fig1.png +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/utils/figures/tutorials_utils_plotting_fig2.png +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/utils/ica.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/utils/plotting.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/utils/templates.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/utils/tut_ocv_rlx.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/docs/utils.rst +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/pyproject.toml +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/setup.cfg +0 -0
- {cellpy-0.4.2.post4 → cellpy-0.4.2.post6}/setup.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.4.2post6"
|
|
@@ -1,141 +1,141 @@
|
|
|
1
|
-
"""Set up logger instance"""
|
|
2
|
-
|
|
3
|
-
import datetime
|
|
4
|
-
import json
|
|
5
|
-
import logging
|
|
6
|
-
import logging.config
|
|
7
|
-
import os
|
|
8
|
-
import pathlib
|
|
9
|
-
import shutil
|
|
10
|
-
import tempfile
|
|
11
|
-
import warnings
|
|
12
|
-
|
|
13
|
-
from cellpy import prms
|
|
14
|
-
|
|
15
|
-
logging.raiseExceptions = False
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def setup_logging(
|
|
19
|
-
default_json_path=None,
|
|
20
|
-
default_level=None,
|
|
21
|
-
env_key="LOG_CFG",
|
|
22
|
-
custom_log_dir=None,
|
|
23
|
-
reset_big_log=False,
|
|
24
|
-
max_size=5_000_000,
|
|
25
|
-
testing=False,
|
|
26
|
-
):
|
|
27
|
-
"""Setup logging configuration.
|
|
28
|
-
|
|
29
|
-
Args:
|
|
30
|
-
default_level: default log-level to screen (std.out).
|
|
31
|
-
default_json_path: path to config file for setting up logging.
|
|
32
|
-
env_key (str): use this environment prm to try to get default_json_path.
|
|
33
|
-
custom_log_dir: path for saving logs.
|
|
34
|
-
reset_big_log (bool): reset log if too big (max_size).
|
|
35
|
-
max_size (int): if reset_log, this is the max limit.
|
|
36
|
-
testing (bool): set as True if testing, and you don't want to create any .log files
|
|
37
|
-
|
|
38
|
-
"""
|
|
39
|
-
|
|
40
|
-
if not default_json_path:
|
|
41
|
-
default_json_path = os.path.join(
|
|
42
|
-
os.path.dirname(os.path.realpath(__file__)), "logging.json"
|
|
43
|
-
)
|
|
44
|
-
path = default_json_path
|
|
45
|
-
value = os.getenv(env_key, None)
|
|
46
|
-
if value:
|
|
47
|
-
path = value
|
|
48
|
-
|
|
49
|
-
if default_level is None:
|
|
50
|
-
default_level = "CRITICAL"
|
|
51
|
-
|
|
52
|
-
# loading logging configs
|
|
53
|
-
if os.path.exists(path):
|
|
54
|
-
with open(path, "rt") as f:
|
|
55
|
-
config = json.load(f)
|
|
56
|
-
|
|
57
|
-
if testing:
|
|
58
|
-
log_dir = tempfile.mkdtemp()
|
|
59
|
-
elif custom_log_dir:
|
|
60
|
-
log_dir = custom_log_dir
|
|
61
|
-
else:
|
|
62
|
-
log_dir = os.path.abspath(prms.Paths.filelogdir)
|
|
63
|
-
|
|
64
|
-
if not os.path.isdir(log_dir):
|
|
65
|
-
warning_txt = (
|
|
66
|
-
"\nCould not set custom log-dir - "
|
|
67
|
-
"non-existing directory"
|
|
68
|
-
f"\nDir: {log_dir}"
|
|
69
|
-
"\nUsing current directory instead: "
|
|
70
|
-
f"{os.getcwd()}"
|
|
71
|
-
)
|
|
72
|
-
logging.warning(warning_txt)
|
|
73
|
-
log_dir = os.getcwd()
|
|
74
|
-
|
|
75
|
-
for file_handler in [
|
|
76
|
-
"error_file_handler",
|
|
77
|
-
"info_file_handler",
|
|
78
|
-
"debug_file_handler",
|
|
79
|
-
]:
|
|
80
|
-
try:
|
|
81
|
-
file_name = config["handlers"][file_handler]["filename"]
|
|
82
|
-
logging.debug("Setting file handlers for logging.")
|
|
83
|
-
logging.debug(f"Filename: {file_name}")
|
|
84
|
-
logging.debug(f"Full path: {os.path.join(log_dir,file_name)}")
|
|
85
|
-
# print(f"Filename: {file_name}")
|
|
86
|
-
# print(f"Full path: {os.path.join(log_dir,file_name)}")
|
|
87
|
-
config["handlers"][file_handler]["filename"] = os.path.join(
|
|
88
|
-
log_dir, file_name
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
if reset_big_log:
|
|
92
|
-
full_log_file_path = pathlib.Path(log_dir) / file_name
|
|
93
|
-
if full_log_file_path.is_file():
|
|
94
|
-
file_size = full_log_file_path.lstat().st_size
|
|
95
|
-
if file_size > max_size:
|
|
96
|
-
d_str = datetime.datetime.now().strftime("%Y_%m_%d_%H_%M")
|
|
97
|
-
new_file_name = "_".join([d_str, file_name])
|
|
98
|
-
new_full_log_file_path = (
|
|
99
|
-
pathlib.Path(log_dir) / new_file_name
|
|
100
|
-
)
|
|
101
|
-
shutil.copy(full_log_file_path, new_full_log_file_path)
|
|
102
|
-
else:
|
|
103
|
-
logging.debug(
|
|
104
|
-
"Could not reset big log: could not find the file"
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
except Exception as e:
|
|
108
|
-
warnings.warn("\nCould not set custom log-dir" + str(e))
|
|
109
|
-
|
|
110
|
-
if default_level:
|
|
111
|
-
w_txt = "\nCould not set custom default level for logger"
|
|
112
|
-
if default_level not in [
|
|
113
|
-
"INFO",
|
|
114
|
-
"DEBUG",
|
|
115
|
-
"CRITICAL",
|
|
116
|
-
logging.INFO,
|
|
117
|
-
logging.DEBUG,
|
|
118
|
-
logging.CRITICAL,
|
|
119
|
-
]:
|
|
120
|
-
_txt = "\nonly 'INFO', 'DEBUG' and 'CRITICAL' is supported"
|
|
121
|
-
_txt += " as default_level"
|
|
122
|
-
warnings.warn(w_txt + _txt)
|
|
123
|
-
|
|
124
|
-
else:
|
|
125
|
-
try:
|
|
126
|
-
config["handlers"]["console"]["level"] = default_level
|
|
127
|
-
if default_level in ["DEBUG", logging.DEBUG]:
|
|
128
|
-
config["handlers"]["console"]["formatter"] = "stamped"
|
|
129
|
-
|
|
130
|
-
except Exception as e:
|
|
131
|
-
warnings.warn(w_txt + "\n" + str(e))
|
|
132
|
-
|
|
133
|
-
logging.config.dictConfig(config)
|
|
134
|
-
else:
|
|
135
|
-
if not default_level:
|
|
136
|
-
default_level = logging.CRITICAL
|
|
137
|
-
logging.basicConfig(level=default_level)
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if __name__ == "__main__":
|
|
141
|
-
setup_logging()
|
|
1
|
+
"""Set up logger instance"""
|
|
2
|
+
|
|
3
|
+
import datetime
|
|
4
|
+
import json
|
|
5
|
+
import logging
|
|
6
|
+
import logging.config
|
|
7
|
+
import os
|
|
8
|
+
import pathlib
|
|
9
|
+
import shutil
|
|
10
|
+
import tempfile
|
|
11
|
+
import warnings
|
|
12
|
+
|
|
13
|
+
from cellpy import prms
|
|
14
|
+
|
|
15
|
+
logging.raiseExceptions = False
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def setup_logging(
|
|
19
|
+
default_json_path=None,
|
|
20
|
+
default_level=None,
|
|
21
|
+
env_key="LOG_CFG",
|
|
22
|
+
custom_log_dir=None,
|
|
23
|
+
reset_big_log=False,
|
|
24
|
+
max_size=5_000_000,
|
|
25
|
+
testing=False,
|
|
26
|
+
):
|
|
27
|
+
"""Setup logging configuration.
|
|
28
|
+
|
|
29
|
+
Args:
|
|
30
|
+
default_level: default log-level to screen (std.out).
|
|
31
|
+
default_json_path: path to config file for setting up logging.
|
|
32
|
+
env_key (str): use this environment prm to try to get default_json_path.
|
|
33
|
+
custom_log_dir: path for saving logs.
|
|
34
|
+
reset_big_log (bool): reset log if too big (max_size).
|
|
35
|
+
max_size (int): if reset_log, this is the max limit.
|
|
36
|
+
testing (bool): set as True if testing, and you don't want to create any .log files
|
|
37
|
+
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
if not default_json_path:
|
|
41
|
+
default_json_path = os.path.join(
|
|
42
|
+
os.path.dirname(os.path.realpath(__file__)), "logging.json"
|
|
43
|
+
)
|
|
44
|
+
path = default_json_path
|
|
45
|
+
value = os.getenv(env_key, None)
|
|
46
|
+
if value:
|
|
47
|
+
path = value
|
|
48
|
+
|
|
49
|
+
if default_level is None:
|
|
50
|
+
default_level = "CRITICAL"
|
|
51
|
+
|
|
52
|
+
# loading logging configs
|
|
53
|
+
if os.path.exists(path):
|
|
54
|
+
with open(path, "rt") as f:
|
|
55
|
+
config = json.load(f)
|
|
56
|
+
|
|
57
|
+
if testing:
|
|
58
|
+
log_dir = tempfile.mkdtemp()
|
|
59
|
+
elif custom_log_dir:
|
|
60
|
+
log_dir = custom_log_dir
|
|
61
|
+
else:
|
|
62
|
+
log_dir = os.path.abspath(prms.Paths.filelogdir)
|
|
63
|
+
|
|
64
|
+
if not os.path.isdir(log_dir):
|
|
65
|
+
warning_txt = (
|
|
66
|
+
"\nCould not set custom log-dir - "
|
|
67
|
+
"non-existing directory"
|
|
68
|
+
f"\nDir: {log_dir}"
|
|
69
|
+
"\nUsing current directory instead: "
|
|
70
|
+
f"{os.getcwd()}"
|
|
71
|
+
)
|
|
72
|
+
logging.warning(warning_txt)
|
|
73
|
+
log_dir = os.getcwd()
|
|
74
|
+
|
|
75
|
+
for file_handler in [
|
|
76
|
+
"error_file_handler",
|
|
77
|
+
"info_file_handler",
|
|
78
|
+
"debug_file_handler",
|
|
79
|
+
]:
|
|
80
|
+
try:
|
|
81
|
+
file_name = config["handlers"][file_handler]["filename"]
|
|
82
|
+
logging.debug("Setting file handlers for logging.")
|
|
83
|
+
logging.debug(f"Filename: {file_name}")
|
|
84
|
+
logging.debug(f"Full path: {os.path.join(log_dir,file_name)}")
|
|
85
|
+
# print(f"Filename: {file_name}")
|
|
86
|
+
# print(f"Full path: {os.path.join(log_dir,file_name)}")
|
|
87
|
+
config["handlers"][file_handler]["filename"] = os.path.join(
|
|
88
|
+
log_dir, file_name
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
if reset_big_log:
|
|
92
|
+
full_log_file_path = pathlib.Path(log_dir) / file_name
|
|
93
|
+
if full_log_file_path.is_file():
|
|
94
|
+
file_size = full_log_file_path.lstat().st_size
|
|
95
|
+
if file_size > max_size:
|
|
96
|
+
d_str = datetime.datetime.now().strftime("%Y_%m_%d_%H_%M")
|
|
97
|
+
new_file_name = "_".join([d_str, file_name])
|
|
98
|
+
new_full_log_file_path = (
|
|
99
|
+
pathlib.Path(log_dir) / new_file_name
|
|
100
|
+
)
|
|
101
|
+
shutil.copy(full_log_file_path, new_full_log_file_path)
|
|
102
|
+
else:
|
|
103
|
+
logging.debug(
|
|
104
|
+
"Could not reset big log: could not find the file"
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
except Exception as e:
|
|
108
|
+
warnings.warn("\nCould not set custom log-dir" + str(e))
|
|
109
|
+
|
|
110
|
+
if default_level:
|
|
111
|
+
w_txt = "\nCould not set custom default level for logger"
|
|
112
|
+
if default_level not in [
|
|
113
|
+
"INFO",
|
|
114
|
+
"DEBUG",
|
|
115
|
+
"CRITICAL",
|
|
116
|
+
logging.INFO,
|
|
117
|
+
logging.DEBUG,
|
|
118
|
+
logging.CRITICAL,
|
|
119
|
+
]:
|
|
120
|
+
_txt = "\nonly 'INFO', 'DEBUG' and 'CRITICAL' is supported"
|
|
121
|
+
_txt += " as default_level"
|
|
122
|
+
warnings.warn(w_txt + _txt)
|
|
123
|
+
|
|
124
|
+
else:
|
|
125
|
+
try:
|
|
126
|
+
config["handlers"]["console"]["level"] = default_level
|
|
127
|
+
if default_level in ["DEBUG", logging.DEBUG]:
|
|
128
|
+
config["handlers"]["console"]["formatter"] = "stamped"
|
|
129
|
+
|
|
130
|
+
except Exception as e:
|
|
131
|
+
warnings.warn(w_txt + "\n" + str(e))
|
|
132
|
+
|
|
133
|
+
logging.config.dictConfig(config)
|
|
134
|
+
else:
|
|
135
|
+
if not default_level:
|
|
136
|
+
default_level = logging.CRITICAL
|
|
137
|
+
logging.basicConfig(level=default_level)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
if __name__ == "__main__":
|
|
141
|
+
setup_logging()
|
|
@@ -550,7 +550,7 @@ class DataLoader(BaseLoader):
|
|
|
550
550
|
# --------- read global-data ------------------------------------
|
|
551
551
|
self.logger.debug("reading global data table")
|
|
552
552
|
sql = "select * from %s" % table_name_global
|
|
553
|
-
global_data_df = pd.read_sql_query(sql, conn)
|
|
553
|
+
global_data_df = pd.read_sql_query(sql=sa.text(sql), con=conn.connect())
|
|
554
554
|
# col_names = list(global_data_df.columns.values)
|
|
555
555
|
self.logger.debug("sql statement: %s" % sql)
|
|
556
556
|
|
|
@@ -595,7 +595,7 @@ class DataLoader(BaseLoader):
|
|
|
595
595
|
sql_4 = "AND %s=%i " % (cycle_txt, cycle_number)
|
|
596
596
|
sql = sql_1 + sql_2 + sql_3 + sql_4 + sql_5
|
|
597
597
|
self.logger.debug("sql statement: %s" % sql)
|
|
598
|
-
normal_df = pd.read_sql_query(sql, conn)
|
|
598
|
+
normal_df = pd.read_sql_query(sql=sa.text(sql), con=conn.connect())
|
|
599
599
|
t2 = time.time()
|
|
600
600
|
dt = t2 - t1
|
|
601
601
|
self.logger.debug("time: %f" % dt)
|
|
@@ -659,7 +659,7 @@ class DataLoader(BaseLoader):
|
|
|
659
659
|
# --------- read global-data ------------------------------------
|
|
660
660
|
self.logger.debug("reading global data table")
|
|
661
661
|
sql = "select * from %s" % table_name_global
|
|
662
|
-
global_data_df = pd.read_sql_query(sql, conn)
|
|
662
|
+
global_data_df = pd.read_sql_query(sql=sa.text(sql), con=conn.connect())
|
|
663
663
|
# col_names = list(global_data_df.columns.values)
|
|
664
664
|
self.logger.debug("sql statement: %s" % sql)
|
|
665
665
|
|
|
@@ -701,7 +701,7 @@ class DataLoader(BaseLoader):
|
|
|
701
701
|
sql_4 = "AND %s=%i " % (cycle_txt, cycle_number)
|
|
702
702
|
sql = sql_1 + sql_2 + sql_3 + sql_4 + sql_5
|
|
703
703
|
self.logger.debug("sql statement: %s" % sql)
|
|
704
|
-
normal_df = pd.read_sql_query(sql, conn)
|
|
704
|
+
normal_df = pd.read_sql_query(sql=sa.text(sql), con=conn.connect())
|
|
705
705
|
t2 = time.time()
|
|
706
706
|
dt = t2 - t1
|
|
707
707
|
self.logger.debug("time: %f" % dt)
|
|
@@ -761,7 +761,7 @@ class DataLoader(BaseLoader):
|
|
|
761
761
|
if sql is None:
|
|
762
762
|
sql = f"select * from {table_name}"
|
|
763
763
|
self.logger.debug(f"sql statement: {sql}")
|
|
764
|
-
df = pd.read_sql_query(sql, conn)
|
|
764
|
+
df = pd.read_sql_query(sql=sa.text(sql), con=conn.connect())
|
|
765
765
|
return df
|
|
766
766
|
|
|
767
767
|
def _make_name_from_frame(self, df, aux_index, data_type, dx_dt=False):
|
|
@@ -849,7 +849,7 @@ class DataLoader(BaseLoader):
|
|
|
849
849
|
data.test_ID,
|
|
850
850
|
self.arbin_headers_normal.data_point_txt,
|
|
851
851
|
)
|
|
852
|
-
summary_df = pd.read_sql_query(sql, conn)
|
|
852
|
+
summary_df = pd.read_sql_query(sql=sa.text(sql), con=conn.connect())
|
|
853
853
|
|
|
854
854
|
if summary_df.empty and prms.Reader.use_cellpy_stat_file:
|
|
855
855
|
txt = "\nCould not find any summary (stats-file)!"
|
|
@@ -1397,14 +1397,13 @@ class DataLoader(BaseLoader):
|
|
|
1397
1397
|
if not prms.Instruments.Arbin.chunk_size:
|
|
1398
1398
|
self.logger.debug("no chunk-size given")
|
|
1399
1399
|
# memory here
|
|
1400
|
-
normal_df = pd.read_sql_query(sql, conn)
|
|
1400
|
+
normal_df = pd.read_sql_query(sql=sa.text(sql), con=conn.connect())
|
|
1401
1401
|
# memory here
|
|
1402
1402
|
length_of_test = normal_df.shape[0]
|
|
1403
1403
|
else:
|
|
1404
1404
|
self.logger.debug(f"chunk-size: {prms.Instruments.Arbin.chunk_size}")
|
|
1405
1405
|
self.logger.debug("creating a pd.read_sql_query generator")
|
|
1406
|
-
normal_df_reader = pd.read_sql_query(
|
|
1407
|
-
sql, conn, chunksize=prms.Instruments.Arbin.chunk_size
|
|
1406
|
+
normal_df_reader = pd.read_sql_query(sql=sa.text(sql), con=conn.connect(), chunksize=prms.Instruments.Arbin.chunk_size
|
|
1408
1407
|
)
|
|
1409
1408
|
normal_df = None
|
|
1410
1409
|
chunk_number = 0
|
|
@@ -84,6 +84,7 @@ cellpy/utils/batch_tools/engines.py
|
|
|
84
84
|
cellpy/utils/data/20160805_test001_45_cc.h5
|
|
85
85
|
cellpy/utils/data/raw/20160805_test001_45_cc_01.res
|
|
86
86
|
docs/Makefile
|
|
87
|
+
docs/adapted_readme.rst
|
|
87
88
|
docs/authors.rst
|
|
88
89
|
docs/basics.rst
|
|
89
90
|
docs/conf.py
|
|
@@ -96,18 +97,25 @@ docs/index.rst
|
|
|
96
97
|
docs/installation.rst
|
|
97
98
|
docs/make.bat
|
|
98
99
|
docs/notebooks.rst
|
|
99
|
-
docs/readme.rst
|
|
100
100
|
docs/tips_and_tricks.rst
|
|
101
101
|
docs/usage.rst
|
|
102
102
|
docs/utils.rst
|
|
103
|
-
docs/_build/.doctrees/nbsphinx/
|
|
104
|
-
docs/_build/.doctrees/nbsphinx/
|
|
105
|
-
docs/_build/.doctrees/nbsphinx/
|
|
106
|
-
docs/_build/.doctrees/nbsphinx/
|
|
107
|
-
docs/_build/_images/
|
|
108
|
-
docs/_build/_images/
|
|
109
|
-
docs/_build/_images/
|
|
110
|
-
docs/_build/_images/
|
|
103
|
+
docs/_build/.doctrees/nbsphinx/examples_and_tutorials_notebooks_tutorial_get_cap_6_0.png
|
|
104
|
+
docs/_build/.doctrees/nbsphinx/examples_and_tutorials_notebooks_tutorial_get_cap_7_0.png
|
|
105
|
+
docs/_build/.doctrees/nbsphinx/examples_and_tutorials_notebooks_tutorial_get_cap_8_0.png
|
|
106
|
+
docs/_build/.doctrees/nbsphinx/examples_and_tutorials_notebooks_tutorial_simple_plot_2_0.png
|
|
107
|
+
docs/_build/_images/examples_and_tutorials_notebooks_tutorial_get_cap_6_0.png
|
|
108
|
+
docs/_build/_images/examples_and_tutorials_notebooks_tutorial_get_cap_7_0.png
|
|
109
|
+
docs/_build/_images/examples_and_tutorials_notebooks_tutorial_get_cap_8_0.png
|
|
110
|
+
docs/_build/_images/examples_and_tutorials_notebooks_tutorial_simple_plot_2_0.png
|
|
111
|
+
docs/_build/_images/graphviz-22185705e237fa530df24e4af50cb25833165e25.png
|
|
112
|
+
docs/_build/_images/graphviz-246f2486cd940f2ea40a07f847c86c22b2607ca8.png
|
|
113
|
+
docs/_build/_images/graphviz-42e9bc826d476a3d361a7f410e989ed34dc1aa85.png
|
|
114
|
+
docs/_build/_images/graphviz-619216a42370fd49669c083549129b8470c8fae1.png
|
|
115
|
+
docs/_build/_images/graphviz-6deb64a460668e8ef9bf0ca653314119adeeae66.png
|
|
116
|
+
docs/_build/_images/graphviz-83b62e03ef369ff0a30f027892dba95b91ea8b6c.png
|
|
117
|
+
docs/_build/_images/graphviz-ce8a9fe2ba01194aed847e0248d749db4093aca1.png
|
|
118
|
+
docs/_build/_images/graphviz-e94a5352318e02fcc5ef1f813e02a526c39af791.png
|
|
111
119
|
docs/_build/_images/templates_jupyterlab_001.png
|
|
112
120
|
docs/_build/_images/tutorials_utils_plotting_fig1.png
|
|
113
121
|
docs/_build/_images/tutorials_utils_plotting_fig2.png
|
|
Binary file
|
cellpy-0.4.2.post6/docs/_build/_images/examples_and_tutorials_notebooks_tutorial_simple_plot_2_0.png
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
==================================
|
|
2
|
+
Welcome to cellpy's documentation!
|
|
3
|
+
==================================
|
|
4
|
+
|
|
5
|
+
- *a library for assisting in analysing batteries and cells*
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
.. image:: https://img.shields.io/pypi/v/cellpy.svg
|
|
9
|
+
:target: https://pypi.python.org/pypi/cellpy
|
|
10
|
+
|
|
11
|
+
.. image:: https://img.shields.io/travis/jepegit/cellpy.svg
|
|
12
|
+
:target: https://travis-ci.org/jepegit/cellpy
|
|
13
|
+
|
|
14
|
+
.. image:: https://readthedocs.org/projects/cellpy/badge/?version=latest
|
|
15
|
+
:target: https://cellpy.readthedocs.io/en/latest/?badge=latest
|
|
16
|
+
:alt: Documentation Status
|
|
17
|
+
|
|
18
|
+
.. image:: https://pepy.tech/badge/cellpy
|
|
19
|
+
:target: https://pepy.tech/project/cellpy
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
This Python Package was developed to help the
|
|
23
|
+
researchers at IFE, Norway, in their cumbersome task of
|
|
24
|
+
interpreting and handling data from cycling tests of
|
|
25
|
+
batteries and cells.
|
|
26
|
+
|
|
27
|
+
|ProjectVersion|
|
|
28
|
+
|
|
29
|
+
Installation and dependencies
|
|
30
|
+
-----------------------------
|
|
31
|
+
|
|
32
|
+
The easiest way to install ``cellpy`` is to install with conda or pip.
|
|
33
|
+
|
|
34
|
+
With conda::
|
|
35
|
+
|
|
36
|
+
conda install -c conda-forge cellpy
|
|
37
|
+
|
|
38
|
+
Or if you prefer installing using pip::
|
|
39
|
+
|
|
40
|
+
python -m pip install cellpy
|
|
41
|
+
|
|
42
|
+
Have a look at the documentation for more detailed installation procedures, especially
|
|
43
|
+
with respect to "difficult" dependencies when installing with pip.
|
|
44
|
+
|
|
45
|
+
Licence
|
|
46
|
+
-------
|
|
47
|
+
|
|
48
|
+
``cellpy`` is free software made available under the MIT License.
|
|
49
|
+
|
|
50
|
+
Features
|
|
51
|
+
--------
|
|
52
|
+
|
|
53
|
+
* Load test-data and store in a common format.
|
|
54
|
+
* Summarize and compare data.
|
|
55
|
+
* Filter out the steps of interest.
|
|
56
|
+
* Process and plot the data.
|
|
57
|
+
* And more...
|