Skip to main content

Read, edit, and output parameters for scientific software.

Project description

Pyrameters

Pyrameters is a package for programmatically interacting with hierarchical parameter inputs for scientific software. It is currently targeted at the Deal.II PRM format.

Usage

This package can be installed from the PyPi package manager

pip install pyrameters

Using it is a matter of importing the pyrameters module, and creating a PRM object.

from pyrameters import PRM

with open('input.prm','r') as input:
    prm = PRM(input.read())

if prm['Dimension'] == 2:
    prm.set('/Model geometry/Hypercube/Length', 100)
else:
    prm.get('/Model geometry/Hypercube/Length', 10)

print(prm)

An empty PRM object can also be created without providing an input file.

from pyrameters import PRM

prm = PRM()

prm['Dimension'] = 3
prm['Output directory'] = 'results'
prm.add_subsection('Postprocess')
prm['Postprocess']['Output frequency'] = 10
prm.set('/Postprocess/Visualization/Format','vtu')

print(prm)

Which would output parameters to the terminal in valid PRM format:

set Dimension = 3
set Output directory = results

subsection Postprocess
  set Output frequency = 10

  subsection Visuzliation
    set Format = vtu
  end
end

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

pyrameters-0.0.1.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

pyrameters-0.0.1-py3-none-any.whl (17.7 kB view hashes)

Uploaded Python 3

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