pyatomdb 1.0.2__tar.gz → 1.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/COPYING.txt +1 -1
  2. {pyatomdb-1.0.2/pyatomdb.egg-info → pyatomdb-1.0.4}/PKG-INFO +43 -7
  3. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/README.rst +11 -0
  4. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/README.txt +11 -0
  5. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/pyatomdb/__init__.py +1 -1
  6. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/pyatomdb/apec.py +17 -11
  7. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/pyatomdb/atomdb.py +64 -44
  8. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/pyatomdb/spectrum.py +59 -24
  9. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/pyatomdb/util.py +51 -18
  10. {pyatomdb-1.0.2 → pyatomdb-1.0.4/pyatomdb.egg-info}/PKG-INFO +43 -7
  11. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/pyatomdb.egg-info/SOURCES.txt +1 -1
  12. pyatomdb-1.0.4/pyproject.toml +40 -0
  13. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/setup.py +31 -30
  14. pyatomdb-1.0.2/pyatomdb.egg-info/not-zip-safe +0 -1
  15. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/MANIFEST.in +0 -0
  16. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/docs/Makefile +0 -0
  17. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/docs/apec.rst +0 -0
  18. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/docs/atomdb.rst +0 -0
  19. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/docs/atomic.rst +0 -0
  20. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/docs/conf.py +0 -0
  21. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/docs/const.rst +0 -0
  22. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/docs/contact.rst +0 -0
  23. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/docs/examples.rst +0 -0
  24. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/docs/index.rst +0 -0
  25. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/docs/installation.rst +0 -0
  26. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/docs/license.rst +0 -0
  27. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/docs/modules.rst +0 -0
  28. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/docs/requirements.txt +0 -0
  29. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/docs/spectrum.rst +0 -0
  30. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/docs/util.rst +0 -0
  31. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/Rsapec_hitomi.svg +0 -0
  32. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/__pycache__/calc_power.cpython-38.pyc +0 -0
  33. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/aciss_meg1_cy22.garf +0 -0
  34. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/aciss_meg1_cy22.grmf +0 -0
  35. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/ah100040030_sxs_cl2_HP_small.rmf +0 -0
  36. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/ah100040030sxs_p0px1010_cl2_HP.pi +0 -0
  37. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/ah100040030sxs_p0px1010_ptsrc.arf +0 -0
  38. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/apec_example_1_get_ionbal.py +0 -0
  39. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/apec_examples_1_1.pdf +0 -0
  40. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/apec_examples_1_1.svg +0 -0
  41. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/apec_examples_1_2.pdf +0 -0
  42. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/apec_examples_1_2.svg +0 -0
  43. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/atomdb_example_1_get_data.py +0 -0
  44. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/atomdb_example_2_get_maxwell.py +0 -0
  45. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/atomdb_examples_2_1.pdf +0 -0
  46. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/atomdb_examples_2_1.svg +0 -0
  47. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/atomdb_examples_2_2.pdf +0 -0
  48. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/atomdb_examples_2_2.svg +0 -0
  49. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/calc_power.py +0 -0
  50. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/calc_power_examples_1_1.pdf +0 -0
  51. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/calc_power_examples_1_1.svg +0 -0
  52. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/calc_power_nei.py +0 -0
  53. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/first_installation.py +0 -0
  54. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/make_line_list.py +0 -0
  55. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/make_spectrum.py +0 -0
  56. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/new_make_spectrum.py +0 -0
  57. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/osc_str.py +0 -0
  58. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/photoionization_data.py +0 -0
  59. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/rsapec.py +0 -0
  60. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_NEIsession_examples.py +0 -0
  61. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_NEIsession_linelist_examples.py +0 -0
  62. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples.py +0 -0
  63. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples_1.py +0 -0
  64. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples_1_1.pdf +0 -0
  65. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples_1_1.svg +0 -0
  66. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples_1b.py +0 -0
  67. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples_1b_1.pdf +0 -0
  68. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples_1b_1.svg +0 -0
  69. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples_2.py +0 -0
  70. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples_2_1.pdf +0 -0
  71. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples_2_1.svg +0 -0
  72. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples_3_1.pdf +0 -0
  73. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples_3_1.svg +0 -0
  74. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples_3_abund.py +0 -0
  75. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples_4_1.pdf +0 -0
  76. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples_4_1.svg +0 -0
  77. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples_4_abund.py +0 -0
  78. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples_5_linelist.py +0 -0
  79. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples_6_1.pdf +0 -0
  80. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples_6_1.svg +0 -0
  81. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples_6_line_emissivity.py +0 -0
  82. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples_7_1.pdf +0 -0
  83. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples_7_1.svg +0 -0
  84. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples_7_nei.py +0 -0
  85. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_examples_8_nei_linelist.py +0 -0
  86. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/spectrum_session_linelist_examples.py +0 -0
  87. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/examples/wrapper_xspec_examples.py +0 -0
  88. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/linear_approx.c +0 -0
  89. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/make_test_outputs.py +0 -0
  90. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/pyatomdb/atomic.py +0 -0
  91. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/pyatomdb/const.py +0 -0
  92. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/pyatomdb/spectrum-merge.py +0 -0
  93. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/pyatomdb/test_dep.py +0 -0
  94. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/pyatomdb.egg-info/dependency_links.txt +0 -0
  95. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/pyatomdb.egg-info/requires.txt +0 -0
  96. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/pyatomdb.egg-info/top_level.txt +0 -0
  97. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/setup.cfg +0 -0
  98. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/tests/__init__.py +0 -0
  99. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/tests/test1.py +0 -0
  100. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/tests/testdata/aciss_heg1_cy19.garf +0 -0
  101. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/tests/testdata/aciss_heg1_cy19.grmf +0 -0
  102. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/tests/testdata/test_set_response_spec1.npy +0 -0
  103. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/tests/testdata/test_set_response_spec1_309.npy +0 -0
  104. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/tests/testdata/test_set_response_spec2_309.npz +0 -0
  105. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/wrappers/IonE_apec_xspec.py +0 -0
  106. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/wrappers/__pycache__/IonE_apec_xspec.cpython-38.pyc +0 -0
  107. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/wrappers/__pycache__/apec_xspec.cpython-36.pyc +0 -0
  108. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/wrappers/__pycache__/bapec_xspec.cpython-36.pyc +0 -0
  109. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/wrappers/aciss_meg1_cy22.garf +0 -0
  110. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/wrappers/aciss_meg1_cy22.grmf +0 -0
  111. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/wrappers/apec_xspec.py +0 -0
  112. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/wrappers/bapec_xspec.py +0 -0
  113. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/wrappers/rsapec_xspec.py +0 -0
  114. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/wrappers/test_ionE_apec.py +0 -0
  115. {pyatomdb-1.0.2 → pyatomdb-1.0.4}/wrappers/test_ionE_apec2.py +0 -0
@@ -1,4 +1,4 @@
1
- Copyright 2015-20 Smithsonian Institution. Permission is granted to use, copy,
1
+ Copyright 2015-25 Smithsonian Institution. Permission is granted to use, copy,
2
2
  modify, and distribute this software and its documentation for educational,
3
3
  research and non-profit purposes, without fee and without a signed
4
4
  licensing agreement, provided that this notice, including the following
@@ -1,13 +1,38 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyatomdb
3
- Version: 1.0.2
3
+ Version: 1.0.4
4
4
  Summary: AtomDB python library.
5
- Home-page: http://www.atomdb.org
6
- Author: Adam Foster
7
- Author-email: afoster@cfa.harvard.edu
8
- License: Smithsonian
5
+ Author-email: Adam Foster <afoster@cfa.harvard.edu>
6
+ Maintainer-email: Adam Foster <afoster@cfa.harvard.edu>
7
+ License: Copyright 2015-25 Smithsonian Institution. Permission is granted to use, copy,
8
+ modify, and distribute this software and its documentation for educational,
9
+ research and non-profit purposes, without fee and without a signed
10
+ licensing agreement, provided that this notice, including the following
11
+ two paragraphs, appear in all copies, modifications and distributions.
12
+ For commercial licensing, contact the Office of the Chief Information
13
+ Officer, Smithsonian Institution, 380 Herndon Parkway, MRC 1010, Herndon,
14
+ VA. 20170, 202-633-5256.
15
+
16
+ This software and accompanying documentation is supplied "as is" without
17
+ warranty of any kind. The copyright holder and the Smithsonian
18
+ Institution: (1) expressly disclaim any warranties, express or implied,
19
+ including but not limited to any implied warranties of merchantability,
20
+ fitness for a particular purpose, title or non-infringement; (2) do not
21
+ assume any legal liability or responsibility for the accuracy,
22
+ completeness, or usefulness of the software; (3) do not represent that use
23
+ of the software would not infringe privately owned rights; (4) do not
24
+ warrant that the software is error-free or will be maintained, supported,
25
+ updated or enhanced; (5) will not be liable for any indirect, incidental,
26
+ consequential special or punitive damages of any kind or nature,
27
+ including but not limited to lost profits or loss of data, on any basis
28
+ arising from contract, tort or otherwise, even if any of the parties has
29
+ been warned of the possibility of such loss or damage.
30
+
31
+ Project-URL: Homepage, http://www.atomdb.org
32
+ Project-URL: Documentation, https://atomdb.readthedocs.io/en/master/
33
+ Project-URL: Repository, https://github.com/AtomDB/pyatomdb.git
34
+ Project-URL: Issues, https://github.com/AtomDB/pyatomdb/issues
9
35
  Classifier: Development Status :: 4 - Beta
10
- Classifier: Environment :: Console
11
36
  Classifier: Intended Audience :: Developers
12
37
  Classifier: Intended Audience :: Education
13
38
  Classifier: Intended Audience :: End Users/Desktop
@@ -16,7 +41,7 @@ Classifier: Topic :: Scientific/Engineering :: Astronomy
16
41
  Classifier: Topic :: Scientific/Engineering :: Physics
17
42
  Classifier: Programming Language :: Python :: 3
18
43
  Classifier: Operating System :: POSIX
19
- License-File: COPYING.txt
44
+ Description-Content-Type: text/x-rst
20
45
 
21
46
  ========
22
47
  PYATOMDB
@@ -283,3 +308,14 @@ Updated to allow access to all AtomDB v3.1.x eigenvector files (path was hardcod
283
308
  1.0.2
284
309
  January 31st 2025
285
310
  Removed debug output erroneously added to spectrum.py calls.
311
+
312
+ 1.0.3
313
+ March 7th 2025
314
+ Repaired util.py check_version command, along with other bug fixes.
315
+
316
+ 1.0.4
317
+ March 13th 2025
318
+ Improved check_version to print currently used database version.
319
+ Added clean_pickle_cache routine to clean out cache of pickle files
320
+ Changed spectrum Session objects to handle .dopseudo, .docont and .dopickle
321
+ attributes correctly and consistently.
@@ -263,3 +263,14 @@ Updated to allow access to all AtomDB v3.1.x eigenvector files (path was hardcod
263
263
  1.0.2
264
264
  January 31st 2025
265
265
  Removed debug output erroneously added to spectrum.py calls.
266
+
267
+ 1.0.3
268
+ March 7th 2025
269
+ Repaired util.py check_version command, along with other bug fixes.
270
+
271
+ 1.0.4
272
+ March 13th 2025
273
+ Improved check_version to print currently used database version.
274
+ Added clean_pickle_cache routine to clean out cache of pickle files
275
+ Changed spectrum Session objects to handle .dopseudo, .docont and .dopickle
276
+ attributes correctly and consistently.
@@ -263,3 +263,14 @@ Updated to allow access to all AtomDB v3.1.x eigenvector files (path was hardcod
263
263
  1.0.2
264
264
  January 31st 2025
265
265
  Removed debug output erroneously added to spectrum.py calls.
266
+
267
+ 1.0.3
268
+ March 7th 2025
269
+ Repaired util.py check_version command, along with other bug fixes.
270
+
271
+ 1.0.4
272
+ March 13th 2025
273
+ Improved check_version to print currently used database version.
274
+ Added clean_pickle_cache routine to clean out cache of pickle files
275
+ Changed spectrum Session objects to handle .dopseudo, .docont and .dopickle
276
+ attributes correctly and consistently.
@@ -9,7 +9,7 @@ from . import apec
9
9
  from . import util
10
10
  import sys, glob
11
11
 
12
- __version__="1.0.2"
12
+ __version__="1.0.4"
13
13
 
14
14
  try:
15
15
  PATH = os.path.dirname(__file__)
@@ -5681,6 +5681,12 @@ def _solve_ionbal_eigen(Z, Te, init_pop=False, tau=False, \
5681
5681
  telist = numpy.logspace(4,9,1251)
5682
5682
  kTlist=telist*const.KBOLTZ
5683
5683
 
5684
+ try:
5685
+ dd = d['EIGEN']
5686
+ except KeyError:
5687
+ elsymb = atomic.Ztoelsymb(Z).lower()
5688
+ dd=d[elsymb]
5689
+
5684
5690
  # if we are looking for equilibrium, return the nearest data
5685
5691
  if cie:
5686
5692
 
@@ -5690,10 +5696,10 @@ def _solve_ionbal_eigen(Z, Te, init_pop=False, tau=False, \
5690
5696
  if Tdiff > 0.0:
5691
5697
  factorlow = (kTlist[ite[1]]-kT)/Tdiff
5692
5698
  factorhigh = (kT-kTlist[ite[0]])/Tdiff
5693
- equilib = factorlow * d['EIGEN'].data['FEQB'][ite[0]]+\
5694
- factorhigh * d['EIGEN'].data['FEQB'][ite[1]]
5699
+ equilib = factorlow * dd.data['FEQB'][ite[0]]+\
5700
+ factorhigh * dd.data['FEQB'][ite[1]]
5695
5701
  else:
5696
- equilib = d['EIGEN'].data['FEQB'][ite[0]]
5702
+ equilib = dd.data['FEQB'][ite[0]]
5697
5703
 
5698
5704
  #renormalize
5699
5705
  equilib /= sum(equilib)
@@ -5715,16 +5721,16 @@ def _solve_ionbal_eigen(Z, Te, init_pop=False, tau=False, \
5715
5721
  if Z==1:
5716
5722
  for i in range(Z):
5717
5723
  for j in range(Z):
5718
- lefteigenvec[i,j] = d['EIGEN'].data['VL'][kTindex]
5719
- righteigenvec[i,j] = d['EIGEN'].data['VR'][kTindex]
5724
+ lefteigenvec[i,j] = dd.data['VL'][kTindex]
5725
+ righteigenvec[i,j] = dd.data['VR'][kTindex]
5720
5726
  else:
5721
5727
  for i in range(Z):
5722
5728
  for j in range(Z):
5723
- lefteigenvec[i,j] = d['EIGEN'].data['VL'][kTindex][i*Z+j]
5724
- righteigenvec[i,j] = d['EIGEN'].data['VR'][kTindex][i*Z+j]
5729
+ lefteigenvec[i,j] = dd.data['VL'][kTindex][i*Z+j]
5730
+ righteigenvec[i,j] = dd.data['VR'][kTindex][i*Z+j]
5725
5731
 
5726
5732
 
5727
- work = numpy.array(init_pop_calc[1:] - d['EIGEN'].data['FEQB'][kTindex][1:], dtype=float)
5733
+ work = numpy.array(init_pop_calc[1:] - dd.data['FEQB'][kTindex][1:], dtype=float)
5728
5734
 
5729
5735
  fspectmp = numpy.matrix(lefteigenvec) * numpy.matrix(work).transpose()
5730
5736
 
@@ -5735,16 +5741,16 @@ def _solve_ionbal_eigen(Z, Te, init_pop=False, tau=False, \
5735
5741
  for itau, ttau in enumerate(tau_vec):
5736
5742
  if Z >1:
5737
5743
  for i in range(Z):
5738
- worktmp[i] = fspectmp[i]*numpy.exp(d['EIGEN'].data['EIG'][kTindex,i]*delt*ttau)
5744
+ worktmp[i] = fspectmp[i]*numpy.exp(dd.data['EIG'][kTindex,i]*delt*ttau)
5739
5745
 
5740
5746
  else:
5741
- worktmp[0] = fspectmp[0]*numpy.exp(d['EIGEN'].data['EIG'][kTindex]*delt*ttau)
5747
+ worktmp[0] = fspectmp[0]*numpy.exp(dd.data['EIG'][kTindex]*delt*ttau)
5742
5748
 
5743
5749
  frac = numpy.zeros(Z+1)
5744
5750
  for i in range(Z):
5745
5751
  for j in range(Z):
5746
5752
  frac[i+1] += worktmp[j]*righteigenvec[j][i]
5747
- frac[i+1] += d['EIGEN'].data['FEQB'][kTindex][i+1]
5753
+ frac[i+1] += dd.data['FEQB'][kTindex][i+1]
5748
5754
 
5749
5755
  if debug:
5750
5756
  frac_out[ikT, itau,:] = frac
@@ -5776,22 +5776,31 @@ def _lorentz_power(version):
5776
5776
 
5777
5777
  f.write("%s\n"%(s))
5778
5778
 
5779
- ses = spectrum.Session(elements=Zlist)
5780
- ses.set_specbins(ebins, specunits='keV')
5779
+ ses = spectrum.CIESession(elements=Zlist)
5780
+ ses.set_response(ebins, raw=True)
5781
5781
  for iT in range(51):
5782
5782
  kT = 4.0+(iT*0.1)
5783
5783
  kT = 10**kT
5784
5784
  if iT == 0:
5785
5785
  kT+=1
5786
- ses.return_spectra(kT, teunit='K', nearest=True)
5786
+ ses.return_spectrum(kT, teunit='K', nearest=True)
5787
5787
  print(iT)
5788
5788
 
5789
+ ses.set_eebrems(False)
5789
5790
  for Z in Zlist:
5790
5791
  tot_e = numpy.zeros(51)
5791
5792
  s = "%2i"%(Z)
5792
5793
  print(Z)
5793
5794
  for iT in range(2,53):
5794
- spec = ses.spectra[iT].spectrum_by_Z[Z]
5795
+ kT = 4.0+((iT-2)*0.1)
5796
+ kT = 10**kT
5797
+ if iT == 0:
5798
+ kT+=1
5799
+
5800
+ ses.set_abund(Zlist, 0.0)
5801
+ ses.set_abund(Z, 1.0)
5802
+
5803
+ spec = ses.return_spectrum(kT, teunit='K',nearest=True)
5795
5804
  e = spec*energy
5796
5805
  # add corrections for NH != 1, to 1m3 volume, and abundance set
5797
5806
  # from AG89 to Lodders 2009
@@ -5926,7 +5935,7 @@ def _lorentz_neicsd(version):
5926
5935
  f.write('Z Ion Pop\n')
5927
5936
  for Z in [1,2,6,7,8,10,12,14,16,18,20,26,28]:
5928
5937
  print(Z)
5929
- ionbal = apec.solve_ionbal_eigen(Z, Te_final, tau=tau, Te_init=Te_init, \
5938
+ ionbal = apec._solve_ionbal_eigen(Z, Te_final, tau=tau, init_pop=Te_init, \
5930
5939
  teunit='K')
5931
5940
 
5932
5941
  for i in range(len(ionbal)):
@@ -6014,7 +6023,7 @@ def _lorentz_neilines(version):
6014
6023
 
6015
6024
  for Z in [1,2,6,7,8,10,12,14,16,18,20,26,28]:
6016
6025
 
6017
- ionbal[Z] = apec.solve_ionbal_eigen(Z, Te_final, tau=tau, Te_init=Te_init, \
6026
+ ionbal[Z] = apec._solve_ionbal_eigen(Z, Te_final, tau=tau, init_pop=Te_init, \
6018
6027
  teunit='K')
6019
6028
 
6020
6029
  ionbal_square = numpy.zeros([31,31])
@@ -6178,45 +6187,56 @@ def _lorentz_neicont(version):
6178
6187
  now = datetime.datetime.now()
6179
6188
  util.switch_version(version)
6180
6189
 
6181
- # make the spectrum.
6182
- speclo = numpy.zeros(len(ebins)-1)
6183
- specup = numpy.zeros(len(ebins)-1)
6184
- ag89 = get_abundance(abundset='AG89')
6185
- lodd = get_abundance(abundset='Lodd09')
6186
- ldat = pyfits.open(os.path.expandvars("$ATOMDB/apec_nei_line.fits"))
6187
- cdat = pyfits.open(os.path.expandvars("$ATOMDB/apec_nei_comp.fits"))
6188
-
6189
6190
 
6190
- upind = numpy.where(ldat[1].data['kT']>Te_final*const.KBOLTZ)[0][0]+2
6191
- loind = upind-1
6192
6191
 
6193
- for Z in range(1,31):
6194
- print("starting element %s"%(atomic.Ztoelname(Z)))
6195
- ionbal = apec.solve_ionbal_eigen(Z, Te_final, tau=tau, Te_init=Te_init, \
6196
- teunit='K')
6197
-
6198
- abund = lodd[Z]/ag89[Z]
6199
- for z in range(len(ionbal)):
6200
- z1 = z+1
6201
- if ionbal[z] > 1e-10:
6202
- tmp = spectrum.make_ion_spectrum(ebins, loind, Z, z1, linefile=ldat,\
6203
- cocofile=cdat)
6204
- speclo+=tmp*ionbal[z]*abund
6205
-
6206
- tmp = spectrum.make_ion_spectrum(ebins, upind, Z, z1, linefile=ldat,\
6207
- cocofile=cdat)
6208
- specup+=tmp*ionbal[z]*abund
6209
-
6210
- # now interpolate
6211
- t1 = numpy.log(ldat[1].data['kT'][loind-2])
6212
- t2 = numpy.log(ldat[1].data['kT'][upind-2])
6213
- print("t1 = ", t1)
6214
- print("t2 = ", t2)
6215
- print("log(tefinal)", numpy.log(Te_final*const.KBOLTZ))
6216
- r1 = 1- (numpy.log(Te_final*const.KBOLTZ)-t1)/(t2-t1)
6217
- r2 = 1- r1
6218
- print("r1= ",r1, "r2 ", r2)
6219
- spec = speclo*r1+specup*r2
6192
+ # make the spectrum.
6193
+ neispec = spectrum.NEISession()
6194
+ neispec.set_abundset('Lodd09')
6195
+ #neispec.set_abund('Lodd09')
6196
+
6197
+ neispec.set_response(ebins, raw=True)
6198
+ spec=neispec.return_spectrum(Te_init, tau, init_pop=Te_init, teunit='K')
6199
+
6200
+ # speclo = numpy.zeros(len(ebins)-1)
6201
+ # specup = numpy.zeros(len(ebins)-1)
6202
+ # ag89 = get_abundance(abundset='AG89')
6203
+ # lodd = get_abundance(abundset='Lodd09')
6204
+ # ldat = pyfits.open(os.path.expandvars("$ATOMDB/apec_nei_line.fits"))
6205
+ # cdat = pyfits.open(os.path.expandvars("$ATOMDB/apec_nei_comp.fits"))
6206
+
6207
+
6208
+ # upind = numpy.where(ldat[1].data['kT']>Te_final*const.KBOLTZ)[0][0]+2
6209
+ # loind = upind-1
6210
+
6211
+
6212
+
6213
+ # for Z in range(1,31):
6214
+ # print("starting element %s"%(atomic.Ztoelname(Z)))
6215
+ # ionbal = apec._solve_ionbal_eigen(Z, Te_final, tau=tau, init_pop=Te_init, \
6216
+ # teunit='K')
6217
+
6218
+ # abund = lodd[Z]/ag89[Z]
6219
+ # for z in range(len(ionbal)):
6220
+ # z1 = z+1
6221
+ # if ionbal[z] > 1e-10:
6222
+ # tmp = spectrum.make_ion_spectrum(ebins, loind, Z, z1, linefile=ldat,\
6223
+ # cocofile=cdat)
6224
+ # speclo+=tmp*ionbal[z]*abund
6225
+
6226
+ # tmp = spectrum.make_ion_spectrum(ebins, upind, Z, z1, linefile=ldat,\
6227
+ # cocofile=cdat)
6228
+ # specup+=tmp*ionbal[z]*abund
6229
+
6230
+ # # now interpolate
6231
+ # t1 = numpy.log(ldat[1].data['kT'][loind-2])
6232
+ # t2 = numpy.log(ldat[1].data['kT'][upind-2])
6233
+ # print("t1 = ", t1)
6234
+ # print("t2 = ", t2)
6235
+ # print("log(tefinal)", numpy.log(Te_final*const.KBOLTZ))
6236
+ # r1 = 1- (numpy.log(Te_final*const.KBOLTZ)-t1)/(t2-t1)
6237
+ # r2 = 1- r1
6238
+ # print("r1= ",r1, "r2 ", r2)
6239
+ # spec = speclo*r1+specup*r2
6220
6240
 
6221
6241
  # now scale spectrum by NH to get correct norm, and 1e6 to get to 1m^3
6222
6242
  spec *= 0.8365*1e6
@@ -6244,7 +6264,7 @@ def __get_lorentz_levpop(Z,z1,up,lo, Te, Ne, version, linelabel):
6244
6264
  # first, get the ionization balance
6245
6265
  datacache={}
6246
6266
  lvdat = get_data(Z,z1,'LV', datacache=datacache)
6247
- ionbal = apec.solve_ionbal_eigen(Z,Te, datacache=datacache)
6267
+ ionbal = apec._solve_ionbal_eigen(Z,Te, datacache=datacache)
6248
6268
  settings = apec.parse_par_file(os.path.expandvars('$ATOMDB/apec_v%s.par'%\
6249
6269
  (version)))
6250
6270
 
@@ -1840,6 +1840,18 @@ class CIESession():
1840
1840
 
1841
1841
  spec is in photons cm^5 s^-1 bin^-1; ebins are the bin edges (so spec is
1842
1842
  1 element shorter than ebins)
1843
+
1844
+ Turn off continuum and pseudocontinuum (by default these are on)
1845
+
1846
+ >>> s.dopseudo = False
1847
+ >>> s.docont = False
1848
+ >>> s.doeebrems = False
1849
+ >>> # s.dolines = False would turn off lines
1850
+ >>> spec = s.return_spectrum(1.0)
1851
+
1852
+ spec is in photons cm^5 s^-1 bin^-1; ebins are the bin edges (so spec is
1853
+ 1 element shorter than ebins)
1854
+
1843
1855
  """
1844
1856
 
1845
1857
  def __init__(self, linefile="$ATOMDB/apec_line.fits",\
@@ -2349,8 +2361,7 @@ class CIESession():
2349
2361
 
2350
2362
 
2351
2363
  def return_spectrum(self, te, teunit='keV', nearest=False,\
2352
- get_nearest_t=False, log_interp=True,\
2353
- dolines=True, docont=True, dopseudo=True):
2364
+ get_nearest_t=False, log_interp=True):
2354
2365
  """
2355
2366
  Get the spectrum at an exact temperature.
2356
2367
  Interpolates between 2 neighbouring spectra
@@ -2374,12 +2385,6 @@ class CIESession():
2374
2385
  as well as the spectrum.
2375
2386
  log_interp : bool
2376
2387
  Perform linear interpolation on a logT/logEpsilon grid, instead of linear.
2377
- dolines : bool
2378
- Calculate line emission (default True)
2379
- docont : bool
2380
- Calculate Continuum emission (default True)
2381
- dopseudo : bool
2382
- Calculate PseudoContinuum (weak line) emission (default True)
2383
2388
 
2384
2389
  Returns
2385
2390
  -------
@@ -2407,8 +2412,8 @@ class CIESession():
2407
2412
  s= self.spectra.return_spectrum(te, teunit=teunit, nearest=nearest,\
2408
2413
  elements = el_list, abundance=ab, \
2409
2414
  broaden_object = self.cdf, \
2410
- log_interp=log_interp, dolines=dolines,\
2411
- dopseudo=dopseudo, docont=docont, \
2415
+ log_interp=log_interp, dolines=self.dolines,\
2416
+ dopseudo=self.dopseudo, docont=self.docont, \
2412
2417
  do_eebrems = self.do_eebrems)
2413
2418
  ss = self._apply_response(s)
2414
2419
 
@@ -2849,7 +2854,7 @@ class CIESession():
2849
2854
  Returns
2850
2855
  -------
2851
2856
  emiss_aeff : array(float)
2852
- Emissivity \* Aeff
2857
+ Emissivity * Aeff
2853
2858
  """
2854
2859
 
2855
2860
 
@@ -3305,8 +3310,7 @@ class CIESession_RS(CIESession):
3305
3310
 
3306
3311
 
3307
3312
  def return_spectrum(self, te, N_e, Ab, teunit='keV', nearest=False,\
3308
- get_nearest_t=False, log_interp=True,\
3309
- dolines=True, docont=True, dopseudo=True):
3313
+ get_nearest_t=False, log_interp=True):
3310
3314
  """
3311
3315
  Get the spectrum at an exact temperature.
3312
3316
  Interpolates between 2 neighbouring spectra
@@ -3363,8 +3367,8 @@ class CIESession_RS(CIESession):
3363
3367
  s= self.spectra.return_spectrum(te, N_e, Ab, teunit=teunit, nearest=nearest,\
3364
3368
  elements = el_list, abundance=ab, \
3365
3369
  broaden_object = self.cdf, \
3366
- log_interp=log_interp, dolines=dolines,\
3367
- dopseudo=dopseudo, docont=docont, \
3370
+ log_interp=log_interp, dolines=self.dolines,\
3371
+ dopseudo=self.dopseudo, docont=self.docont, \
3368
3372
  do_eebrems = self.do_eebrems)
3369
3373
  ss = self._apply_response(s)
3370
3374
 
@@ -4036,7 +4040,7 @@ class _CIESpectrum():
4036
4040
  elements=False, abundance=False, log_interp=True,\
4037
4041
  broaden_object=False,\
4038
4042
  dolines=True, docont=True, dopseudo=True, \
4039
- do_eebrems = False):
4043
+ do_eebrems = True):
4040
4044
 
4041
4045
  """
4042
4046
  Return the spectrum of the element on the energy bins in
@@ -4068,7 +4072,7 @@ class _CIESpectrum():
4068
4072
  dopseudo : bool
4069
4073
  Calculate PseudoContinuum (weak line) emission (default True)
4070
4074
  do_eebrems : bool
4071
- Calculate electron-electron bremsstrahlung emission (default False)
4075
+ Calculate electron-electron bremsstrahlung emission (default True)
4072
4076
 
4073
4077
  Returns
4074
4078
  -------
@@ -6305,6 +6309,12 @@ class NEISession(CIESession):
6305
6309
  Perform linear interpolation on a logT/logEpsilon grid (default), or linear.
6306
6310
  freeze_ion_pop : bool
6307
6311
  If True, skip the ion population calculation, use init_pop as the final pop instead.
6312
+ dolines : bool
6313
+ Calculate line emission (default True)
6314
+ docont : bool
6315
+ Calculate Continuum emission (default True)
6316
+ dopseudo : bool
6317
+ Calculate PseudoContinuum (weak line) emission (default True)
6308
6318
 
6309
6319
  Returns
6310
6320
  -------
@@ -6327,6 +6337,10 @@ class NEISession(CIESession):
6327
6337
 
6328
6338
 
6329
6339
  self.spectra.ebins = self.specbins
6340
+ # self.spectra.dopseudo = self.dopseudo
6341
+ # self.spectra.dolines = self.dolines
6342
+ # self.spectra.docont = self.docont
6343
+
6330
6344
  self.spectra.ebins_checksum=hashlib.md5(self.spectra.ebins).hexdigest()
6331
6345
  s= self.spectra.return_spectrum(Te, tau, init_pop=init_pop, \
6332
6346
  teunit=teunit, \
@@ -6334,7 +6348,8 @@ class NEISession(CIESession):
6334
6348
  abundance=ab, log_interp=True,\
6335
6349
  broaden_object=self.cdf, \
6336
6350
  freeze_ion_pop = freeze_ion_pop,\
6337
- do_eebrems=self.do_eebrems)
6351
+ do_eebrems=self.do_eebrems, dolines=self.dolines,\
6352
+ dopseudo=self.dopseudo, docont=self.docont)
6338
6353
 
6339
6354
  ss = self._apply_response(s)
6340
6355
  self.ionfrac = self.spectra.ionfrac
@@ -6545,7 +6560,8 @@ class _NEISpectrum(_CIESpectrum):
6545
6560
 
6546
6561
  def return_spectrum(self, Te, tau, init_pop='ionizing', teunit='keV', nearest = False,
6547
6562
  elements=False, abundance=False, log_interp=True, broaden_object=False,\
6548
- freeze_ion_pop = False, do_eebrems = False):
6563
+ freeze_ion_pop = False, dolines=True, docont=True, dopseudo=True, \
6564
+ do_eebrems = True):
6549
6565
 
6550
6566
  """
6551
6567
  Return the spectrum of the element on the energy bins in
@@ -6579,8 +6595,14 @@ class _NEISpectrum(_CIESpectrum):
6579
6595
  Object with routine "broaden" which applies line broadening. Usually a Gaussian.
6580
6596
  freeze_ion_pop : bool
6581
6597
  If True, skip the ion population calculation, use init_pop as the final pop instead.
6598
+ dolines : bool
6599
+ Calculate line emission (default True)
6600
+ docont : bool
6601
+ Calculate Continuum emission (default True)
6602
+ dopseudo : bool
6603
+ Calculate PseudoContinuum (weak line) emission (default True)
6582
6604
  do_eebrems : bool
6583
- Calculate electron-electron bremsstrahlung emission (default False)
6605
+ Calculate electron-electron bremsstrahlung emission (default True)
6584
6606
 
6585
6607
  Returns
6586
6608
  -------
@@ -6653,7 +6675,10 @@ class _NEISpectrum(_CIESpectrum):
6653
6675
  thermal_broadening = self.thermal_broadening,\
6654
6676
  broaden_limit = epslimit,\
6655
6677
  velocity_broadening = self.velocity_broadening,\
6656
- broaden_object=broaden_object) *\
6678
+ broaden_object=broaden_object,\
6679
+ dopseudo=dopseudo,\
6680
+ docont=docont,\
6681
+ dolines=dolines) *\
6657
6682
  ionfrac[z1-1]
6658
6683
 
6659
6684
 
@@ -7561,7 +7586,8 @@ class _PShockSpectrum(_NEISpectrum):
7561
7586
 
7562
7587
  def return_spectrum(self, Te, tau_u, tau_l=0.0, init_pop='ionizing', teunit='keV', nearest = False,
7563
7588
  elements=False, abundance=False, log_interp=True, broaden_object=False,\
7564
- freeze_ion_pop=False, do_eebrems = False):
7589
+ freeze_ion_pop=False, dolines=True, docont=True, dopseudo=True, \
7590
+ do_eebrems = True):
7565
7591
 
7566
7592
  """
7567
7593
  Return the spectrum of the element on the energy bins in
@@ -7597,8 +7623,14 @@ class _PShockSpectrum(_NEISpectrum):
7597
7623
  Object with routine "broaden" which applies line broadening. Usually a Gaussian.
7598
7624
  freeze_ion_pop : bool
7599
7625
  If True, skip the ion population calculation, use init_pop as the final pop instead.
7626
+ dolines : bool
7627
+ Calculate line emission (default True)
7628
+ docont : bool
7629
+ Calculate Continuum emission (default True)
7630
+ dopseudo : bool
7631
+ Calculate PseudoContinuum (weak line) emission (default True)
7600
7632
  do_eebrems : bool
7601
- Calculate electron-electron bremsstrahlung emission (default False)
7633
+ Calculate electron-electron bremsstrahlung emission (default True)
7602
7634
 
7603
7635
  Returns
7604
7636
  -------
@@ -7656,7 +7688,10 @@ class _PShockSpectrum(_NEISpectrum):
7656
7688
  thermal_broadening = self.thermal_broadening,\
7657
7689
  broaden_limit = epslimit,\
7658
7690
  velocity_broadening = self.velocity_broadening,\
7659
- broaden_object=broaden_object) *\
7691
+ broaden_object=broaden_object,\
7692
+ dopseudo=dopseudo,\
7693
+ docont=docont,\
7694
+ dolines=dolines) *\
7660
7695
  ionfrac[z1-1]
7661
7696
 
7662
7697