Skip to content

Commit

Permalink
Updating to use latest version of optika.rulings.
Browse files Browse the repository at this point in the history
  • Loading branch information
byrdie committed Mar 25, 2024
1 parent 38566a7 commit 9bbf8cb
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
17 changes: 2 additions & 15 deletions esis/flights/f1/optics/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,21 +161,8 @@ def design_full(
),
),
material=optika.materials.Mirror(),
rulings=optika.rulings.PolynomialSpacingRulings(
coefficients={
0: 1 / density_grating_rulings,
1: na.UniformUncertainScalarArray(
nominal=-3.3849e-5 * (u.um / u.mm),
width=0.0512e-5 * (u.um / u.mm),
num_distribution=num_distribution,
),
2: na.UniformUncertainScalarArray(
nominal=-1.3625e-7 * (u.um / u.mm**2),
width=0.08558e-7 * (u.um / u.mm**2),
num_distribution=num_distribution,
),
},
diffraction_order=1,
rulings=esis.flights.f1.optics.gratings.rulings.ruling_design(
num_distribution=num_distribution,
),
num_folds=num_folds,
halfwidth_inner=13.02 * u.mm - width_grating_border_inner,
Expand Down
11 changes: 8 additions & 3 deletions esis/flights/f2/optics/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,14 @@ def design_proposed(
num_distribution=num_distribution,
)

result.grating.rulings.coefficients[0].nominal = 1 / (2700 / u.mm)
result.grating.rulings.coefficients[1].nominal = -2.852e-5 * (u.um / u.mm)
result.grating.rulings.coefficients[2].nominal = -2.112e-7 * (u.um / u.mm**2)
c0 = 1 / (2700 / u.mm)
c1 = -2.852e-5 * (u.um / u.mm)
c2 = -2.112e-7 * (u.um / u.mm ** 2)

result.grating.rulings.spacing.coefficients[0].nominal = c0
result.grating.rulings.spacing.coefficients[1].nominal = c1
result.grating.rulings.spacing.coefficients[2].nominal = c2

result.grating.yaw = -3.65 * u.deg

z_filter = result.grating.translation.z.nominal + 1291.012 * u.mm
Expand Down
6 changes: 3 additions & 3 deletions esis/optics/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def angle_grating_input(self) -> na.AbstractScalar:
grating = self.grating.surface
position = na.Cartesian3dVectorArray() * u.mm
normal_surface = grating.sag.normal(position)
normal_rulings = grating.rulings.normal(position)
normal_rulings = grating.rulings.spacing_(position).normalized
transformation = grating.transformation.inverse @ fs.transformation
wire = np.moveaxis(
a=fs.aperture.wire(),
Expand All @@ -102,7 +102,7 @@ def angle_grating_output(self) -> na.AbstractScalar:
grating = self.grating.surface
position = na.Cartesian3dVectorArray() * u.mm
normal_surface = grating.sag.normal(position)
normal_rulings = grating.rulings.normal(position)
normal_rulings = grating.rulings.spacing_(position).normalized
transformation = grating.transformation.inverse @ detector.transformation
wire = np.moveaxis(
a=detector.aperture.wire(),
Expand All @@ -120,7 +120,7 @@ def _wavelength_test_grid(self) -> na.AbstractScalar:
position = na.Cartesian3dVectorArray() * u.mm
grating = self.grating.surface
m = grating.rulings.diffraction_order
d = grating.rulings.spacing(position)
d = grating.rulings.spacing_(position).length
a = self.angle_grating_input
b = self.angle_grating_output
result = (np.sin(a) + np.sin(b)) * d / m
Expand Down
6 changes: 5 additions & 1 deletion esis/optics/_tests/test_gratings.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ def test_surface(
manufacturing_number="ABCD",
sag=optika.sags.SphericalSag(500 * u.mm),
material=optika.materials.Mirror(),
rulings=optika.rulings.ConstantDensityRulings(5000 / u.mm),
rulings=optika.rulings.SawtoothRulings(
spacing=5000 / u.mm,
depth=10 * u.nm,
diffraction_order=1,
),
num_folds=8,
halfwidth_inner=10 * u.mm,
halfwidth_outer=15 * u.mm,
Expand Down
6 changes: 5 additions & 1 deletion esis/optics/_tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ def test_system(self, a: esis.optics.abc.AbstractOpticsModel):
manufacturing_number="123abc",
sag=optika.sags.SphericalSag(radius=500 * u.mm),
material=optika.materials.Mirror(),
rulings=optika.rulings.ConstantDensityRulings(5000 / u.mm),
rulings=optika.rulings.SawtoothRulings(
spacing=1 * u.um,
depth=10 * u.nm,
diffraction_order=1,
),
num_folds=8,
halfwidth_inner=15 * u.mm,
halfwidth_outer=10 * u.mm,
Expand Down

0 comments on commit 9bbf8cb

Please sign in to comment.