aburgasser / splat

SpeX Prism Spectral Analysis Toolkit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

modelParameters is broken, only returns NaNs

daniellabardalezgagliuffi opened this issue · comments

splat util> mass1 = evolve.simulateMasses(10, distribution='Chabrier 2005')
splat util> mass1
array([ 0.03097433, 0.04631799, 0.05468878, 0.01066342, 0.05830868,
0.01677877, 0.01809579, 0.03134611, 0.03827629, 0.02917546])
splat util> q = evolve.simulateMassRatios(10,distribution='allen')
splat util> q
array([ 0.92605962, 0.48453909, 0.79200905, 0.49378052, 0.72979198,
0.91405578, 0.60651029, 0.98523011, 0.52126773, 0.92554017])
splat util> mass2 = mass1*q
splat util> mass2
array([ 0.02868408, 0.02244288, 0.04331401, 0.00526539, 0.04255321,
0.01533673, 0.01097528, 0.03088313, 0.01995219, 0.02700306])
splat util> age = np.array(evolve.simulateAges(10, distribution='cosmic'))
splat util> age
array([ 9.97033749, 8.52509598, 7.56267885, 7.16694192, 4.87713306,
8.27141156, 9.2687293 , 9.31897395, 9.3488177 , 9.9798774 ])
splat util> teff1 = evolve.modelParameters('saumon', m=mass1,a=age)['temperature']
splat util> teff1
<Quantity [ nan, nan, nan, nan, nan, nan, nan, nan, nan, nan] K>
splat util> teff1 = evolve.modelParameters('baraffe', m=mass1,a=age)['temperature']
splat util> teff1
<Quantity [ nan, nan, nan, nan, nan, nan, nan, nan, nan, nan] K>
splat util> teff1 = evolve.modelParameters('burrows', m=mass1,a=age)['temperature']
splat util> teff1
<Quantity [ nan, nan, nan, nan, nan, nan, nan, nan, nan, nan] K>
splat util> age = np.array(evolve.simulateAges(10, distribution='uniform'))
splat util> age
array([ 0.52705064, 5.0334887 , 3.47409727, 1.42386386, 8.44332499,
6.57621539, 6.19829633, 3.79641533, 6.70007801, 8.36891219])
splat util> teff1 = evolve.modelParameters('burrows', m=mass1,a=age)['temperature']
splat util> teff1
<Quantity [ nan, nan, nan, nan, nan, nan, nan, nan, nan, nan] K>
splat util> evolve.modelParameters('burrows',m=0.03,a=5)
{'mass': <Quantity 0.03 solMass>, 'age': <Quantity 5.0 Gyr>, 'temperature': , 'gravity': <Dex nan dex(cm / s2)>, 'luminosity': <Dex nan dex(solLum)>, 'radius': }
splat util> evolve.modelParameters('baraffe',m=0.03,a=5)
{'mass': <Quantity 0.03 solMass>, 'age': <Quantity 5.0 Gyr>, 'temperature': , 'gravity': <Dex nan dex(cm / s2)>, 'luminosity': <Dex nan dex(solLum)>, 'radius': }
splat util> evolve.modelParameters('baraffe03',m=0.03,a=5)
{'mass': <Quantity 0.03 solMass>, 'age': <Quantity 5.0 Gyr>, 'temperature': , 'gravity': <Dex nan dex(cm / s2)>, 'luminosity': <Dex nan dex(solLum)>, 'radius': }
splat util> evolve.modelParameters('saumon',m=0.03,a=5)
{'mass': <Quantity 0.03 solMass>, 'age': <Quantity 5.0 Gyr>, 'temperature': , 'gravity': <Dex nan dex(cm / s2)>, 'luminosity': <Dex nan dex(solLum)>, 'radius': }

This is definitely an out of date version of the code; here's what it should look like:

In [18]: import splat.simulate as spsim
In [19]: import splat.evolve as spev
In [20]: m1 = spsim.simulateMasses(10, distribution='Chabrier 2005')
In [21]: m1
Out[21]:
array([ 0.06040376, 0.04290403, 0.09966214, 0.02340932, 0.077804 ,
0.03029277, 0.07197233, 0.08936979, 0.06259667, 0.09223692])
In [22]: q = spsim.simulateMassRatios(10,distribution='allen')
In [23]: q
Out[23]:
array([ 0.84289472, 0.83026849, 0.96657586, 0.71418055, 0.93657215,
0.93060197, 0.65437705, 0.95443978, 0.99990784, 0.91750397])
In [24]: m2 = m1*q
In [25]: m2
Out[25]:
array([ 0.05091401, 0.03562187, 0.09633102, 0.01671848, 0.07286906,
0.02819051, 0.04709704, 0.08529808, 0.0625909 , 0.08462774])
In [26]: ages = spsim.simulateAges(10, distribution='cosmic')
In [27]: ages
Out[27]:
<Quantity [ 8.60140432, 7.86623119, 4.85238808, 9.16446594, 7.47263374,
9.43158841, 8.20160281, 2.22661662, 9.02666091, 4.04260635] Gyr>
In [28]: teff1 = spev.modelParameters('saumon', m=m1,a=ages)['temperature']
In [29]: teff1
Out[29]:
<Quantity [ 917.83894764, 686.21533107, nan, 426.52786618,
2120.91021809, 502.94156612, 1587.12568947, nan,
957.25963674, nan] K>
In [30]: teff2 = spev.modelParameters('saumon', m=m2,a=ages)['temperature']
In [31]: teff2
Out[31]:
<Quantity [ 767.10000743, 593.86867161, nan, 344.60631084,
1700.13418442, 479.35546773, 728.38386189, nan,
957.11812151, 2429.33122116] K>

I do now notice the difference between the output formats of these simulated vectors which is worth investigating.