Function adas.write_adf12

def write_adf12(file=None, fulldata=None, wave=None, comments=None, oldstyle=False)

Write an adf12 beam stopping coefficient file from a user supplied fulldata dictionary.

Parameters

file : str
full name of adf12 file.
fulldata : dict
contents of the adf12 file
    'nbsel'    :  number of transitions in file
    'csymb'    :  element symbol
                    string array(nbsel)
    'czion'    :  emitting ion charge
                    string array(nbsel)
    'cwavel'   :  wavelength (A)
                    string array(nbsel)
    'cdonor'   :  donor neutral atom
                    string array(nbsel)
    'crecvr'   :  receiver nucleus
                    string array(nbsel)
    'ctrans'   :  transition
                    string array(nbsel)
    'cfile'    :  specific ion file source
                    string array(nbsel)
    'ctype'    :  type of emissivity
                    string array(nbsel)
    'cindm'    :  emissivity index
                    string array(nbsel)
    'qefref'   :  reference value of rate coefficient
                     float array(nbsel)
    'enref'    :  reference value of energy
                     float array(nbsel)
    'teref'    :  reference value of temperature
                     float array(nbsel)
    'deref'    :  reference value of density
                     float array(nbsel)
    'zeref'    :  reference value of effective z
                     float array(nbsel)
    'bmref'    :  reference value of magnetic field
                     float array(nbsel)
    'nenera'   :  number of energies
                     float array(nbsel)
    'ntempa'   :  number of temperatures
                     float array(nbsel)
    'ndensa'   :  number of densities
                     float array(nbsel)
    'nzeffa'   :  number of effective z
                     float array(nbsel)
    'nbmaga'   :  number of magnetic field values
                     float array(nbsel)
    'enera'    :  energies
                     float array(ndein, nbsel)
    'tempa'    :  temperatures
                     float array(ndtem, nbsel)
    'densa'    :  densities
                     float array(ndden, nbsel)
    'zeffa'    :  effective z
                     float array(ndzef, nbsel)
    'bmaga'    :  magnetic field
                     float array(ndmag, nbsel)
    'qenera'   :  rate coefficients for energy value
                     float array(ndein, nbsel)
    'qtempa'   :  rate coefficients for temperatures
                     float array(ndtem, nbsel)
    'qdensa'   :  rate coefficients for densities
                     float array(ndden, nbsel)
    'qzeffa'   :  rate coefficients for effective z
                     float array(ndzef, nbsel)
    'qbmaga'   :  rate coefficients for magnetic fields
                     float array(ndmag, nbsel)
wave : array, optional
if supplied use these values for the wavelength field.
comments : list, optional
comments for the end of the file as a list of strings.
oldstyle : bool
if set to True pad out arrays with zeros, the default is False.

Notes

The newer style adf12 files are written with an information line given by keys and arrays are trimmed of trailing zeros.

References

ADAS manual description of adf12: http://www.adas.ac.uk/man/appxa-12.pdf

Version History

  • Martin O'Mullane, 23-02-2021

    • First version
  • Martin O'Mullane, 12-05-2021

    • Complete the documentation and fix spelling in exceptions.
  • Martin O'Mullane, 26-05-2021

    • Add oldstyle option.
  • Martin O'Mullane, 28-11-2021

    • Adjust format statements due to change in array2strlist.

Example

Round trip of He-like carbon file.

>>> import adas as adas
>>> file='/home/adas/adas/adf12/qef93#h/qef93#h_c6.dat'
>>> fulldata=adas.xxdata_12(file)
>>> my_comments=['C Testing write_adf12', 'C By me, today']
>>> my_file='/tmp/test_write_adf12.dat'
>>> adas.write_adf12(file=my_file, fulldata=fulldata,
...                  comments=my_comments, oldstyle=True)