Skip to content

Commit 01989a4

Browse files
debugging prints
1 parent eac2abf commit 01989a4

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

xga/products/profile.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2544,11 +2544,14 @@ def entropy(self, radius: Quantity, conf_level: float = 68.2) -> Union[Quantity,
25442544
else:
25452545
already_run = False
25462546

2547+
print('already_run')
2548+
print(already_run)
25472549
# Here, if we haven't already identified a previously calculated entropy for the radius, we start to
25482550
# prepare the data we need (i.e. temperature and density). This is complicated slightly by the different
25492551
# ways of calculating entropy we support (using smooth models, using data points, using interpolated data
25502552
# points). First of all we deal with the case of there being a density model to draw from
25512553
if not already_run and self.density_model is not None:
2554+
print("dens in this one")
25522555
# If the density model fit didn't work then we give up and throw an error
25532556
if not self.density_model.success:
25542557
raise XGAFitError("The density model fit was not successful, as such we cannot calculate entropy "
@@ -2561,9 +2564,11 @@ def entropy(self, radius: Quantity, conf_level: float = 68.2) -> Union[Quantity,
25612564
# temperature and density profiles are identical, and so we just get some realisations
25622565
elif (not already_run and (len(self.density_profile) == len(self.temperature_profile)) and
25632566
(self.density_profile.radii == self.temperature_profile.radii).all()):
2567+
print("dens in this one here")
25642568
dens = self.density_profile.generate_data_realisations(self._num_samples).T
25652569

25662570
elif not already_run and self._interp_data:
2571+
print("dens in this one here right here")
25672572
# This uses the density profile y-axis values (and their uncertainties) to draw N realisations of the
25682573
# data points - we'll use this to create N realisations of the interpolations as well
25692574
dens_data_real = self.density_profile.generate_data_realisations(self._num_samples)
@@ -2574,15 +2579,20 @@ def entropy(self, radius: Quantity, conf_level: float = 68.2) -> Union[Quantity,
25742579
# We make sure to turn on extrapolation, and make sure this is no out-of-bounds error issued
25752580
dens_interp = interp1d(self.density_profile.radii, dens_data_real, axis=1, assume_sorted=True,
25762581
fill_value='extrapolate', bounds_error=False)
2582+
2583+
print('len dens interp')
2584+
print(len(dens_interp))
25772585
# Restore the interpolated density profile realisations to an astropy quantity array
25782586
dens = Quantity(dens_interp(self.radii).T, self.density_profile.values_unit)
25792587

25802588
# This particular combination means that we are doing a data-point based profile, but without interpolation,
25812589
# and that the density profile has more bins than the temperature (going to be true in most cases). So we
25822590
# just read out the density data points (and make N realisations of them) with no funny business required
25832591
elif not already_run and not self._interp_data and len(self.density_profile) == len(self.radii):
2592+
print('dens in this special one')
25842593
dens = self.density_profile.generate_data_realisations(self._num_samples).T
25852594
else:
2595+
print('dens in this oh so special one')
25862596
d_bnds = np.vstack([self.density_profile.annulus_bounds[0:-1],
25872597
self.density_profile.annulus_bounds[1:]]).T
25882598

@@ -2599,6 +2609,7 @@ def entropy(self, radius: Quantity, conf_level: float = 68.2) -> Union[Quantity,
25992609
# values that we are going to use in our entropy measurements; from models, data points, or interpolating
26002610
# from data points
26012611
if not already_run and self.temperature_model is not None:
2612+
print("temp in this one")
26022613
if not self.temperature_model.success:
26032614
raise XGAFitError("The temperature model fit was not successful, as such we cannot calculate entropy "
26042615
"using a smooth temperature model.")
@@ -2610,25 +2621,32 @@ def entropy(self, radius: Quantity, conf_level: float = 68.2) -> Union[Quantity,
26102621
# temperature and density profiles are identical, and so we just get some realisations
26112622
elif (not already_run and (len(self.density_profile) == len(self.temperature_profile)) and
26122623
(self.density_profile.radii == self.temperature_profile.radii).all()):
2624+
print("temp in this one here")
26132625
temp = self.temperature_profile.generate_data_realisations(self._num_samples).T
26142626

26152627
elif not already_run and self._interp_data:
2628+
print("temp in this one here right here")
26162629
# This uses the temperature profile y-axis values (and their uncertainties) to draw N realisations of the
26172630
# data points - we'll use this to create N realisations of the interpolations as well
26182631
temp_data_real = self.temperature_profile.generate_data_realisations(self._num_samples)
26192632
temp_interp = interp1d(self.temperature_profile.radii, temp_data_real, axis=1, assume_sorted=True,
26202633
fill_value='extrapolate', bounds_error=False)
2634+
2635+
print('len temp interp')
2636+
print(len(temp_interp))
26212637
temp = Quantity(temp_interp(self.radii).T, self.temperature_profile.values_unit)
26222638

26232639
# This particular combination means that we are doing a data-point based profile, but without interpolation,
26242640
# and that the temperature profile has more bins than the density (not going to happen often)
26252641
elif not already_run and not self._interp_data and len(self.temperature_profile) == len(self.radii):
2642+
print('dens in this special one')
26262643
temp = self.temperature_profile.generate_data_realisations(self._num_samples).T
26272644
# And here, the final option, we're doing a data-point based profile without interpolation, and we need
26282645
# to make sure that the density values (here N_denspoints > N_temppoints) each have a corresponding
26292646
# temperature value - in practise this means that each density will be paired with the temperature
26302647
# realisations whose radial coverage they fall within.
26312648
else:
2649+
print('dens in this oh so special one')
26322650
t_bnds = np.vstack([self.temperature_profile.annulus_bounds[0:-1],
26332651
self.temperature_profile.annulus_bounds[1:]]).T
26342652

0 commit comments

Comments
 (0)