1 '''
2 functions needed for standard Python multiprocessing module mspectrum
3 '''
4 import chianti
5
7 '''
8 multiprocessing helper for freefree
9 '''
10 for inputs in iter(inQ.get, 'STOP'):
11 ionS = inputs[0]
12 temperature = inputs[1]
13 wavelength = inputs[2]
14 abund = inputs[3]
15 em = inputs[4]
16 ff = chianti.core.continuum(ionS, temperature, abundance=abund, em=em)
17 ff.freeFree(wavelength)
18 outQ.put(ff.FreeFree)
19 return
20
21
22
24 '''
25 multiprocessing helper for freeBound
26 '''
27 for inputs in iter(inQ.get, 'STOP'):
28 ionS = inputs[0]
29 temperature = inputs[1]
30 wavelength = inputs[2]
31 abund = inputs[3]
32 em = inputs[4]
33 fb = chianti.core.continuum(ionS, temperature, abundance=abund, em=em)
34 fb.freeBound(wavelength)
35 outQ.put(fb.FreeBound)
36 return
37
38
39
41 '''
42 multiprocessing helper for ion, also does two-photon
43 '''
44 for inpts in iter(inQueue.get, 'STOP'):
45 ionS = inpts[0]
46 temperature = inpts[1]
47 density = inpts[2]
48 wavelength = inpts[3]
49 wvlRange = [wavelength.min(), wavelength.max()]
50 filter = inpts[4]
51 allLines = inpts[5]
52 abund = inpts[6]
53 em = inpts[7]
54 doContinuum = inpts[8]
55 thisIon = chianti.core.ion(ionS, temperature, density, abundance=abund)
56 thisIon.intensity(wvlRange = wvlRange, allLines = allLines, em=em)
57 if 'errorMessage' not in sorted(thisIon.Intensity.keys()):
58 thisIon.spectrum(wavelength, filter=filter)
59 outList = [ionS, thisIon]
60 if not thisIon.Dielectronic and doContinuum:
61 if (thisIon.Z - thisIon.Ion) in [0, 1]:
62 thisIon.twoPhoton(wavelength)
63 outList.append(thisIon.TwoPhoton)
64 outQueue.put(outList)
65 return
66