tofu.openadas2tofu package

The openadas-compatibility module of tofu

Submodules

tofu.openadas2tofu._read_files module

tofu.openadas2tofu._read_files.step03_read(adas_path, pec_as_func=None, **kwdargs)[source]

Read openadas-formatted files and return a dict with the data

Povide the full adas file name The result is returned as a dict

Example

>>> import tofu as tf
>>> fn = '/adf11/scd74/scd74_ar.dat'
>>> out = tf.openadas2tofu.step03_read(fn)
>>> fn = '/adf15/pec40][ar/pec40][ar_ca][ar16.dat'
>>> out = tf.openadas2tofu.step03_read(fn)
tofu.openadas2tofu._read_files.step03_read_all(element=None, charge=None, typ1=None, typ2=None, pec_as_func=None, format_for_DataCollection=None, dsource0=None, dref0=None, ddata0=None, dlines0=None, verb=None, **kwdargs)[source]

Read all relevant openadas files for chosen typ1

Please specify:
  • typ1:
    • ‘adf11’: ionisation / recombination data

    • ‘adf15’: pec data

  • element: the symbol of the element

If typ1 = ‘adf11’, you can also provide typ2 to specify the coefficients:
  • ‘scd’: effective ionisation coefficients

  • ‘acd’: effective electron-impact recombination coefficients

  • ‘ccd’: effective hydrogen-impact recombination coefficients

  • ‘plt’: line power due to electron-impact excitation

  • ‘prc’: line power due to hydrogen-impact excitation

  • ‘prb’: rad. recombination and bremmstrahlung due to electron-impact

If typ1 = ‘adf15’, you can optioanlly provide a min/max wavelength

The result is returned as a dict

Examples

>>> import tofu as tf
>>> dout = tf.openadas2tofu.step03_read_all(element='ar', typ1='adf11')
>>> dout = tf.openadas2tofu.step03_read_all(element='ar', typ1='adf15',
                                            charge=16,
                                            lambmin=3.94e-10,
                                            lambmax=4.e-10)

tofu.openadas2tofu._requests module

tofu.openadas2tofu._requests.clear_downloads()[source]

Delete all openadas files downloaded in your ~/.tofu/ directory

tofu.openadas2tofu._requests.step01_search_online(searchstr=None, returnas=None, include_partial=None, verb=None)[source]

Perform an online freeform search on https://open.adas.ac.uk

Pass searchstr to the online freeform search Prints the results (if verb=True)

Optionally return the result as:
  • np.ndarray : a char array

  • str : a formatted str

Example

>>> import tofu as tf
>>> tf.openadas2tofu.step01_search_online('ar+16 ADF15')
tofu.openadas2tofu._requests.step01_search_online_by_wavelengthA(lambmin=None, lambmax=None, element=None, charge=None, resolveby=None, returnas=None, verb=None)[source]

Perform an online search by wavelength on https://open.adas.ac.uk

Pass the min / max wavelength (in Angstrom) to the online wavelength search Prints the results (if verb=True)

Optionally return the result as:
  • np.ndarray : a char array

  • str : a formatted str

The result can be resolved by:
  • ‘transition’ : by spectral transition

  • ‘file’ : by adas file

Optionally filter by element and charge

Example

>>> import tofu as tf
>>> tf.openadas2tofu.step01_earch_online_by_wavelengthA(3., 4., 'ar')
>>> tf.openadas2tofu.step01_earch_online_by_wavelengthA(
    3., 4., 'w',
    resolveby='file',
)
tofu.openadas2tofu._requests.step02_download(filename=None, update=None, create_custom=None, verb=None, returnas=None)[source]

Download desired file from https://open.adas.ac.uk

All downloaded files are stored in your local tofu directory (~/.tofu/)

Automatically runs tofu-custom if create_custom=True

Example

>>> import tofu as tf
>>> filename = '/adf15/pec40][ar/pec40][ar_ls][ar16.dat'
>>> tf.openadas2tofu.step02_download(filename)
tofu.openadas2tofu._requests.step02_download_all(files=None, searchstr=None, lambmin=None, lambmax=None, element=None, include_partial=None, update=None, create_custom=None, verb=None)[source]

Download all desired files from https://open.adas.ac.uk

The files to download can be provided either as:
  • a list of full openadas file names (files)

  • the result of an online freeform search

    (searchstr fed to search_online)

  • the input to an online search by wavelength

    (lambmin, lambmax and element fed to search_online_by_wavelengthA)

Automatically runs tofu-custom if create_custom=True All downloaded files are stored in your local tofu directory (~/.tofu/)

Example

>>> import tofu as tf
>>> tf.openadas2tofu.step02_download_all(
    lambmin=3., lambmax=4., element='ar',
)