Releases: brandondube/prysm
prysm 0.15
New Features
-
Surface/Wavefront error synthesis:
prysm.interferogram
now contains thesynthesize_surface_from_psd
core method andrender_synthetic_surface
andInterferogram.render_from_psd
convenience wrappers for synthesizing surface or wavefront data from PSD curves. Examples of this technique can be seen in e.g. E. Sidick Power Spectral Density Specification and Analysis of Large Optical Surfaces. -
convenience wrapper
Interferogram.fit_zernikes
replacingzernikefit(i.phase, ...)
invocation. -
write_zygo_ascii
function inprysm.io
to write Zygo ASCII files. -
Interferogram.save_zygo_ascii
to write an interferogram to Zygo ASCII format. -
zorder
parameter in line-based plotting functions --OpticalPhase.plot_slice_xy
,Convolvable.plot_slice_xy
,Interferogram.plot_psd_xy_avg
-
mode
argument onInterferogram.plot_psd_xy_avg
to switch between x axis units of spatial frequency (mode='freq'
) or spatial period (mode='period'
). -
Interferogram.psd_slices
andInterferogram.plot_psd_slices
methods replacingpsd_xy_avg
method. Two new inquiries areazmin
andazmax
for the azimuthal minimum and azimuthal maximum. -
PSF.polychromatic
staticmethod to create polychromatic PSFs from ensembles of monochromatic ones. This essentially reintroduces theMultispectralPSF
class's functionality from earlier versions of prysm. -
more configuration options.
prysm.config
now has parameters forQ
,phase_colormap
,image_colormap
,lw
,zorder
for controlling the default values of these parameters throughout the library. -
new constants in
prysm.psf
--FIRST_AIRY_ZERO
,SECOND_AIRY_ZERO
, ANDTHIRD_AIRY_ZERO
as well asSECOND_AIRY_ENCIRCLED
ANDTHIRD_AIRY_ENCIRCLED
. These concern the zeros of the airy disk and how much of the total energy is contained within. They are all wrapped inAIRYDATA
, a dictionary with keys of 1,2,3 and values that are length-2 tuples of (radius, encircled energy).
Beta features
prysm.otf.long_exposure_otf
andprysm.otf.estimate_Cn
for calculating the OTF (MTF) associated with a 'long' exposure through atmospheric turbulence. Note that while the equations have been implemented, the results have not been checked against published values. Please provide feedback.
Improved packaging
- prysm now uses
setup.cfg
and some setuptools tricks. It now has theprysm.__version__
attribute and can be more easily scanned by crawlers without executing setup.py.
Improved documentation
-
The User's guide and Examples sections of the documentation are now jupyter notebooks and have embedded graphics and output.
-
There are several new examples.
Improved test coverage
- Test coverage is now > 80%
breaking API changes
-
Interferogram.psd_xy_avg
has been removed, its functionality is now the same as the default forInterferogram.psd_slices
-
Interferogram.plot_psd_xy_avg
faces the same change forInterferogram.plot_psd_slices
. Note that two calls are now needed to replicate the default behavior:
fig, ax = i.plot_psd_slices(x=True, y=True, alpha=0.4, lw=3)
fig, ax = i.plot_psd_slices(x=False, y=False, azavg=True, lw=4.5, fig=fig, ax=ax)
-
prysm.psf._airydisk
has been renamed toprysm.psf.airydisk
. -
the
lens
submodule has been removed. This eliminates theLens
class. -
the
seidel
submodule has been removed. This eliminates theSeidel
class. -
the
shackhartmann
submodule has been removed. This eliminates theShackhartmann
class. -
the
macros
submodule has been removed. This eliminates theSystemConfig
namedtuple, thethrufocus_mtf_from_wavefront
andthrufocus_mtf_from_wavefront_array
functions. -
prysm.detector.generate_mtf
has been removed. This function is redundant withprysm.detector.pixelaperture_analytic_otf
. -
prysm.detector.OLPF.__init__
now defaults tosamples_x=0
, using the analytical representation in the numerical case. -
The great Zernike refactor of 2019:
-
prysm.fringezernike
has been folded intoprysm.zernike
. Several functions have been renamed:
-
-
fit
is nowzernikefit
called aszernikefit(... map_='fringe')
(or `map_='noll')
-
-
-
- magnitude/angle and name functions are now part of the
zernikefuncs
dictionary of dictionaries. Keys are, in order, function type and zernike order.fzname
is now accessed most easily aszernikefuncs['name']['fringe']
.fzset_to_magnitude_angle
aszernikefuncs['magnitude_angle']['fringe'].
noll` is a valid key for the nested dictionary.
- magnitude/angle and name functions are now part of the
-
-
-
FZCache
andfzcache
are nwo made redundant byZCache
andzcache
. The cache takes an index into theprysm.zernikes.zernikes
list, not a Fringe or Noll index. Useprysm.zernikes.maps
to convert Fringe or Noll indices into prysm's zernike catalog.
-
-
- the
StandardZernike
class fromprysm.standardzernike
has been replaced withNollZernike
fromprysm.zernike,
or as imported from the top-level namespace.
- the
-
-
NollZernike
allows coefficients from 0 to 36 or 1 to 37 and has all features present inFringeZernike
, unlike the priorStandardZernike
class.
-
-
prysm._zernike
is nowprysm.zernike
under-the-hood changes
-
Angles of rotationally invariant terms in Fringe Zernike magnitude sets are now zero.
-
use of
isfinite
andisnan
optimized for internal routines.
bugfixes
-
wavelength
is properly captured inPupil.from_interferogram.
-
Convolvable.from_file
no longer mangles x and y units. -
PSF.encircled_energy
has been reworked, improving accuracy by about 2.3%. -
BasicData.center_x
andcenter_y
are now properly computed. Fixes #2 .
prysm 0.14
Version 0.14 introduces a host of new features and critical improvements to existing features of prysm. Users are encouraged to upgrade from prior releases.
With version 0.15, work will continue on improving the documentation and tests. When documentation becomes "complete" and coverage exceeds 90%, version 1.0 will be released and prysm will follow more typical semver release patterns.
New Features
-
pad2d
fromprysm.fttools
now takes themode
kwarg, wrapping numpy.pad in the non-constant case. -
prop_pupil_plane_to_psf_plane
now takes theincoherent
(defaultTrue
) argument. Whenincoherent=False
, the (complex-valued) coherent impulse response is returned. -
wrap-around effects in convolutions have been reduced.
-
there is a new
truecircle
mask inprysm.geometry
which has anti-aliased edges for improved simulation accuracy. -
read_mtfmapper_sfr_single
function inprysm.io
to read outputs from MTF Mapper with the-f --single-roi
arguments. -
semidiameter
attribute onOpticalPhase
class and subclasses (FringeZernike
,Interferogram
, ...). -
show_colorbar
option onOpticalPhase.plot2d
. -
all masks in
prysm.geometry
now take aradius
argument. -
Interferogram.mask
now takes descriptive arguments, e.g.i.mask('circle', diameter=100)
for a 100mm diameter circle. Themask
kwarg still exists for user-provided masks. -
(Interferogram).pvr
for PVr analysis. -
in
prysm.fringezernike
:fzname
function to return the name of then
th Fringe Zernike withbase
(0 or 1). -
fzset_to_magnitude_angle
function to convert a list of (X-Y) Zernikes to (magnitude-angle) form. -
(FringeZernike).magnitudes
property to accessfzset_to_magnitude_angle
on a FringeZernike instance. -
top_n
method forFringeZernike
pupils to list the topn
coefficients by magnitude. -
barplot
method forFringeZernike
pupils to plot their coefficients. -
barplot_magnitudes
method to plot their pairwise magnitudes (e.g, one bar for primary astigmatism). -
barplot_topn
method to plot the top n coefficients only. -
truncate
method to reduceFringeZernike
pupils to the firstn
terms. -
truncate_topn
method to reduce to topn
terms. -
fs
andnyquist
properties on theDetector
class for the sampling and nyquist frequencies in cy/mm. -
crossed
parameter inSlantedEdge
constructor to produce a "BMW target" -
ab_psd
function inprysm.interferogram
for analytical inverse power law PSD curves.
API changes
-
rms_norm
in functions related to Zernikes has been renamed tonorm
. This affects thefit
function fromprysm.fringezernike
as well as theFringeZernike
class. -
num_terms
on thefit
function is now renamed toterms
. -
num_spokes
onSiemensStar
has been renamed tospokes
. -
num_pts
onprysm.otf.diffraction_limited_mtf
has been renamed tosamples
. -
num_samples
has been renamed tosamples
inprysm.propagation.pupil_sample_to_psf_sample
andpsf_sample_to_pupil_sample
. -
the
epd
keyword argument onPupil
instances has been renamed todia
. This also affects theFringeZernike
andSeidel
subclasses. -
Interferogram.plot_psd_xyavg
has been renamed toplot_psd_xy_avg
.
Under-the-hood changes
-
samples_x
,samples_y
,center_x
, andcenter_y
are now properties ofOpticalPhase
instances (Pupils
,Interferograms
, ...) instead of attributes. This helps eliminate synchronization problems when the data is modified. -
imwrite
is used from imageio, notimsave
to follow best practice. -
circle
fromprysm.geometry
is now exported at the top level. -
Detector
now defaults to 16-bit precision. -
import of h5py for datx files is now deferred for faster imports of prysm.
-
matplotlib is now an optional dependency and its import is deferred for faster imports of prysm.
-
OpticalPhase
now provides default values forxaxis_label
,yaxis_label
, andzaxis_label
to avoid errors on subclasses. Users should still provide better values for subclasses. -
MaskCache
argument order has changed fromsamples, shape
toshape, samples, radius
. -
data from Zygo
datx
files is now flipped to maintain consistent orientation with the representation in Mx -
in
prysm._zernikes
,Tip (Y)
has been renamedTilt Y
.Tilt (X)
has been renamedTilt X
-
the
coefs
attribute onFringeZernike
instances is now a numpy array. Piston tip and tilt can be suppressed by invokingfz.coefs[:3] = 0; fz.build(); fz.mask(fz._mask, fz._mask_target);
. -
PSD calculation has been rewritten. PSD results are now properly normalized to be a true PSD. Prior results should be considered in error.
bugfixes
-
fix
Convolvable.show
errors when no xlim or ylim provided. -
fix
OpticalPhase.samples_x
andsamples_y
lookup. -
coefficients from
fringezernike.fit
are no longer transposed in the Cartesian plane. -
calling
(Interferogram).crop
with data spanning the entire array no longer causes an error. -
Initializing an
Interferogram
with nometa
dictionary no longer causes an error.
prysm 0.13.1
Hotfix for importerror in 0.13
prysm 0.13
This release brings a number of new features and enhancements. Users are encouraged to upgrade from older releases.
New Features
-
SlantedEdge
object for image simulation -
deconv
method on theConvolvable
class to perform Wiener-Hunt deconvolution -
convenience properties on
OpticalPhase
(FringeZernike
,Interferogram
, ...) andConvolvable
objects -
shape,
diameter_x,
diameter_y
, anddiameter
on the former
-
shape,
support_x,
support_y,
andsupport
on the latter
-
std
property for the standard deviation inOpticalPhase
instances andstrehl
for the approximate Strehl ratio forPupil
instances -
band-limited RMS evaluation on
Interferogram
objects based on a 2D PSD calculation -
analytical Fourier transform on the AiryDisk class for faster convolutions
-
flexible linewidth in many plots, log scaling on 2D PSF plots
-
residual
parameter in thefit
function from thefringezernike
module -
azimuthally averaged MTF via the
azimuthal_average
method on theMTF
class -
convolvables can now be saved with 16-bit precision
Under-the-hood changes and bug fixes
-
Interferogram instances no longer cache PSD calculations internally
-
The wavefunction associated with an optical pupil is now a property,
(Pupil).fcn
instead of an attribute. It will be calculated on an as-needed basis which eliminates synchronization problems whenPupil
instances are modified. -
FZCache and MCache for Fringe Zernikes and masks now implement
__call__
, you can usemcache(128, 'hexagon')
instead ofmcache.get_mask(128, 'hexagon')
and the equivalent forzcache
. -
importing of zygo datx files is now more robust. Files from the NexView NX2 now import properly
-
Convolvable
is now exported at the top level -
Convolvable.from_file
no longer errors. Users must now scale the data after importing on their own, e.g.Convolvable.data /= 255
for an 8 bit per pixel file, or/= 65535
for a 16-bit file
Remove features
-
bandreject_filter
has been removed on theInterferogram
class; the implementation was not well done and the results of low quality. -
MultispectralPSF
anRGBPSF
have been dropped; they have been neglected for a significant amount of time. MultispectralPSF only differed from a PSF in the call to__init__,
users can replicate this behavior independently.
prysm v0.12.2
ver++
prysm v0.12.1
+ TOC user guide on index