In [1]:
pwd
Out[1]:
'/Users/marcwilliamson/src/dev/tardis/docs/notebooks'
In [1]:
import tardis
import numpy as np
/anaconda2/envs/tardis/lib/python3.6/site-packages/tqdm/autonotebook/__init__.py:14: TqdmExperimentalWarning: Using `tqdm.autonotebook.tqdm` in notebook mode. Use `tqdm.tqdm` instead to force console mode (e.g. in jupyter console)
" (e.g. in jupyter console)", TqdmExperimentalWarning)
In [2]:
density_dat = np.loadtxt('data/density.txt',skiprows=1)
abund_dat = np.loadtxt('data/abund.dat', skiprows=1)
print(density_dat)
print(abund_dat)
[[0.00000000e+00 2.90000000e+03 4.28253781e-16]
[1.00000000e+00 3.00000000e+03 4.12668886e-16]
[2.00000000e+00 3.10000000e+03 3.94940562e-16]
[3.00000000e+00 3.20000000e+03 3.80047743e-16]
[4.00000000e+00 3.30000000e+03 3.63720829e-16]
[5.00000000e+00 3.40000000e+03 3.53372945e-16]
[6.00000000e+00 3.50000000e+03 3.46148955e-16]
[7.00000000e+00 3.60000000e+03 3.37683976e-16]
[8.00000000e+00 3.70000000e+03 3.30780715e-16]
[9.00000000e+00 3.80000000e+03 3.26689004e-16]
[1.00000000e+01 3.90000000e+03 3.23089580e-16]]
[[0. 1. ]
[0.1 0.9]
[0.2 0.8]
[0.3 0.7]
[0.4 0.6]
[0.5 0.5]
[0.6 0.4]
[0.7 0.3]
[0.8 0.2]
[0.9 0.1]]
In [3]:
no_init_trad = tardis.run_tardis('data/config_no_init_trad.yml')
[py.warnings ][WARNING] /anaconda2/envs/tardis/lib/python3.6/importlib/_bootstrap.py:219: QAWarning: pyne.data is not yet QA compliant.
return f(*args, **kwds)
(warnings.py:99)
[py.warnings ][WARNING] /anaconda2/envs/tardis/lib/python3.6/importlib/_bootstrap.py:219: QAWarning: pyne.material is not yet QA compliant.
return f(*args, **kwds)
(warnings.py:99)
[tardis.model.base ][WARNING] Abundances have not been normalized to 1. - normalizing (base.py:394)
[py.warnings ][WARNING] /anaconda2/envs/tardis/lib/python3.6/site-packages/astropy/units/quantity.py:1067: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError.
AstropyDeprecationWarning)
(warnings.py:99)
[tardis.plasma.standard_plasmas][INFO ] Reading Atomic Data from /Users/marcwilliamson/Research/TARDIS/tardis-refdata/atom_data/kurucz_cd23_chianti_H_He.h5 (standard_plasmas.py:74)
[py.warnings ][WARNING] /anaconda2/envs/tardis/lib/python3.6/site-packages/IPython/core/interactiveshell.py:3296: PerformanceWarning: indexing past lexsort depth may impact performance.
exec(code_obj, self.user_global_ns, self.user_ns)
(warnings.py:99)
[tardis.io.atom_data.base][INFO ] Read Atom Data with UUID=6f7b09e887a311e7a06b246e96350010 and MD5=864f1753714343c41f99cb065710cace. (base.py:184)
[tardis.io.atom_data.base][INFO ] Non provided atomic data: synpp_refs, photoionization_data (base.py:187)
[py.warnings ][WARNING] /anaconda2/envs/tardis/lib/python3.6/site-packages/astropy/units/quantity.py:1067: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError.
AstropyDeprecationWarning)
(warnings.py:99)
[py.warnings ][WARNING] /Users/marcwilliamson/src/dev/tardis/tardis/plasma/properties/ion_population.py:63: FutureWarning:
Passing list-likes to .loc or [] with any missing label will raise
KeyError in the future, you can use .reindex() as an alternative.
See the documentation here:
https://pandas.pydata.org/pandas-docs/stable/indexing.html#deprecate-loc-reindex-listlike
partition_function.index].dropna())
(warnings.py:99)
[py.warnings ][WARNING] /anaconda2/envs/tardis/lib/python3.6/site-packages/astropy/units/quantity.py:1067: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError.
AstropyDeprecationWarning)
(warnings.py:99)
[tardis.simulation.base][INFO ] Starting iteration 1/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 7.60257e+41 erg / s Luminosity absorbed = 2.81189e+40 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 9464.058312 9484.781155 0.439255 0.464482
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 9464.848 K -- next t_inner 12021.255 K (base.py:350)
[py.warnings ][WARNING] /Users/marcwilliamson/src/dev/tardis/tardis/plasma/properties/ion_population.py:63: FutureWarning:
Passing list-likes to .loc or [] with any missing label will raise
KeyError in the future, you can use .reindex() as an alternative.
See the documentation here:
https://pandas.pydata.org/pandas-docs/stable/indexing.html#deprecate-loc-reindex-listlike
partition_function.index].dropna())
(warnings.py:99)
[tardis.simulation.base][INFO ] Starting iteration 2/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.60837e+42 erg / s Luminosity absorbed = 5.98006e+40 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 9484.781155 12054.327238 0.464482 0.464327
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 12021.255 K -- next t_inner 10497.194 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 3/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 9.75339e+41 erg / s Luminosity absorbed = 1.31663e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 12054.327238 10542.291939 0.464327 0.509656
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 10497.194 K -- next t_inner 11770.965 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 4/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.41912e+42 erg / s Luminosity absorbed = 1.52432e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 10542.291939 11750.092484 0.509656 0.512801
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11770.965 K -- next t_inner 10942.574 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 5/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.11236e+42 erg / s Luminosity absorbed = 1.52914e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11750.092484 10938.987367 0.512801 0.525724
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 10942.574 K -- next t_inner 11489.809 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 6/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.29924e+42 erg / s Luminosity absorbed = 1.66012e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 1/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 10938.987367 11456.397166 0.525724 0.521184
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11489.809 K -- next t_inner 11163.104 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 7/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.16874e+42 erg / s Luminosity absorbed = 1.57467e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 2/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11456.397166 11225.829447 0.521184 0.516013
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11163.104 K -- next t_inner 11435.147 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 8/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.27029e+42 erg / s Luminosity absorbed = 1.71822e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 3/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11225.829447 11346.454712 0.516013 0.53765
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11435.147 K -- next t_inner 11235.867 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 9/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.20003e+42 erg / s Luminosity absorbed = 1.63905e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 4/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11346.454712 11219.677659 0.53765 0.529105
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11235.867 K -- next t_inner 11358.682 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 10/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.24727e+42 erg / s Luminosity absorbed = 1.71495e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 5/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11219.677659 11296.3854 0.529105 0.53421
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11358.682 K -- next t_inner 11263.268 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 11/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.20567e+42 erg / s Luminosity absorbed = 1.59529e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 6/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11296.3854 11282.219084 0.53421 0.519595
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11263.268 K -- next t_inner 11359.683 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 12/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.23796e+42 erg / s Luminosity absorbed = 1.69674e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 7/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11282.219084 11392.613803 0.519595 0.515397
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11359.683 K -- next t_inner 11306.524 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 13/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.22796e+42 erg / s Luminosity absorbed = 1.72554e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11392.613803 11274.095909 0.515397 0.534286
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11306.524 K -- next t_inner 11299.342 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 14/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.22087e+42 erg / s Luminosity absorbed = 1.68061e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 1/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11274.095909 11272.622074 0.534286 0.523052
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11299.342 K -- next t_inner 11324.894 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 15/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.23507e+42 erg / s Luminosity absorbed = 1.67026e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 2/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11272.622074 11242.582689 0.523052 0.53977
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11324.894 K -- next t_inner 11285.077 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 16/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.21940e+42 erg / s Luminosity absorbed = 1.66346e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 3/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11242.582689 11290.452474 0.53977 0.522924
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11285.077 K -- next t_inner 11317.456 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 17/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.22578e+42 erg / s Luminosity absorbed = 1.67022e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 4/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11290.452474 11301.322725 0.522924 0.528649
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11317.456 K -- next t_inner 11320.345 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 18/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.22546e+42 erg / s Luminosity absorbed = 1.63272e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 5/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11301.322725 11321.012024 0.528649 0.522716
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11320.345 K -- next t_inner 11324.684 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 19/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.22575e+42 erg / s Luminosity absorbed = 1.70322e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 6/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11321.012024 11372.823716 0.522716 0.516131
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11324.684 K -- next t_inner 11327.703 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 20/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.23543e+42 erg / s Luminosity absorbed = 1.67596e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Simulation finished in 20 iterations and took 1.61 s (base.py:306)
In [5]:
no_init_trad.model.velocity
Out[5]:
$[3.35 \times 10^{8},~3.4 \times 10^{8},~3.5 \times 10^{8},~3.6 \times 10^{8},~3.7 \times 10^{8},~3.75 \times 10^{8}] \; \mathrm{\frac{cm}{s}}$
In [6]:
no_init_trad.model.no_of_shells, no_init_trad.model.no_of_raw_shells
Out[6]:
(5, 10)
In [7]:
print('raw velocity: \n',no_init_trad.model.raw_velocity)
print('raw velocity shape: ',no_init_trad.model.raw_velocity.shape)
print('(v_boundary_inner, v_boundary_outer) = (%i, %i)'%
(no_init_trad.model.v_boundary_inner.to('km/s').value, no_init_trad.model.v_boundary_outer.to('km/s').value))
print('v_boundary_inner_index: ', no_init_trad.model.v_boundary_inner_index)
print('v_boundary_outer_index: ', no_init_trad.model.v_boundary_outer_index)
print('t_rad', no_init_trad.model.t_rad)
raw velocity:
[2.9e+08 3.0e+08 3.1e+08 3.2e+08 3.3e+08 3.4e+08 3.5e+08 3.6e+08 3.7e+08
3.8e+08 3.9e+08] cm / s
raw velocity shape: (11,)
(v_boundary_inner, v_boundary_outer) = (3350, 3750)
v_boundary_inner_index: 4
v_boundary_outer_index: 10
t_rad [11372.82371614 11426.15383155 11420.35713928 11382.47864204
11375.63115928] K
In [ ]:
%%debug
init_trad = tardis.run_tardis('data/config_init_trad.yml')
NOTE: Enter 'c' at the ipdb> prompt to continue execution.
> <string>(2)<module>()
ipdb> b tardis/plasma/properties/j_blues:34
Breakpoint 1 at /Users/marcwilliamson/src/dev/tardis/tardis/plasma/properties/j_blues.py:34
ipdb> c
[tardis.model.base ][WARNING] Abundances have not been normalized to 1. - normalizing (base.py:368)
[py.warnings ][WARNING] /anaconda2/envs/tardis/lib/python3.6/site-packages/astropy/units/quantity.py:1067: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError.
AstropyDeprecationWarning)
(warnings.py:99)
[tardis.plasma.standard_plasmas][INFO ] Reading Atomic Data from /Users/marcwilliamson/Research/TARDIS/tardis-refdata/atom_data/kurucz_cd23_chianti_H_He.h5 (standard_plasmas.py:74)
[py.warnings ][WARNING] /anaconda2/envs/tardis/lib/python3.6/bdb.py:434: PerformanceWarning: indexing past lexsort depth may impact performance.
exec(cmd, globals, locals)
(warnings.py:99)
[tardis.io.atom_data.base][INFO ] Read Atom Data with UUID=6f7b09e887a311e7a06b246e96350010 and MD5=864f1753714343c41f99cb065710cace. (base.py:184)
[tardis.io.atom_data.base][INFO ] Non provided atomic data: synpp_refs, photoionization_data (base.py:187)
[py.warnings ][WARNING] /anaconda2/envs/tardis/lib/python3.6/site-packages/astropy/units/quantity.py:1067: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError.
AstropyDeprecationWarning)
(warnings.py:99)
> /Users/marcwilliamson/src/dev/tardis/tardis/plasma/properties/j_blues.py(34)calculate()
32 @staticmethod
33 def calculate(lines, nu, t_rad, w):
1--> 34 j_blues = w * intensity_black_body(nu.values[np.newaxis].T, t_rad)
35 j_blues = pd.DataFrame(j_blues, index=lines.index,
36 columns=np.arange(len(t_rad)))
ipdb> n
ValueError: operands could not be broadcast together with shapes (5,) (247,6)
> /Users/marcwilliamson/src/dev/tardis/tardis/plasma/properties/j_blues.py(34)calculate()
32 @staticmethod
33 def calculate(lines, nu, t_rad, w):
1--> 34 j_blues = w * intensity_black_body(nu.values[np.newaxis].T, t_rad)
35 j_blues = pd.DataFrame(j_blues, index=lines.index,
36 columns=np.arange(len(t_rad)))
ipdb> restart
Restarting
> <string>(2)<module>()
ipdb> c
[tardis.model.base ][WARNING] Abundances have not been normalized to 1. - normalizing (base.py:368)
[py.warnings ][WARNING] /anaconda2/envs/tardis/lib/python3.6/site-packages/astropy/units/quantity.py:1067: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError.
AstropyDeprecationWarning)
(warnings.py:99)
[tardis.plasma.standard_plasmas][INFO ] Reading Atomic Data from /Users/marcwilliamson/Research/TARDIS/tardis-refdata/atom_data/kurucz_cd23_chianti_H_He.h5 (standard_plasmas.py:74)
[py.warnings ][WARNING] /anaconda2/envs/tardis/lib/python3.6/bdb.py:434: PerformanceWarning: indexing past lexsort depth may impact performance.
exec(cmd, globals, locals)
(warnings.py:99)
[tardis.io.atom_data.base][INFO ] Read Atom Data with UUID=6f7b09e887a311e7a06b246e96350010 and MD5=864f1753714343c41f99cb065710cace. (base.py:184)
[tardis.io.atom_data.base][INFO ] Non provided atomic data: synpp_refs, photoionization_data (base.py:187)
[py.warnings ][WARNING] /anaconda2/envs/tardis/lib/python3.6/site-packages/astropy/units/quantity.py:1067: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError.
AstropyDeprecationWarning)
(warnings.py:99)
> /Users/marcwilliamson/src/dev/tardis/tardis/plasma/properties/j_blues.py(34)calculate()
32 @staticmethod
33 def calculate(lines, nu, t_rad, w):
1--> 34 j_blues = w * intensity_black_body(nu.values[np.newaxis].T, t_rad)
35 j_blues = pd.DataFrame(j_blues, index=lines.index,
36 columns=np.arange(len(t_rad)))
ipdb> t_rad
array([11000., 11000., 11000., 11000., 11000., 11000.])
ipdb> lines.shape
(247, 9)
ipdb> intensity_black_body(nu.values[np.newaxis].T, t_rad)
array([[3.45300820e-23, 3.45300820e-23, 3.45300820e-23, 3.45300820e-23,
3.45300820e-23, 3.45300820e-23],
[3.45300820e-23, 3.45300820e-23, 3.45300820e-23, 3.45300820e-23,
3.45300820e-23, 3.45300820e-23],
[1.17024224e-22, 1.17024224e-22, 1.17024224e-22, 1.17024224e-22,
1.17024224e-22, 1.17024224e-22],
...,
[1.65889253e-10, 1.65889253e-10, 1.65889253e-10, 1.65889253e-10,
1.65889253e-10, 1.65889253e-10],
[1.65754663e-10, 1.65754663e-10, 1.65754663e-10, 1.65754663e-10,
1.65754663e-10, 1.65754663e-10],
[8.99221749e-11, 8.99221749e-11, 8.99221749e-11, 8.99221749e-11,
8.99221749e-11, 8.99221749e-11]])
ipdb> intensity_black_body(nu.values[np.newaxis].T, t_rad).shape
(247, 6)
ipdb> lines.shape
(247, 9)
ipdb> nu.shape
(247,)
ipdb> restart
Restarting
> <string>(2)<module>()
ipdb> b tardis/simulation/base:436
Breakpoint 2 at /Users/marcwilliamson/src/dev/tardis/tardis/simulation/base.py:436
ipdb> c
[tardis.model.base ][WARNING] Abundances have not been normalized to 1. - normalizing (base.py:368)
[py.warnings ][WARNING] /anaconda2/envs/tardis/lib/python3.6/site-packages/astropy/units/quantity.py:1067: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError.
AstropyDeprecationWarning)
(warnings.py:99)
> /Users/marcwilliamson/src/dev/tardis/tardis/simulation/base.py(436)from_config()
434 plasma = kwargs['plasma']
435 else:
2-> 436 plasma = assemble_plasma(config, model,
437 atom_data=kwargs.get('atom_data', None))
438 if 'runner' in kwargs:
ipdb> model
<tardis.model.base.Radial1DModel object at 0x12e05a940>
ipdb> model.trad
*** AttributeError: 'Radial1DModel' object has no attribute 'trad'
ipdb> model.t_rad
<Quantity [11000., 11000., 11000., 11000., 11000., 11000.] K>
ipdb> model.velocity
<Quantity [3.35e+08, 3.40e+08, 3.50e+08, 3.60e+08, 3.70e+08, 3.75e+08] cm / s>
ipdb> b tardis/model/base:334
Breakpoint 3 at /Users/marcwilliamson/src/dev/tardis/tardis/model/base.py:334
ipdb> restart
Restarting
> <string>(2)<module>()
ipdb> c
> /Users/marcwilliamson/src/dev/tardis/tardis/model/base.py(334)from_config()
332 t_radiative = temperature
333 elif config.plasma.initial_t_rad > 0 * u.K:
3-> 334 t_radiative = np.ones(no_of_shells) * config.plasma.initial_t_rad
335 else:
336 t_radiative = None
ipdb> n
> /Users/marcwilliamson/src/dev/tardis/tardis/model/base.py(338)from_config()
336 t_radiative = None
337
--> 338 if config.plasma.initial_t_inner < 0.0 * u.K:
339 luminosity_requested = config.supernova.luminosity_requested
340 t_inner = None
ipdb> t_radiative
<Quantity [11000., 11000., 11000., 11000., 11000., 11000., 11000., 11000.,
11000., 11000.] K>
ipdb> b tardis/model/base:107
Breakpoint 4 at /Users/marcwilliamson/src/dev/tardis/tardis/model/base.py:107
ipdb> c
[tardis.model.base ][WARNING] Abundances have not been normalized to 1. - normalizing (base.py:368)
> /Users/marcwilliamson/src/dev/tardis/tardis/model/base.py(107)__init__()
105 else:
106 #self._t_radiative = t_radiative[self.v_boundary_inner_index + 0:self.v_boundary_outer_index-1]
4-> 107 self._t_radiative = t_radiative
108
109 if dilution_factor is None:
ipdb> t_radiative
<Quantity [11000., 11000., 11000., 11000., 11000., 11000., 11000., 11000.,
11000., 11000.] K>
In [4]:
init_trad = tardis.run_tardis('data/config_init_trad.yml')
[tardis.model.base ][WARNING] Abundances have not been normalized to 1. - normalizing (base.py:394)
[tardis.plasma.standard_plasmas][INFO ] Reading Atomic Data from /Users/marcwilliamson/Research/TARDIS/tardis-refdata/atom_data/kurucz_cd23_chianti_H_He.h5 (standard_plasmas.py:74)
[py.warnings ][WARNING] /anaconda2/envs/tardis/lib/python3.6/site-packages/IPython/core/interactiveshell.py:3296: PerformanceWarning: indexing past lexsort depth may impact performance.
exec(code_obj, self.user_global_ns, self.user_ns)
(warnings.py:99)
[tardis.io.atom_data.base][INFO ] Read Atom Data with UUID=6f7b09e887a311e7a06b246e96350010 and MD5=864f1753714343c41f99cb065710cace. (base.py:184)
[tardis.io.atom_data.base][INFO ] Non provided atomic data: synpp_refs, photoionization_data (base.py:187)
[py.warnings ][WARNING] /anaconda2/envs/tardis/lib/python3.6/site-packages/astropy/units/quantity.py:1067: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError.
AstropyDeprecationWarning)
(warnings.py:99)
[py.warnings ][WARNING] /Users/marcwilliamson/src/dev/tardis/tardis/plasma/properties/ion_population.py:63: FutureWarning:
Passing list-likes to .loc or [] with any missing label will raise
KeyError in the future, you can use .reindex() as an alternative.
See the documentation here:
https://pandas.pydata.org/pandas-docs/stable/indexing.html#deprecate-loc-reindex-listlike
partition_function.index].dropna())
(warnings.py:99)
[py.warnings ][WARNING] /anaconda2/envs/tardis/lib/python3.6/site-packages/astropy/units/quantity.py:1067: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError.
AstropyDeprecationWarning)
(warnings.py:99)
[tardis.simulation.base][INFO ] Starting iteration 1/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 5.98252e+41 erg / s Luminosity absorbed = 1.50141e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11000.0 10177.195287 0.408333 0.538077
5 11000.0 10160.603522 0.229156 0.282716
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 10172.718 K -- next t_inner 14565.035 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 2/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.82691e+42 erg / s Luminosity absorbed = 2.82152e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 10177.195287 14593.630626 0.538077 0.496563
5 10160.603522 14511.556871 0.282716 0.275395
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 14565.035 K -- next t_inner 11933.532 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 3/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 9.71423e+41 erg / s Luminosity absorbed = 2.55207e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 14593.630626 11959.523175 0.496563 0.536576
5 14511.556871 11863.444513 0.275395 0.288444
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11933.532 K -- next t_inner 13408.534 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 4/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.34841e+42 erg / s Luminosity absorbed = 3.56350e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11959.523175 13397.442807 0.536576 0.545853
5 11863.444513 13434.561796 0.288444 0.279834
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 13408.534 K -- next t_inner 12787.534 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 5/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.18228e+42 erg / s Luminosity absorbed = 3.17468e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 13397.442807 12761.259654 0.545853 0.549926
5 13434.561796 12694.451547 0.279834 0.291458
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 12787.534 K -- next t_inner 13023.975 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 6/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.24451e+42 erg / s Luminosity absorbed = 3.27235e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 1/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 12761.259654 12957.006442 0.549926 0.556939
5 12694.451547 12962.669431 0.291458 0.289348
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 13023.975 K -- next t_inner 12928.870 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 7/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.20889e+42 erg / s Luminosity absorbed = 3.17537e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 2/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 12957.006442 13011.562529 0.556939 0.528909
5 12962.669431 12911.385086 0.289348 0.287062
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 12928.870 K -- next t_inner 13022.158 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 8/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.23931e+42 erg / s Luminosity absorbed = 3.40055e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 3/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 13011.562529 12935.144806 0.528909 0.559823
5 12911.385086 12870.837942 0.287062 0.295395
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 13022.158 K -- next t_inner 12954.144 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 9/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.22083e+42 erg / s Luminosity absorbed = 3.29617e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 4/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 12935.144806 12952.771269 0.559823 0.547270
5 12870.837942 12869.711846 0.295395 0.288923
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 12954.144 K -- next t_inner 12983.662 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 10/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.23857e+42 erg / s Luminosity absorbed = 3.31449e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 5/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 12952.771269 12942.126028 0.547270 0.550270
5 12869.711846 12884.875415 0.288923 0.292539
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 12983.662 K -- next t_inner 12919.755 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 11/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.21056e+42 erg / s Luminosity absorbed = 3.23893e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 6/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 12942.126028 12918.966676 0.550270 0.544292
5 12884.875415 12886.798065 0.292539 0.286558
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 12919.755 K -- next t_inner 13004.019 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 12/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.22616e+42 erg / s Luminosity absorbed = 3.33203e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 7/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 12918.966676 13031.662542 0.544292 0.538490
5 12886.798065 13010.109337 0.286558 0.282402
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 13004.019 K -- next t_inner 13005.291 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 13/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.24894e+42 erg / s Luminosity absorbed = 3.24574e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 8/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 13031.662542 12990.586647 0.538490 0.548625
5 13010.109337 13019.214949 0.282402 0.283709
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 13005.291 K -- next t_inner 12887.418 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 14/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.21057e+42 erg / s Luminosity absorbed = 3.20036e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 9/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 12990.586647 12897.972400 0.548625 0.540328
5 13019.214949 12826.318536 0.283709 0.288119
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 12887.418 K -- next t_inner 12971.403 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 15/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.23054e+42 erg / s Luminosity absorbed = 3.31427e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 12897.972400 12860.146712 0.540328 0.564957
5 12826.318536 12875.961642 0.288119 0.291152
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 12971.403 K -- next t_inner 12949.598 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 16/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.22535e+42 erg / s Luminosity absorbed = 3.21967e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 1/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 12860.146712 12941.966455 0.564957 0.546565
5 12875.961642 12851.925013 0.291152 0.290785
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 12949.598 K -- next t_inner 12955.177 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 17/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.21929e+42 erg / s Luminosity absorbed = 3.29847e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 2/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 12941.966455 12925.141575 0.546565 0.554237
5 12851.925013 12885.285408 0.290785 0.289662
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 12955.177 K -- next t_inner 12992.898 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 18/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.22332e+42 erg / s Luminosity absorbed = 3.27060e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 3/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 12925.141575 13004.854945 0.554237 0.543770
5 12885.285408 13027.690260 0.289662 0.281762
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 12992.898 K -- next t_inner 13009.263 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 19/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.22932e+42 erg / s Luminosity absorbed = 3.29206e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 4/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 13004.854945 13056.576129 0.543770 0.537160
5 13027.690260 13038.177112 0.281762 0.277439
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 13009.263 K -- next t_inner 12993.824 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 20/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.23821e+42 erg / s Luminosity absorbed = 3.24957e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Simulation finished in 20 iterations and took 2.23 s (base.py:306)
We place two breakpoints:
break 1. tardis/base:37 --> Stops in the run_tardis() function when the simulation is initialized.
break 2. tardis/simulation/base:436 --> Stops after the Radial1DModel has been built from the config file, but before the plasma has been initialized.
We check the model.t_radiative property INSIDE the assemble_plasma function. Notice that it has len(model.t_radiative) = model.no_of_shells = 5
In [17]:
%%debug
no_init_trad = tardis.run_tardis('config_no_init_trad.yml')
NOTE: Enter 'c' at the ipdb> prompt to continue execution.
None
> <string>(2)<module>()
ipdb> b tardis/base:37
Breakpoint 1 at /Users/marcwilliamson/src/dev/tardis/tardis/base.py:37
ipdb> b tardis/simulation/base:436
Breakpoint 2 at /Users/marcwilliamson/src/dev/tardis/tardis/simulation/base.py:436
ipdb> c
> /Users/marcwilliamson/src/dev/tardis/tardis/base.py(37)run_tardis()
35 tardis_config = Configuration.from_config_dict(config)
36
1--> 37 simulation = Simulation.from_config(tardis_config, atom_data=atom_data)
38 for cb in simulation_callbacks:
39 simulation.add_callback(cb)
ipdb> c
[tardis.model.base ][WARNING] Abundances have not been normalized to 1. - normalizing (base.py:367)
> /Users/marcwilliamson/src/dev/tardis/tardis/simulation/base.py(436)from_config()
434 plasma = kwargs['plasma']
435 else:
2-> 436 plasma = assemble_plasma(config, model,
437 atom_data=kwargs.get('atom_data', None))
438 if 'runner' in kwargs:
ipdb> s
> /Users/marcwilliamson/src/dev/tardis/tardis/simulation/base.py(437)from_config()
435 else:
2 436 plasma = assemble_plasma(config, model,
--> 437 atom_data=kwargs.get('atom_data', None))
438 if 'runner' in kwargs:
439 runner = kwargs['runner']
ipdb> s
--Call--
> /Users/marcwilliamson/src/dev/tardis/tardis/plasma/standard_plasmas.py(33)assemble_plasma()
31
32
---> 33 def assemble_plasma(config, model, atom_data=None):
34 """
35 Create a BasePlasma instance from a Configuration object
ipdb> n
> /Users/marcwilliamson/src/dev/tardis/tardis/plasma/standard_plasmas.py(52)assemble_plasma()
50 """
51 # Convert the nlte species list to a proper format.
---> 52 nlte_species = [species_string_to_tuple(s) for s in
53 config.plasma.nlte.species]
54
ipdb> model.t_radiative
<Quantity [9464.0583115 , 9461.69144847, 9458.53747203, 9455.38559759,
9453.02306994] K>
ipdb> model.no_of_shells
5
ipdb> len(model.t_radiative)==model.no_of_shells
True
ipdb> exit
We place the same two breakpoints as above:
break 1. tardis/base:37 --> Stops in the run_tardis() function when the simulation is initialized.
break 2. tardis/simulation/base:436 --> Stops after the Radial1DModel has been built from the config file, but before the plasma has been initialized.
We check the model.t_radiative property INSIDE the assemble_plasma function. Notice that it has len(model.t_radiative) = 6 which is NOT EQUAL to model.no_of_shells = 5
In [18]:
%%debug
init_trad = tardis.run_tardis('config_init_trad.yml')
NOTE: Enter 'c' at the ipdb> prompt to continue execution.
None
> <string>(2)<module>()
ipdb> b tardis/base:37
Breakpoint 1 at /Users/marcwilliamson/src/dev/tardis/tardis/base.py:37
ipdb> b tardis/simulation/base:436
Breakpoint 2 at /Users/marcwilliamson/src/dev/tardis/tardis/simulation/base.py:436
ipdb> c
> /Users/marcwilliamson/src/dev/tardis/tardis/base.py(37)run_tardis()
35 tardis_config = Configuration.from_config_dict(config)
36
1--> 37 simulation = Simulation.from_config(tardis_config, atom_data=atom_data)
38 for cb in simulation_callbacks:
39 simulation.add_callback(cb)
ipdb> c
[tardis.model.base ][WARNING] Abundances have not been normalized to 1. - normalizing (base.py:367)
> /Users/marcwilliamson/src/dev/tardis/tardis/simulation/base.py(436)from_config()
434 plasma = kwargs['plasma']
435 else:
2-> 436 plasma = assemble_plasma(config, model,
437 atom_data=kwargs.get('atom_data', None))
438 if 'runner' in kwargs:
ipdb> s
> /Users/marcwilliamson/src/dev/tardis/tardis/simulation/base.py(437)from_config()
435 else:
2 436 plasma = assemble_plasma(config, model,
--> 437 atom_data=kwargs.get('atom_data', None))
438 if 'runner' in kwargs:
439 runner = kwargs['runner']
ipdb> s
--Call--
> /Users/marcwilliamson/src/dev/tardis/tardis/plasma/standard_plasmas.py(33)assemble_plasma()
31
32
---> 33 def assemble_plasma(config, model, atom_data=None):
34 """
35 Create a BasePlasma instance from a Configuration object
ipdb> n
> /Users/marcwilliamson/src/dev/tardis/tardis/plasma/standard_plasmas.py(52)assemble_plasma()
50 """
51 # Convert the nlte species list to a proper format.
---> 52 nlte_species = [species_string_to_tuple(s) for s in
53 config.plasma.nlte.species]
54
ipdb> model.t_radiative
<Quantity [11000., 11000., 11000., 11000., 11000., 11000.] K>
ipdb> len(model.t_radiative) == model.no_of_shells
False
ipdb> exit
In the above debugging blocks, we have identified the following discrepancy INSIDE assemble_plasma():
Therefore, we investigate in the following debugging block how model.t_radiative is initialized. We place a breakpoint at tardis/simulation/base:432 and step INSIDE the Radial1DModel initialization.
Breakpoints:
break 1. tardis/simulation/base:432 --> Stops so that we can step INSIDE Radial1DModel initialization from_config().
break 2. tardis/model/base:330 --> Where temperature is handled INSIDE Radial1DModel initialization from_config().
break 3. tardis/model/base:337 --> t_radiative
is initialized. It has the same length as velocity
which is the raw velocities from the density file.
break 4. tardis/model/base:374 --> init() for Radial1DModel is called. We check values of relevant variables.
break 5. tardis/model/base:76 --> Stops at first line of Radial1DModel init() function.
break 6. tardis/model/base:101 --> self._t_radiative is set.
break 7. tardis/model/base:140 --> Stops at first line of self.t_radiative setter.
break 8. tardis/model/base:132 --> Stops at first line of self.t_radiative getter.
break 9. tardis/model/base:108 --> Stop right after self._t_radiative is set. NOTICE that neither the setter nor the getter was called. IMPORTANT: at line 108, we have len(self._t_radiative) = 10. TO DO: Check len(self._t_radiative) at line 108 in the NO initial_t_rad case.
In [21]:
%%debug
init_trad = tardis.run_tardis('config_init_trad.yml')
NOTE: Enter 'c' at the ipdb> prompt to continue execution.
None
> <string>(2)<module>()
ipdb> b tardis/model/base:101
Breakpoint 1 at /Users/marcwilliamson/src/dev/tardis/tardis/model/base.py:101
ipdb> c
[tardis.model.base ][WARNING] Abundances have not been normalized to 1. - normalizing (base.py:367)
> /Users/marcwilliamson/src/dev/tardis/tardis/model/base.py(101)__init__()
99 self.t_inner = t_inner
100
1-> 101 if t_radiative is None:
102 lambda_wien_inner = constants.b_wien / self.t_inner
103 self._t_radiative = constants.b_wien / (lambda_wien_inner * (
ipdb> n
> /Users/marcwilliamson/src/dev/tardis/tardis/model/base.py(106)__init__()
104 1 + (self.v_middle - self.v_boundary_inner) / constants.c))
105 else:
--> 106 self._t_radiative = t_radiative
107
108 if dilution_factor is None:
ipdb> b tardis/model/base:108
Breakpoint 2 at /Users/marcwilliamson/src/dev/tardis/tardis/model/base.py:108
ipdb> b tardis/model/base:140
Breakpoint 3 at /Users/marcwilliamson/src/dev/tardis/tardis/model/base.py:140
ipdb> b tardis/model/base:132
Breakpoint 4 at /Users/marcwilliamson/src/dev/tardis/tardis/model/base.py:132
ipdb> c
> /Users/marcwilliamson/src/dev/tardis/tardis/model/base.py(108)__init__()
106 self._t_radiative = t_radiative
107
2-> 108 if dilution_factor is None:
109 self.dilution_factor = 0.5 * (1 - np.sqrt(
110 1 - (self.r_inner[0] ** 2 / self.r_middle ** 2).to(1).value))
ipdb> self._t_radiative
<Quantity [11000., 11000., 11000., 11000., 11000., 11000., 11000., 11000.,
11000., 11000.] K>
ipdb> exit
In [22]:
%%debug
no_init_trad = tardis.run_tardis('config_no_init_trad.yml')
NOTE: Enter 'c' at the ipdb> prompt to continue execution.
None
> <string>(2)<module>()
ipdb> b tardis/model/base:101
Breakpoint 1 at /Users/marcwilliamson/src/dev/tardis/tardis/model/base.py:101
ipdb> c
[tardis.model.base ][WARNING] Abundances have not been normalized to 1. - normalizing (base.py:367)
> /Users/marcwilliamson/src/dev/tardis/tardis/model/base.py(101)__init__()
99 self.t_inner = t_inner
100
1-> 101 if t_radiative is None:
102 lambda_wien_inner = constants.b_wien / self.t_inner
103 self._t_radiative = constants.b_wien / (lambda_wien_inner * (
ipdb> n
> /Users/marcwilliamson/src/dev/tardis/tardis/model/base.py(102)__init__()
100
1 101 if t_radiative is None:
--> 102 lambda_wien_inner = constants.b_wien / self.t_inner
103 self._t_radiative = constants.b_wien / (lambda_wien_inner * (
104 1 + (self.v_middle - self.v_boundary_inner) / constants.c))
ipdb> n
> /Users/marcwilliamson/src/dev/tardis/tardis/model/base.py(103)__init__()
1 101 if t_radiative is None:
102 lambda_wien_inner = constants.b_wien / self.t_inner
--> 103 self._t_radiative = constants.b_wien / (lambda_wien_inner * (
104 1 + (self.v_middle - self.v_boundary_inner) / constants.c))
105 else:
ipdb> l
98 else:
99 self.t_inner = t_inner
100
1 101 if t_radiative is None:
102 lambda_wien_inner = constants.b_wien / self.t_inner
--> 103 self._t_radiative = constants.b_wien / (lambda_wien_inner * (
104 1 + (self.v_middle - self.v_boundary_inner) / constants.c))
105 else:
106 self._t_radiative = t_radiative
107
108 if dilution_factor is None:
ipdb> b tardis/model/base:108
Breakpoint 2 at /Users/marcwilliamson/src/dev/tardis/tardis/model/base.py:108
ipdb> b tardis/model/base:140
Breakpoint 3 at /Users/marcwilliamson/src/dev/tardis/tardis/model/base.py:140
ipdb> b tardis/model/base:132
Breakpoint 4 at /Users/marcwilliamson/src/dev/tardis/tardis/model/base.py:132
ipdb> c
[py.warnings ][WARNING] /anaconda2/envs/tardis/lib/python3.6/site-packages/astropy/units/quantity.py:1067: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError.
AstropyDeprecationWarning)
(warnings.py:99)
> /Users/marcwilliamson/src/dev/tardis/tardis/model/base.py(108)__init__()
106 self._t_radiative = t_radiative
107
2-> 108 if dilution_factor is None:
109 self.dilution_factor = 0.5 * (1 - np.sqrt(
110 1 - (self.r_inner[0] ** 2 / self.r_middle ** 2).to(1).value))
ipdb> self._t_radiative
<Quantity [9464.0583115 , 9461.69144847, 9458.53747203, 9455.38559759,
9453.02306994] K>
ipdb> exit
We propose the following change to tardis/model/base:106
Line 106 Before Change: self._t_radiative = t_radiative
Line 106 After Change: self._t_radiative = t_radiative[1:1 + self.no_of_shells]
t_radiative[0] corresponds to the temperature within the inner boundary, and so should be ignored.
In [2]:
init_trad = tardis.run_tardis('config_init_trad.yml')
[py.warnings ][WARNING] /anaconda2/envs/tardis/lib/python3.6/importlib/_bootstrap.py:219: QAWarning: pyne.data is not yet QA compliant.
return f(*args, **kwds)
(warnings.py:99)
[py.warnings ][WARNING] /anaconda2/envs/tardis/lib/python3.6/importlib/_bootstrap.py:219: QAWarning: pyne.material is not yet QA compliant.
return f(*args, **kwds)
(warnings.py:99)
[tardis.model.base ][WARNING] Abundances have not been normalized to 1. - normalizing (base.py:367)
[py.warnings ][WARNING] /anaconda2/envs/tardis/lib/python3.6/site-packages/astropy/units/quantity.py:1067: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError.
AstropyDeprecationWarning)
(warnings.py:99)
[tardis.plasma.standard_plasmas][INFO ] Reading Atomic Data from /Users/marcwilliamson/Research/TARDIS/tardis-refdata/atom_data/kurucz_cd23_chianti_H_He.h5 (standard_plasmas.py:74)
[py.warnings ][WARNING] /anaconda2/envs/tardis/lib/python3.6/site-packages/IPython/core/interactiveshell.py:3296: PerformanceWarning: indexing past lexsort depth may impact performance.
exec(code_obj, self.user_global_ns, self.user_ns)
(warnings.py:99)
[tardis.io.atom_data.base][INFO ] Read Atom Data with UUID=6f7b09e887a311e7a06b246e96350010 and MD5=864f1753714343c41f99cb065710cace. (base.py:184)
[tardis.io.atom_data.base][INFO ] Non provided atomic data: synpp_refs, photoionization_data (base.py:187)
[py.warnings ][WARNING] /anaconda2/envs/tardis/lib/python3.6/site-packages/astropy/units/quantity.py:1067: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError.
AstropyDeprecationWarning)
(warnings.py:99)
[py.warnings ][WARNING] /Users/marcwilliamson/src/dev/tardis/tardis/plasma/properties/ion_population.py:63: FutureWarning:
Passing list-likes to .loc or [] with any missing label will raise
KeyError in the future, you can use .reindex() as an alternative.
See the documentation here:
https://pandas.pydata.org/pandas-docs/stable/indexing.html#deprecate-loc-reindex-listlike
partition_function.index].dropna())
(warnings.py:99)
[py.warnings ][WARNING] /anaconda2/envs/tardis/lib/python3.6/site-packages/astropy/units/quantity.py:1067: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError.
AstropyDeprecationWarning)
(warnings.py:99)
[tardis.simulation.base][INFO ] Starting iteration 1/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 6.99873e+41 erg / s Luminosity absorbed = 8.78774e+40 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11000.0 9480.001506 0.439255 0.516372
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 9464.848 K -- next t_inner 12529.122 K (base.py:350)
[py.warnings ][WARNING] /Users/marcwilliamson/src/dev/tardis/tardis/plasma/properties/ion_population.py:63: FutureWarning:
Passing list-likes to .loc or [] with any missing label will raise
KeyError in the future, you can use .reindex() as an alternative.
See the documentation here:
https://pandas.pydata.org/pandas-docs/stable/indexing.html#deprecate-loc-reindex-listlike
partition_function.index].dropna())
(warnings.py:99)
[tardis.simulation.base][INFO ] Starting iteration 2/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.81607e+42 erg / s Luminosity absorbed = 6.48628e+40 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 9480.001506 12575.745392 0.516372 0.460796
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 12529.122 K -- next t_inner 10296.058 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 3/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 9.13387e+41 erg / s Luminosity absorbed = 1.26685e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 12575.745392 10311.711267 0.460796 0.518384
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 10296.058 K -- next t_inner 11930.539 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 4/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.49508e+42 erg / s Luminosity absorbed = 1.38767e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 10311.711267 11931.816104 0.518384 0.501568
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11930.539 K -- next t_inner 10805.487 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 5/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.06943e+42 erg / s Luminosity absorbed = 1.45352e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11931.816104 10806.647371 0.501568 0.521923
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 10805.487 K -- next t_inner 11571.347 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 6/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.33219e+42 erg / s Luminosity absorbed = 1.63948e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 10806.647371 11489.044309 0.521923 0.530125
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11571.347 K -- next t_inner 11102.402 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 7/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.14086e+42 erg / s Luminosity absorbed = 1.63206e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 1/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11489.044309 11163.609414 0.530125 0.515142
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11102.402 K -- next t_inner 11511.109 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 8/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.29957e+42 erg / s Luminosity absorbed = 1.72175e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 2/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11163.609414 11445.235326 0.515142 0.532271
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11511.109 K -- next t_inner 11182.357 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 9/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.18350e+42 erg / s Luminosity absorbed = 1.62089e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 3/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11445.235326 11107.763629 0.532271 0.539148
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11182.357 K -- next t_inner 11383.212 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 10/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.25575e+42 erg / s Luminosity absorbed = 1.74191e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 4/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11107.763629 11352.769902 0.539148 0.529162
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11383.212 K -- next t_inner 11249.393 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 11/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.20017e+42 erg / s Luminosity absorbed = 1.59589e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 5/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11352.769902 11267.543143 0.529162 0.52175
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11249.393 K -- next t_inner 11371.684 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 12/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.24238e+42 erg / s Luminosity absorbed = 1.69634e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 6/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11267.543143 11429.077116 0.52175 0.509304
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11371.684 K -- next t_inner 11298.313 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 13/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.22572e+42 erg / s Luminosity absorbed = 1.70964e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 7/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11429.077116 11267.038005 0.509304 0.531961
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11298.313 K -- next t_inner 11301.467 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 14/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.22675e+42 erg / s Luminosity absorbed = 1.64233e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 8/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11267.038005 11304.057113 0.531961 0.517281
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11301.467 K -- next t_inner 11299.844 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 15/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.22841e+42 erg / s Luminosity absorbed = 1.63765e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 9/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11304.057113 11214.865131 0.517281 0.539284
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11299.844 K -- next t_inner 11290.591 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 16/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.21989e+42 erg / s Luminosity absorbed = 1.68821e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 10/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11214.865131 11251.931472 0.539284 0.531043
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11290.591 K -- next t_inner 11320.702 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 17/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.22643e+42 erg / s Luminosity absorbed = 1.68202e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 11/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11251.931472 11227.712604 0.531043 0.545636
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11320.702 K -- next t_inner 11320.578 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 18/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.22398e+42 erg / s Luminosity absorbed = 1.65226e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 12/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11227.712604 11322.952999 0.545636 0.520921
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11320.578 K -- next t_inner 11331.772 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 19/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.22450e+42 erg / s Luminosity absorbed = 1.74119e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Iteration converged 13/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO ] Plasma stratification:
t_rad next_t_rad w next_w
Shell
0 11322.952999 11343.010318 0.520921 0.523692
(base.py:348)
[tardis.simulation.base][INFO ] t_inner 11331.772 K -- next t_inner 11340.566 K (base.py:350)
[tardis.simulation.base][INFO ] Starting iteration 20/20 (base.py:266)
[tardis.simulation.base][INFO ] Luminosity emitted = 1.23739e+42 erg / s Luminosity absorbed = 1.70270e+41 erg / s Luminosity requested = 1.22640e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO ] Simulation finished in 20 iterations and took 1.57 s (base.py:306)
In [ ]:
In [5]:
import numpy as np
a = np.array([1,2,3,4,5,6,7,8])
In [6]:
a[3:8]
Out[6]:
array([4, 5, 6, 7, 8])
In [7]:
a
Out[7]:
array([1, 2, 3, 4, 5, 6, 7, 8])
In [8]:
2 in a
Out[8]:
True
In [9]:
np.argwhere(a==6)[0][0]
Out[9]:
5
In [12]:
np.searchsorted(a, 6.5)
Out[12]:
6
In [17]:
if (2 in a) and (3.5 in a):
print('hi')
In [15]:
assert 1==1.2, "test"
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-15-43ea828a8ceb> in <module>
----> 1 assert 1==1.2, "test"
AssertionError: test
In [16]:
a[3:6]
Out[16]:
array([4, 5, 6])
In [ ]:
Content source: kaushik94/tardis
Similar notebooks: