Skip to content
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

Adding changes in gridplot() #723

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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