Skip to main content

Analysis tools for Radyn in Python

Project description

RadynPy

IMPORTANT NOTE

Currently my fork of cdflib is required. This can be found [here](https://github.com/Goobley/radynpy) and installed with pip by pip install ‘git+https://github.com/Goobley/cdflib.git’ Please install cdflib prior to radynpy, although the latter should shout at you if it is not present. Hopefully some of these changes will be merged into cdflib in good time, and this step will no longer be required.

This is a very early development release of RadynPy, a nascent suite of tools to allow analysis of Radyn simulations to be performed in Python.

If you don’t know what Radyn is, then this package is probably not aimed at you!

Currently the only class that is designed to be used is RadynData (and LazyRadynData), which can be used to load the .cdf files created by Radyn.

This module exposes the functions: index_convention, var_info, load_vars, and lazy_load_all.

  • Calling index_convention prints the indexing convention used in var_info.

  • var_info takes a str or list of str and prints the meaning of the associated variables, along with their dimensionality in the indexing convention used. var_info can also take ‘*’ as an argument, for which it will return the info on all variables.

  • load_vars takes the path to a CDF file and a list of the required variables which are then loaded into an instance of RadynData and can now be accesed as .varName rather than needing to go via the strings. If the filename is in the FCHROMA format then the heating parameters will be parsed from the string. If the filename is simply radyn_out.cdf then the filename isn’t scanned for parameters. If the filename is a different format then you may need to pass parseFilenameParams=False to load_vars. load_vars can also take ‘*’ as an argument, for which it will load all variables and timesteps into memory.

  • lazy_load_all loads all of the variables in the CDF in a lazy manner, meaning that they are only loaded into memory when called for the first time. This has the unfortunate side effect of needing to keep a handle to the CDF file open, so ideally the close() method should be called when you are done with the file, and not opening thousands (!) of CDF files simulataneously. For just a few files the call to close() isn’t too important as the class attempts to clean up after itself as much as possible. This mode is very good for easy exploration of CDF files as the requested variables do not need to be known a priori, making it easier to use in the REPL, without thehuge memory requirements of loading all of the variables from a file. lazy_load_all behaves in the same way as load_vars with respect to parsing the filename parameters, and also accepts the parseFilenameParams keyword.

I expect that lazy_load_all will become the prevailing mode of use, but in scripts where a large number of simulations (e.g. the grid) are being processed then load_vars will probably work out slightly more efficient.

This documentation will be fleshed out more in time, this is but a very early alpha release.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

radynpy-0.4.1-py3-none-any.whl (10.0 MB view details)

Uploaded Python 3

File details

Details for the file radynpy-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: radynpy-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 10.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.23.3 CPython/3.6.8

File hashes

Hashes for radynpy-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c58238d2e576f35a9662f4f6310affc4ae63dc3abf59ab50a856b290204dd71d
MD5 720867021e4c05b4d0d7f54c8246ae0c
BLAKE2b-256 4f38ed9979612b5977a9f1802716d9f1a40e9d90e75aa172e0a056165276fed5

See more details on using hashes here.

Supported by

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