Example #1
0
def doFfQ(inQ, outQ):
    """
    Multiprocessing helper for `ChiantiPy.core.continuum.freeFree`

    Parameters
    -----------
    inQ : `~multiprocessing.Queue`
        Ion free-free emission jobs queued up by multiprocessing module
    outQ : `~multiprocessing.Queue`
        Finished free-free emission jobs
    """
    for inputs in iter(inQ.get, 'STOP'):
        ionS = inputs[0]
        temperature = inputs[1]
        wavelength = inputs[2]
        abund = inputs[3]
        em = inputs[4]
        ff = ch.continuum(ionS, temperature, abundance=abund, em=em)
        ff.freeFree(wavelength)
        outQ.put(ff.FreeFree)
    return
Example #2
0
def test_temperature():
    _tmp_cont = continuum(test_ion, temperature_1)
    assert np.array(temperature_1) == temperature_1
    _tmp_cont = continuum(test_ion, temperature_2)
    assert np.all(temperature_2 == tmp_cont.Temperature)
Example #3
0
Tests for the continuum class
"""

import numpy as np
import pytest

from ChiantiPy.core import continuum

# test ion
test_ion = "fe_15"
# set some wavelength and temperature arrays
temperature_1 = 1e6
temperature_2 = np.logspace(5, 8, 10)
wavelength = np.linspace(10, 100, 100)
# create continuum object for testing
tmp_cont = continuum(test_ion, temperature_2)


# test temperature input
def test_temperature():
    _tmp_cont = continuum(test_ion, temperature_1)
    assert np.array(temperature_1) == temperature_1
    _tmp_cont = continuum(test_ion, temperature_2)
    assert np.all(temperature_2 == tmp_cont.Temperature)


# test the free-free calculation
def test_freeFree():
    # call free-free continuum method
    tmp_cont.freeFree(wavelength)
    assert hasattr(tmp_cont, "FreeFree")