Skip to content

Commit

Permalink
updating readin of data from notebooks + colorbars
Browse files Browse the repository at this point in the history
  • Loading branch information
MatsEsseldeurs committed Oct 22, 2024
1 parent 624bfbd commit eb90797
Show file tree
Hide file tree
Showing 10 changed files with 256 additions and 88 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
userSettings.txt

Model

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
72 changes: 60 additions & 12 deletions docs/src/1_examples/0_creating_sliceFigures/0_SliceLine.ipynb

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
"ax[0].set_aspect('equal')\n",
"ax[0].set_facecolor('k')\n",
"\n",
"ax[0].pcolormesh(X/cgs.au, Y/cgs.au, np.log10(smooth_rot[\"rho\"]+1e-99), cmap=plt.cm.get_cmap('inferno'), vmin=-17, vmax = -14)\n",
"ax[0].pcolormesh(X/cgs.au, Y/cgs.au, np.log10(smooth_rot[\"rho\"]+1e-99), cmap=plt.colormaps['inferno'], vmin=-17, vmax = -14)\n",
"ax[0].set_xlim(x[0]/cgs.au, x[-1]/cgs.au)\n",
"ax[0].set_ylim(y[0]/cgs.au, y[-1]/cgs.au)\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
"Z = np.zeros_like(X)\n",
"smooth_rot = sk.smoothMesh(X, Y, Z, dumpData, ['rho'])\n",
"\n",
"mesh = ax.pcolormesh(X/cgs.au, Y/cgs.au, np.log10(smooth_rot[\"rho\"]+1e-99), cmap=plt.cm.get_cmap('inferno'), vmin=-17, vmax = -14)\n",
"mesh = ax.pcolormesh(X/cgs.au, Y/cgs.au, np.log10(smooth_rot[\"rho\"]+1e-99), cmap=plt.colormaps['inferno'], vmin=-17, vmax = -14)\n",
"ax.set_xlim(x[0]/cgs.au, x[-1]/cgs.au)\n",
"ax.set_ylim(y[0]/cgs.au, y[-1]/cgs.au)\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def makeMovie(prefix, loc, outputloc, model, firstframe,lastframe):
smooth_rot = sk.smoothMesh(X_rot, Y_rot, Z_rot, dumpData, ['rho'])

#Filmpjes Mats: inferno; -17 -- -12
# mesh = ax.pcolormesh(X/cgs.au, Y/cgs.au, np.log10(smooth_rot["rho"]+1e-99), cmap=plt.cm.get_cmap('gist_heat'), vmin=-19, vmax = -14)
mesh = ax.pcolormesh(X/cgs.au, Y/cgs.au, np.log10(smooth_rot["rho"]+1e-99), cmap=plt.cm.get_cmap('gist_heat'), vmin=-18, vmax = -11.5)
# mesh = ax.pcolormesh(X/cgs.au, Y/cgs.au, np.log10(smooth_rot["rho"]+1e-99), cmap=plt.colormaps['gist_heat'], vmin=-19, vmax = -14)
mesh = ax.pcolormesh(X/cgs.au, Y/cgs.au, np.log10(smooth_rot["rho"]+1e-99), cmap=plt.colormaps['gist_heat'], vmin=-18, vmax = -11.5)
ax.set_xlim(x[0]/cgs.au, x[-1]/cgs.au)
ax.set_ylim(y[0]/cgs.au, y[-1]/cgs.au)
ax.set_xlabel('x [au]')
Expand Down
14 changes: 7 additions & 7 deletions src/plons/AccrDisk.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def plot_vrvtRho(axs, smooth,zoom,r=0,limitsRho=False):
limits = [-17,-11]
else:
limits = limitsRho
cm = plt.cm.get_cmap('gist_heat')
cm = plt.colormaps['gist_heat']

ax1.set_xlabel('x [au]',fontsize = 20)
ax1.set_ylabel('y [au]',fontsize = 20)
Expand All @@ -155,7 +155,7 @@ def plot_vrvtRho(axs, smooth,zoom,r=0,limitsRho=False):
limits = [-40,40]
# lim = np.abs(np.min(data))
# limits = [-lim,lim]
cm = plt.cm.get_cmap('seismic')
cm = plt.colormaps['seismic']
ax2.set_xlabel('x [au]',fontsize = 20)
ax2.set_aspect('equal')
ax2.set_facecolor('k')
Expand All @@ -172,7 +172,7 @@ def plot_vrvtRho(axs, smooth,zoom,r=0,limitsRho=False):
# vt
data = (smooth['smooth_z']['new_vt'])
limits = [0,200]
cm = plt.cm.get_cmap('nipy_spectral')
cm = plt.colormaps['nipy_spectral']

ax3.set_xlabel('x [au]',fontsize = 20)
ax3.set_aspect('equal')
Expand Down Expand Up @@ -206,7 +206,7 @@ def plot_vrvt(axs,smooth,zoom,r):
limits = [-40,40]
# lim = np.abs(np.min(data))
# limits = [-lim,lim]
cm = plt.cm.get_cmap('seismic')
cm = plt.colormaps['seismic']
ax2.set_xlabel('x [au]',fontsize = 20)
ax2.set_ylabel('y [au]',fontsize = 20)
ax2.set_aspect('equal')
Expand All @@ -224,7 +224,7 @@ def plot_vrvt(axs,smooth,zoom,r):
# vt
data = (smooth['smooth_z']['new_vt'])
limits = [0,200]
cm = plt.cm.get_cmap('nipy_spectral')
cm = plt.colormaps['nipy_spectral']

ax3.set_xlabel('x [au]',fontsize = 20)
ax3.set_aspect('equal')
Expand Down Expand Up @@ -256,7 +256,7 @@ def plot_vrRho(axs,smooth,zoom,r):
limits = [-40,40]
# lim = np.abs(np.min(data))
# limits = [-lim,lim]
cm = plt.cm.get_cmap('seismic')
cm = plt.colormaps['seismic']
ax2.set_xlabel('x [au]',fontsize = 20)
ax2.set_ylabel('y [au]',fontsize = 20)
ax2.set_aspect('equal')
Expand All @@ -279,7 +279,7 @@ def plot_vrRho(axs,smooth,zoom,r):
else:
# limits = [-17,-11]
limits = [-16,-11]
cm = plt.cm.get_cmap('gist_heat')
cm = plt.colormaps['gist_heat']

ax3.set_xlabel('x [au]',fontsize = 20)
ax3.set_aspect('equal')
Expand Down
8 changes: 4 additions & 4 deletions src/plons/Plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def plotSlice(ax: plt.Axes,
smooth: Dict[str, npt.NDArray[np.single]],
observable: str,
logplot: bool = False,
cmap: matplotlib.colors.Colormap = plt.cm.get_cmap('inferno'),
cmap: matplotlib.colors.Colormap = plt.colormaps['inferno'],
clim: Tuple[Optional[float], Optional[float]] = (None, None)) -> matplotlib.colorbar.Colorbar:
"""Plot a property given a grid and smoothed data ontop of the grid
Expand All @@ -26,7 +26,7 @@ def plotSlice(ax: plt.Axes,
smooth (Dict[str, npt.NDArray[np.single]]): Dictionary pointing at smoothed values in meshgrid which you want to plot
observable (str): Name of the observable you want to plot, corresponding to the name in the smooth directory
logplot (bool, optional): plot in log scale?. Defaults to False.
cmap (matplotlib.colors.Colormap, optional): Colormap to use. Defaults to cm.get_cmap('inferno').
cmap (matplotlib.colors.Colormap, optional): Colormap to use. Defaults to plt.colormaps['inferno'].
clim (Tuple[Optional[float], Optional[float]], optional): limits for the colorbar. Defaults to (None, None).
Returns:
Expand Down Expand Up @@ -90,7 +90,7 @@ def SlicePlot2D(ax: plt.Axes,
rotate: bool = False,
observable: str = "rho",
logplot: bool = True,
cmap: matplotlib.colors.Colormap = plt.cm.get_cmap('inferno'),
cmap: matplotlib.colors.Colormap = plt.colormaps['inferno'],
clim: tuple[float, float] = (-17, -14)) -> matplotlib.colorbar.Colorbar:
"""Plot a property given xlims and ylims
Expand All @@ -104,7 +104,7 @@ def SlicePlot2D(ax: plt.Axes,
rotate (bool, optional): should the binary be rotated to lay on the x-axis. Defaults to False.
observable (str, optional): property to plot. Defaults to "rho".
logplot (bool, optional): plot in log scale?. Defaults to True.
cmap (matplotlib.colors.Colormap, optional): colormap to use. Defaults to plt.cm.get_cmap('inferno').
cmap (matplotlib.colors.Colormap, optional): colormap to use. Defaults to plt.colormaps['inferno'].
clim (tuple[float, float], optional): limits of the colormap. Defaults to (-17, -14).
Returns:
Expand Down
20 changes: 10 additions & 10 deletions src/plons/SlicePlots2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@


# colormap per parameter
cm = {'rho': plt.cm.get_cmap('inferno'),
'speed': plt.cm.get_cmap('CMRmap'),
#'Tgas': plt.cm.get_cmap('RdYlGn'),
'Tgas': plt.cm.get_cmap('hot'), #nipy_spectral
'tau': plt.cm.get_cmap('viridis_r'),
'tauL': plt.cm.get_cmap('viridis'),
'kappa': plt.cm.get_cmap('Spectral_r'),
'Tdust': plt.cm.get_cmap('Spectral_r'),
'Gamma': plt.cm.get_cmap('Spectral_r')
cm = {'rho': plt.colormaps['inferno'],
'speed': plt.colormaps['CMRmap'],
#'Tgas': plt.colormaps['RdYlGn'],
'Tgas': plt.colormaps['hot'], #nipy_spectral
'tau': plt.colormaps['viridis_r'],
'tauL': plt.colormaps['viridis'],
'kappa': plt.colormaps['Spectral_r'],
'Tdust': plt.colormaps['Spectral_r'],
'Gamma': plt.colormaps['Spectral_r']
}

# label name per parameter
Expand Down Expand Up @@ -105,7 +105,7 @@ def smoothData(dumpData, setup, observables, theta = 0., zoom = 1, nneighb = 10,
- setup setup data
- rAccComp accretion radius of the companion
'''
def densityPlot(smooth, zoom, limits, dumpData, setup, orbital=True, cmap=plt.cm.get_cmap('inferno')):
def densityPlot(smooth, zoom, limits, dumpData, setup, orbital=True, cmap=plt.colormaps['inferno']):

fig, ax = plt.subplots(1, figsize=(7, 7))

Expand Down

0 comments on commit eb90797

Please sign in to comment.