-
-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TEP007] Isotope stratified file support #764
Changes from all commits
518ae3b
a0db95c
bcd7861
5ec16dc
30d5cfd
23b4001
c565565
f36e1b5
58d7a20
34a2b0a
fe0283d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Licensed under a 3-clause BSD style license - see LICENSE.rst | ||
|
||
def get_package_data(): | ||
return {'tardis.io.tests':['data/*.dat', 'data/*.yml']} | ||
return {'tardis.io.tests': ['data/*.dat', 'data/*.yml', 'data/*.csv']} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
tardis_config_version: v1.0 | ||
|
||
supernova: | ||
luminosity_requested: 2.8e9 solLum | ||
time_explosion: 13 day | ||
|
||
atom_data: kurucz_atom_pure_simple.h5 | ||
model: | ||
|
||
structure: | ||
type: specific | ||
|
||
velocity: | ||
start: 1.1e4 km/s | ||
stop: 2.0e4 km/s | ||
num: 20 | ||
|
||
density: | ||
type: branch85_w7 | ||
|
||
abundances: | ||
type: uniform | ||
O: 0.19 | ||
Mg: 0.03 | ||
Si: 0.42 | ||
S: 0.19 | ||
Ar: 0.04 | ||
Ca: 0.03 | ||
Ni56: 0.05 | ||
Ni58: 0.05 | ||
|
||
|
||
plasma: | ||
ionization: lte | ||
excitation: lte | ||
radiative_rates_type: dilute-blackbody | ||
line_interaction_type: macroatom | ||
|
||
montecarlo: | ||
seed: 23111963 | ||
no_of_packets : 2.0e+5 | ||
iterations: 5 | ||
last_no_of_packets: 5.0e+5 | ||
no_of_virtual_packets: 5 | ||
|
||
spectrum: | ||
start: 500 angstrom | ||
stop: 20000 angstrom | ||
num: 10000 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
C O Mg Si Ni56 Ni58 | ||
0 0 0 0.6 0.4 0 | ||
0 0 0 0.1 0.5 0.4 | ||
0 0 0 0.3 0 0.7 | ||
0 0.2 0.8 0 0 0 | ||
0 0.3 0.7 0 0 0 | ||
0 0.2 0.8 0 0 0 | ||
0 0.2 0.8 0 0 0 | ||
0 0.2 0.8 0 0 0 | ||
0.5 0.5 0 0 0 0 | ||
0.5 0.5 0 0 0 0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
# Utilities for TARDIS | ||
|
||
from astropy import units as u, constants | ||
from pyne import nucname | ||
import numexpr as ne | ||
import numpy as np | ||
import pandas as pd | ||
import os | ||
import yaml | ||
import re | ||
|
@@ -428,4 +430,14 @@ def quantity_linspace(start, stop, num, **kwargs): | |
raise ValueError('Both start and stop need to be quantities with a ' | ||
'unit attribute') | ||
|
||
return np.linspace(start.value, stop.to(start.unit).value, num, **kwargs) * start.unit | ||
return np.linspace(start.value, stop.to(start.unit).value, num, **kwargs) * start.unit | ||
|
||
|
||
def convert_abundances_format(fname, delimiter='\s+'): | ||
df = pd.read_csv(fname, delimiter=delimiter, comment='#', header=None) | ||
#Drop shell index column | ||
df.drop(df.columns[0], axis=1, inplace=True) | ||
#Assign header row | ||
df.columns = [nucname.name(i) | ||
for i in range(1, df.shape[1] + 1)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nucname.name(i) will throw an error, if somebody a wrong specifies an element or isotope identifier, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it will throw a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Excellent |
||
return df |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we improve here? Something like
such that we don't need the if clause?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If,
read_simple_ascii_abundances
function returns an extraNone
(instead of(index,abundance)
, returningindex,abundance,None
)) , then we can remove this. But I don`t think , its a good idea.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, fine with me