Skip to content

Commit

Permalink
Updating tutorials.
Browse files Browse the repository at this point in the history
  • Loading branch information
vitenti committed Jul 10, 2024
1 parent ff4815d commit 8c5d193
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
9 changes: 4 additions & 5 deletions tutorial/inferred_zdist.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ lens0 = InferredGalaxyZDist(
bin_name="lens0",
z=z,
dndz=np.exp(-0.5 * ((z - 0.5) / 0.02) ** 2) / np.sqrt(2 * np.pi) / 0.02,
measurement=Galaxies.COUNTS,
measurements={Galaxies.COUNTS},
)
```
Expand All @@ -54,15 +54,14 @@ from firecrown.generators.two_point import LogLinearElls
lens0_lens0 = TwoPointXY(
x=lens0,
y=lens0,
x_measurement=Galaxies.COUNTS,
y_measurement=Galaxies.COUNTS,
)
# Note that we are leaving out the monopole (l=0) and dipole (l=1)
# terms. Firecrown allows their inclusion, if you so desire.
ells_generator = LogLinearElls(minimum=2, midpoint=20, maximum=200, n_log=20)
lens0_lens0_cell = TwoPointCells(
XY=lens0_lens0,
ells=ells_generator.generate()
)
lens0_lens0_cell = TwoPointCells(XY=lens0_lens0, ells=ells_generator.generate())
```

The `TwoPointCells` is created by providing the `TwoPointXY` object and the ells array.
Expand Down
14 changes: 7 additions & 7 deletions tutorial/inferred_zdist_generators.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -131,31 +131,31 @@ Pz_lens0_y1 = zdist_y1.binned_distribution(
sigma_z=Y1_LENS_BINS["sigma_z"],
z=z,
name="lens0_y1",
measurement=Galaxies.COUNTS,
measurements={Galaxies.COUNTS},
)
Pz_source0_y1 = zdist_y1.binned_distribution(
zpl=Y1_SOURCE_BINS["edges"][0],
zpu=Y1_SOURCE_BINS["edges"][1],
sigma_z=Y1_SOURCE_BINS["sigma_z"],
z=z,
name="source0_y1",
measurement=Galaxies.SHEAR_E,
measurements={Galaxies.SHEAR_E},
)
Pz_lens0_y10 = zdist_y10.binned_distribution(
zpl=Y10_LENS_BINS["edges"][0],
zpu=Y10_LENS_BINS["edges"][1],
sigma_z=Y10_LENS_BINS["sigma_z"],
z=z,
name="lens0_y10",
measurement=Galaxies.COUNTS,
measurements={Galaxies.COUNTS},
)
Pz_source0_y10 = zdist_y10.binned_distribution(
zpl=Y10_SOURCE_BINS["edges"][0],
zpu=Y10_SOURCE_BINS["edges"][1],
sigma_z=Y10_SOURCE_BINS["sigma_z"],
z=z,
name="source0_y10",
measurement=Galaxies.SHEAR_E,
measurements={Galaxies.SHEAR_E},
)
# Next we check that the objects we created are of the expected type.
Expand Down Expand Up @@ -240,7 +240,7 @@ all_y1_bins = [
sigma_z=Y1_LENS_BINS["sigma_z"],
z=z,
name=f"lens_{zpl:.1f}_{zpu:.1f}_y1",
measurement=Galaxies.COUNTS,
measurements={Galaxies.COUNTS},
use_autoknot=True,
autoknots_reltol=1.0e-5,
)
Expand All @@ -252,7 +252,7 @@ all_y1_bins = [
sigma_z=Y1_SOURCE_BINS["sigma_z"],
z=z,
name=f"source_{zpl:.1f}_{zpu:.1f}_y1",
measurement=Galaxies.SHEAR_E,
measurements={Galaxies.SHEAR_E},
use_autoknot=True,
autoknots_reltol=1.0e-5,
)
Expand All @@ -276,7 +276,7 @@ d_y1 = pd.concat(
"z": Pz.z,
"dndz": Pz.dndz,
"bin": Pz.bin_name,
"measurement": Pz.measurement,
"measurement": list(Pz.measurements)[0],
"legend": f"{Pz.bin_name}, {len(Pz.z)}",
}
)
Expand Down
4 changes: 2 additions & 2 deletions tutorial/inferred_zdist_serialization.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ bin0 = ZDistLSSTSRDBin(
sigma_z=0.03,
z=z,
bin_name="bin0",
measurement=Galaxies.COUNTS,
measurements={Galaxies.COUNTS},
)
bin0_yaml = base_model_to_yaml(bin0)
Expand Down Expand Up @@ -112,7 +112,7 @@ assert bin_collection.bins[0].zpl == bin_collection_read.bins[0].zpl
assert bin_collection.bins[0].zpu == bin_collection_read.bins[0].zpu
assert bin_collection.bins[0].sigma_z == bin_collection_read.bins[0].sigma_z
assert bin_collection.bins[0].bin_name == bin_collection_read.bins[0].bin_name
assert bin_collection.bins[0].measurement == bin_collection_read.bins[0].measurement
assert bin_collection.bins[0].measurements == bin_collection_read.bins[0].measurements
assert bin_collection.bins[0].z == bin_collection_read.bins[0].z
```

Expand Down

0 comments on commit 8c5d193

Please sign in to comment.