Various

Using pytest fixtures

Retrieve constants during tests

There is a fixture in conftest.py aptly named parameters making all the variables defined in fdv.py accessible for the tests. So, please, add additional parameter / constant by editing the fdv.py file.

Other

You can check the conftest.py file to see what other fixtures are available.

Example

from cellpy import prms

# using the ``parameters`` and the ``cellpy_data_instance`` fixtures.

def test_set_instrument_selecting_default(cellpy_data_instance, parameters):
    prms.Instruments.custom_instrument_definitions_file = parameters.custom_instrument_definitions_file
    cellpy_data_instance.set_instrument(instrument="custom")

Adding another config parameter

  1. Edit prms.py

  2. Check / update the internal_settings.py file as well to ensure that copying / splitting cellpy objects behaves properly.

  3. Check / update the .cellpy_prms_default.conf file

The relevant files are located in the parameters folder:

cellpy/
    parameters/
        .cellpy_prms_default.conf
        prms.py
        internal_settings.py

Folder structure

+---tests
+---test_data
+---docs
+---examples
+---cellpy
|   |   __init__.py
|   |   cli.py
|   |   exceptions.py
|   |   log.py
|   |   logging.json
|   |   _version.py
|   |
|   +---parameters
|   |   |   __init__.py
|   |   |   .cellpy_prms_default.conf
|   |   |   internal_settings.py
|   |   |   prmreader.py
|   |   |   prms.py
|   |
|   +---readers
|   |   |   __init__.py
|   |   |   cellreader.py
|   |   |   core.py
|   |   |   dbreader.py
|   |   |   filefinder.py
|   |   |
|   |   +---instruments
|   |   |   |   __init__.py
|   |   |   |   arbin_res.py
|   |   |   |   arbin_sql.py
|   |   |   |   arbin_sql_csv.py
|   |   |   |   base.py
|   |   |   |   custom_instrument.py
|   |   |   |   local_instrument.py
|   |   |   |   maccor_txt.py
|   |   |   |   pec.py
|   |   |   |
|   |   |   +---configurations
|   |   |   |   |   __init__.py
|   |   |   |   |   maccor_txt_four.py
|   |   |   |   |   maccor_txt_one.py
|   |   |   |   |   maccor_txt_three.py
|   |   |   |   |   maccor_txt_two.py
|   |   |   |   |   maccor_txt_zero.py
|   |   |   +---processors
|   |   |   |   |   __init__.py
|   |   |   |   |   post_processors.py
|   |   |   |   |   pre_processors.py
|   |   |   |
|   +---utils
|   |   |   __init__.py
|   |   |   diagnostics.py
|   |   |   easyplot.py
|   |   |   example_data.py
|   |   |   helpers.py
|   |   |   ica.py
|   |   |   ocv_rlx.py
|   |   |   plotutils.py
|   |   |   batch.py
|   |   |
|   |   +---batch_tools
|   |   |   |   __init__.py
|   |   |   |   batch_analyzers.py
|   |   |   |   batch_core.py
|   |   |   |   batch_experiments.py
|   |   |   |   batch_exporters.py
|   |   |   |   batch_helpers.py
|   |   |   |   batch_journals.py
|   |   |   |   batch_plotters.py
|   |   |   |   batch_reporters.py
|   |   |   |   dumpers.py
|   |   |   |   engines.py
|   |   |
|   |   +---data
|   |   |   |   20160805_test001_45_cc.h5
|   |   |   |
|   |   |   \---raw
|   |   |           20160805_test001_45_cc_01.res
setup.py
...

Handling of parameters

Logging

Readers

Instrument readers

Internal basic readers

Internal txt-readers

Custom readers

Database readers

Other

Utilities

The CellpyData object

The CellpyData object contains the main methods as well as the actual data:

cellpy_instance = CellpyData(...)

Data is stored as Cell instances within the list cells. Even though one CellpyData instance can contain several Cell instances, it is (currently) recommended to only use one.

The Cell instance can be reached using the cell property:

cell_instance = cellpy_instance.cell

The Cell object

The Cell object contains the data and the meta-data for the cell characterisation experiment(s).

The cellpy file format

As default, cellpy stores files in the hdf5 format.