Moving environment to RS (#70)

* Drag several fields at once

* add env in RSP

* Add docstrings

* Make __main__

* Fix bug

* Fix plotting little bug
This commit is contained in:
Richard Stiskalek 2023-06-18 11:42:21 +01:00 committed by GitHub
parent 35ccfb5c67
commit 27e1c181a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 96 additions and 56 deletions

View file

@ -322,15 +322,24 @@ def plot_projected_field(kind, nsim, grid, in_rsp, smooth_scale, MAS="PCS",
ax[i].imshow(img, vmin=vmin, vmax=vmax, cmap=cmap)
frad = 155.5 / 677.7
if not highres_only and 0.5 - frad < slice_find < 0.5 + frad:
theta = numpy.linspace(0, 2 * numpy.pi, 100)
R = 155.5 / 677.7 * grid
if slice_find is None:
rad = R
plot_circle = True
elif (not highres_only and 0.5 - frad < slice_find < 0.5 + frad):
z = (slice_find - 0.5) * grid
R = 155.5 / 677.7 * grid
rad = R * numpy.sqrt(1 - z**2 / R**2)
plot_circle = True
else:
plot_circle = False
if not highres_only and plot_circle:
theta = numpy.linspace(0, 2 * numpy.pi, 100)
ax[i].plot(rad * numpy.cos(theta) + grid // 2,
rad * numpy.sin(theta) + grid // 2,
lw=0.75 * plt.rcParams["lines.linewidth"], zorder=1,
c="red", ls="--")
ax[i].set_title(labels[i])
if highres_only:
@ -551,7 +560,7 @@ if __name__ == "__main__":
plot_halos=5e13, volume_weight=False)
if True:
kind = "environment"
kind = "density"
grid = 256
smooth_scale = 0
# plot_projected_field("overdensity", 7444, grid, in_rsp=True,

View file

@ -41,6 +41,10 @@ def plot_knn(runname):
Parameters
----------
runname : str
Returns
-------
None
"""
print(f"Plotting kNN CDF for {runname}.")
cols = plt.rcParams["axes.prop_cycle"].by_key()["color"]