Skip to content

Commit

Permalink
Adding plot and constant changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aisclark91 committed Feb 21, 2024
1 parent 1031f8f commit f18549a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions pynucastro/networks/rate_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1782,7 +1782,7 @@ def _scale(arr, minval=None, maxval=None):
scaled[scaled > 1.0] = 1.0
return scaled

def gridplot(self, comp=None, color_field="X", rho=None, T=None, **kwargs):
def gridplot(self, comp=None, color_field="X", rho=None, T=None, minN=None, maxN=None, minZ=None, maxZ=None, **kwargs):
"""
Plot nuclides as cells on a grid of Z vs. N, colored by *color_field*. If called
without a composition, the function will just plot the grid with no color field.
Expand Down Expand Up @@ -1907,9 +1907,12 @@ def gridplot(self, comp=None, color_field="X", rho=None, T=None, **kwargs):
facecolor=cmap(weight), edgecolor=edgecolor)
ax.add_patch(square)

# Set limits
maxN, minN = max(Ns), min(Ns)
maxZ, minZ = max(Zs), min(Zs)
# Set limits:

#If the limits are setup by the user
if not minN and not maxN:
maxN, minN = max(Ns), min(Ns)
maxZ, minZ = max(Zs), min(Zs)

plt.xlim(minN - 0.5, maxN + 0.6)
plt.ylim(minZ - 0.5, maxZ + 0.6)
Expand Down
2 changes: 1 addition & 1 deletion pynucastro/reduction/generate_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def dataset(network, n=10, permute=True, b_rho=None, b_T=None, b_Z=None):

# Bounds on each variable
if b_rho is None:
b_rho = (1e2, 1e6) # density (g/cm^3)
b_rho = (1e2, 1e4) # density (g/cm^3)
if b_T is None:
b_T = (8e6, 1.5e9) # temperature (K)
if b_Z is None:
Expand Down

0 comments on commit f18549a

Please sign in to comment.