@@ -2082,22 +2082,20 @@ def plotKip3(self,m,plot_type='history',xaxis='model_number',yaxis='mass',zaxis=
2082
2082
else :
2083
2083
center = self ._getSafeCenter (m ,radius )
2084
2084
data_y = np .linspace (np .min (center ),np .max (m .hist .data ["star_mass" ]),num_zones )
2085
+
2086
+ #May need to interpolate data:
2087
+ lin_x = np .linspace (data_x [modInd ][0 ],data_x [modInd ][- 1 ],np .count_nonzero (data_x [modInd ]))
2085
2088
2086
2089
#Get burn data
2087
2090
if show_burn :
2088
2091
data_z = self ._getHistBurnData (m ,data_x ,data_y ,modInd ,burn_prefix ,radius )
2092
+ data_z = self ._rebinKipDataX (data_z ,data_x [modInd ],lin_x )
2089
2093
2090
2094
#Get mix data
2091
2095
if show_mix :
2092
- mix_data = self ._getHistMixData (m ,data_x ,data_y ,modInd ,mix ,mix_prefix ,radius )
2093
-
2094
- #May need to interpolate data:
2095
- lin_x = np .linspace (data_x [modInd ][0 ],data_x [modInd ][- 1 ],np .count_nonzero (data_x [modInd ]))
2096
-
2097
- data_z = self ._rebinKipDataX (data_z ,data_x [modInd ],lin_x )
2098
- if show_mix :
2096
+ mix_data = self ._getHistMixData (m ,data_x ,data_y ,modInd ,mix ,mix_prefix ,radius )
2099
2097
mix_data = self ._rebinKipDataX (mix_data ,data_x [modInd ],lin_x ,nan = True ,nan_value = 1 )
2100
-
2098
+
2101
2099
else :
2102
2100
show_mix = False
2103
2101
show_burn = False
@@ -2122,6 +2120,9 @@ def plotKip3(self,m,plot_type='history',xaxis='model_number',yaxis='mass',zaxis=
2122
2120
count = count + 1
2123
2121
2124
2122
data_x = np .array (data_x )
2123
+
2124
+
2125
+
2125
2126
if num_zones is None :
2126
2127
num_zones = np .max (zones ) * 1.0 / zone_frac
2127
2128
data_z ,lin_x ,data_y = self ._rebinKipDataXY (data_z ,data_x ,data_y ,count ,num_zones )
@@ -2224,6 +2225,7 @@ def plotKip3(self,m,plot_type='history',xaxis='model_number',yaxis='mass',zaxis=
2224
2225
ax2 .plot (lin_x ,f (lin_x ),c = 'k' )
2225
2226
if y2rng is not None :
2226
2227
ax2 .set_ylim (y2rng )
2228
+
2227
2229
2228
2230
if xlabel is None :
2229
2231
if xaxis == 'model_number' :
@@ -2359,14 +2361,13 @@ def _rebinKipqDataWithModInd(self,m,qtype,z,y,modInd,radius):
2359
2361
2360
2362
def _getSafeAge (self ,m ,age_lookback = False ,age_zero = None ,age_units = 'sec' ,age_log = False ,age_reverse = False ,end_time = None ):
2361
2363
2362
- if 'star_age_sec' in m .hist .data .dtype .names :
2364
+ if 'log_dt' in m .hist .data .dtype .names :
2365
+ #Age in years does not have enough digits to be able to distingush the final models in pre-sn progenitors
2366
+ age = np .cumsum (10 ** np .longdouble (m .hist .log_dt ))* self .secyear
2367
+ elif 'star_age_sec' in m .hist .data .dtype .names :
2363
2368
age = m .hist .star_age_sec
2364
2369
elif 'star_age' in m .hist .data .dtype .names :
2365
- if age_lookback :
2366
- #Age in years does not have enough digits to be able to distingush the final models in pre-sn progenitors
2367
- age = np .cumsum (10 ** np .longdouble (m .hist .log_dt ))* self .secyear
2368
- else :
2369
- age = m .hist .star_age * self .secyear
2370
+ age = m .hist .star_age * self .secyear
2370
2371
2371
2372
if age_lookback :
2372
2373
xx = age [- 1 ]
@@ -2461,6 +2462,7 @@ def _getModInd(self,m,mod_index=None,mod_min=None,mod_max=None,step=1,xaxis='',x
2461
2462
def _rebinKipDataX (self ,data ,x ,lin_x ,nan = False ,nan_value = 1 ):
2462
2463
sorter = np .argsort (x )
2463
2464
ind = np .searchsorted (x ,lin_x ,sorter = sorter ,side = 'left' )
2465
+
2464
2466
data = data [sorter [ind ],:]
2465
2467
if nan :
2466
2468
data [data < nan_value ]= np .nan
0 commit comments