Skip to main content

Dataframe-like tables of data with correlated uncertainties

Project description

correldata

PyPI Version

Dataframe-like tables of data with correlated uncertainties

These data are stored in a dictionary, whose values are numpy arrays with elements which may be strings, floats, or floats with associated uncertainties as defined in the uncertainties library.

When reading data from a csv file, column names are interpreted in the following way:

Column names are interpreted in the following way:

  • In most cases, each columns is converted to a dict value, with the corresponding dict key being the column's label.
  • Columns whose label starts with SE are interpreted as specifying the standard error for the latest preceding data column.
  • Columns whose label starts with correl are interpreted as specifying the correlation matrix for the latest preceding data column. In that case, column labels are ignored for the rest of the columns belonging to this matrix.
  • Columns whose label starts with covar are interpreted as specifying the covariance matrix for the latest preceding data column. In that case, column labels are ignored for the rest of the columns belonging to this matrix.
  • SE, correl, and covar may be specified for any arbitrary variable other than the latest preceding data column, by adding an underscore followed by the variable's label (ex: SE_foo, correl_bar, covar_baz).
  • correl, and covar may also be specified for any pair of variable, by adding an underscore followed by the two variable labels, joined by a second underscore (ex: correl_foo_bar, covar_X_Y). The elements of the first and second variables correspond, respectively, to the lines and columns of this matrix.

Example

import correldata

data  = '''
Sample, Tacid,  D47,   SE,         correl,,,  D48, covar,,,          correl_D47_D48
   FOO,   90., .245, .005,      1, 0.5, 0.5, .145,  4e-4, 1e-4, 1e-4, 0.5,   0,   0
   BAR,   90., .246, .005,    0.5,   1, 0.5, .146,  1e-4, 4e-4, 1e-4,   0, 0.5,   0
   BAZ,   90., .247, .005,    0.5, 0.5,   1, .147,  1e-4, 1e-4, 4e-4,   0,   0, 0.5
'''[1:-1]

cdata = correldata.read_str(data)
print(cdata)

yields:

{
  'Sample': array(['FOO', 'BAR', 'BAZ'], dtype='<U3'),
  'Tacid':  array([90., 90., 90.]),
  'D47':    uarray([0.245+/-0.005, 0.246+/-0.005, 0.247+/-0.005], dtype=object),
  'D48':    uarray([0.145+/-0.02, 0.146+/-0.02, 0.147+/-0.02], dtype=object)
}

and

print(cdata.str(correl_format = '.2f'))

yields:

Sample, Tacid,   D47, SE_D47, correl_D47,     ,     ,   D48, SE_D48, correl_D48,     ,     , correl_D47_D48,      ,      
   FOO,    90, 0.245,  0.005,       1.00, 0.50, 0.50, 0.145,   0.02,       1.00, 0.25, 0.25,           0.50, -0.00, -0.00
   BAR,    90, 0.246,  0.005,       0.50, 1.00, 0.50, 0.146,   0.02,       0.25, 1.00, 0.25,           0.00,  0.50, -0.00
   BAZ,    90, 0.247,  0.005,       0.50, 0.50, 1.00, 0.147,   0.02,       0.25, 0.25, 1.00,          -0.00,  0.00,  0.50

Documentation

https://mdaeron.github.io/correldata

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

correldata-2.0.0b2.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

correldata-2.0.0b2-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file correldata-2.0.0b2.tar.gz.

File metadata

  • Download URL: correldata-2.0.0b2.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for correldata-2.0.0b2.tar.gz
Algorithm Hash digest
SHA256 5dc860d72b6c9532eb0fd708a03a1d199c5b5d6204d82a95fa3cc96039d51bd4
MD5 f9cdcff8bf2dc0dba1b6383ce4362b29
BLAKE2b-256 fca98fe76c7c75b4993069495352f3f4277100a15457fbb9d20ee3ad2cbd8e4a

See more details on using hashes here.

File details

Details for the file correldata-2.0.0b2-py3-none-any.whl.

File metadata

  • Download URL: correldata-2.0.0b2-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for correldata-2.0.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 eb7c84c31d686fa91d5dab931e2f8c6544ab3695f370cd5d25653693be9ded50
MD5 fb9c6c40187cb9ac2485f248e9f17476
BLAKE2b-256 01a8e14db25cb4607d6085471586e7f872ec945bb3073df9b41bde113839e4aa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page