Esempio n. 1
0
def prf2grid(h5filename):
    """Load PlasmaPy Grid from pradformat SimpleFieds file"""
    fld = prf.prad_load(h5filename)
    return sf2grid(fld)
# read_simple_inversion.py: Template for reading a Simple Inversion file

import os
import numpy as np
import pradformat as prf

## Load object from pradformat file
h5filename = os.path.join('outs', 'myinversion.h5')
siv = prf.prad_load(h5filename)

## Examine your newly loaded object
print(siv)

## Utilize object's datasets and attributes in your own scripts
assert isinstance(siv, prf.SimpleInversion)

# siv.phi # optional* | Deflection potential in the object plane, the gradient of which gives the deflection angles. Omit only if the solution is not representable by a potential -- in which case specifying the deflection angles is required. | meters
# siv.defl_ax1 # optional* | Deflection angle along axis-1 (= grad phi, axis 1 component). Values can be positive (for deflection in +ax1 direction) or negative (for deflection in -ax1 direction). | rad
# siv.defl_ax2 # optional* | Deflection angle along axis-2 (= grad phi, axis 2 component). Values can be positive (for deflection in +ax1 direction) or negative (for deflection in -ax1 direction). | rad
#
# siv.object_type # required | Specification of the HDF5 object type | "inversion" (always this value)
# siv.inversion_type # required | Specification of the inversion sub-type | "simple" (always this value)
# siv.pradformat_version # required | HDF5 pradformat file format version followed | e.g. "0.1.0"
#
# siv.dr # required | Bin spacing along axis-1, in the object plane | meters
#
# siv.source_object_dist # required | Approximate distance from the particle source to the object plane (the E & M structures). Used to estimate image magnification. | meters
# siv.object_image_dist # required | Approximate distance from the object plane (the E & M structures) to the image plane (the radiograph). Used to estimate image magnification. | meters
#
# siv.spec_name # required | Shortname for the particle species**
# siv.spec_mass # required | Particle mass | kg
Esempio n. 3
0
# read_particles_list.py: Template for reading Particles List

import os
import numpy as np
import pradformat as prf

## Load object from pradformat file
h5filename = os.path.join('outs', 'myparticles.h5')
plist = prf.prad_load(h5filename)

## Examine your newly loaded object
print(plist)

## Utilize object's datasets and attributes in your own scripts
assert isinstance(plist, prf.ParticlesList)

# plist.x # required | x position of particle | meters
# plist.y # required | y position of particle | meters
# plist.z # required | z position of particle | meters
# plist.px # required | momentum of particle, x-component | kg * m/s
# plist.py # required | momentum of particle, y-component | kg * m/s
# plist.pz # required | momentum of particle, z-component | kg * m/s
# plist.charge # required | particle charge | Coulombs
# plist.mass # required | particle mass | kg
# plist.energy # optional | particle energy (can be derived from px,py,pz,mass) | eV
# plist.spec_name # optional | particle species name (e.g. "p+")*
# plist.weight # optional | for pseudoparticles, number of real particles represented | real particles / pseudoparticle
# plist.id # optional | unique particle ID (e.g. 4073)
#
# plist.object_type # required | Specification of the HDF5 object type | "particles" (always this value)
# plist.particles_type # required | Specification of the particles sub-type | "list" (always this value)