Skip to content

Commit

Permalink
grid update and test
Browse files Browse the repository at this point in the history
  • Loading branch information
Gilles Orban de Xivry committed Apr 12, 2023
1 parent 827ffb0 commit bcca2b3
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 5 deletions.
10 changes: 7 additions & 3 deletions psi/configParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ class ConfigurationError(Exception):

class Parameters(object):
"""
TODO uniform inst_mode names
TODO complete the description of the config parameters
TODO check which sensor is used : kernel, psi. And check relevant parameters
Args:
filename (string): The name of the configuration file
Expand Down Expand Up @@ -106,9 +110,9 @@ def check_parameters(self):
# ' Please check the filename').format(self.params.inst_mode))
elif self.params.inst_mode == 'RAVC':
# if self.params.band == 'L':
if os.path.basename(self.params.f_lyot_stop)[0:9] != 'ls_RAVC':
self.logger.warn(('Lyot stop fname does not seem to match for {0} \t'
' Please check the filename').format(self.params.inst_mode))
if os.path.basename(self.params.f_lyot_stop)[0:9] != 'ls_RAVC_L':
self.logger.warn(('Lyot stop fname does not seem to match for {0}'
' Please check the filename').format(self.params.inst_mode))
# if self.params.band == 'N':
# if os.path.basename(self.params.f_lyot_stop)[0:8] != 'ls_RAVC_N':
# self.logger(('Lyot stop fname does not seem to match for {0}.'
Expand Down
4 changes: 2 additions & 2 deletions psi/psi_utils/makeGrids.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
from scipy.signal import convolve2d
from .psi_utils import gauss_2Dalt
from hcipy.aperture import circular_aperture, make_obstructed_circular_aperture
from hcipy.aperture import make_circular_aperture, make_obstructed_circular_aperture
from hcipy.coronagraphy import VortexCoronagraph
from hcipy import inverse_tikhonov
from hcipy.mode_basis import ModeBasis, make_zernike_basis
Expand Down Expand Up @@ -29,7 +29,7 @@ def makeFilters(grid, type="back_prop", sigma=0.05, cent_obs=0.27, outer_vin=1.0
"""
if type == "back_prop":
filter_ = circular_aperture(lD)(grid) # 15 is an arbitrary number set by Emiel.
filter_ = make_circular_aperture(lD)(grid) # 15 is an arbitrary number set by Emiel.
elif type == "ncpa":
filter_ = make_obstructed_circular_aperture(1*0.7, 1.8*cent_obs)(grid)
elif type == "reset":
Expand Down
50 changes: 50 additions & 0 deletions sandbox/test_grid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
'''
testing grids with and without physical dimensions
'''

import hcipy
import numpy as np
import matplotlib.pyplot as plt

ngrid =128
det_size=15
det_res=4
diam = 40

pupilGrid = hcipy.make_pupil_grid(ngrid, diameter=diam)
focalGrid = hcipy.make_focal_grid(det_res,
det_size,
# spatial_resolution= diam,
pupil_diameter=diam,
reference_wavelength=1,
focal_length=diam)

prop = hcipy.FraunhoferPropagator(pupilGrid, focalGrid, focal_length=diam)

optical_model = hcipy.OpticalSystem([prop])

aperture = hcipy.make_circular_aperture(diam)(pupilGrid)

phase = hcipy.Field(0, pupilGrid)
wf = hcipy.Wavefront(np.exp(1j * phase) * aperture)

image = optical_model(wf).power

plt.figure()
hcipy.imshow_field(image)


import psi.psi_utils as psi_utils
filter_fp = psi_utils.makeFilters(focalGrid,
"back_prop",
sigma=0.1,
lD = 6 * 2)

sh = int(np.sqrt(len(filter_fp)))
plt.figure()
plt.imshow(filter_fp.reshape(sh,sh))

# psi_sensor.filter_fp = psi_utils.makeFilters(psi_sensor.inst.focalGrid,
# "back_prop",
# sigma=0.05,
# lD = 2 * 2)

0 comments on commit bcca2b3

Please sign in to comment.