Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

Arroyo::diffractive_wavefront< T > Class Template Reference

#include <diffractive_wavefront.h>

Inheritance diagram for Arroyo::diffractive_wavefront< T >:

Arroyo::wavefront Arroyo::diffractive_wavefront_header< T > Arroyo::fft_manager< T > Arroyo::AO_sim_base Arroyo::wavefront_header Arroyo::three_frame Arroyo::wavefront_header Arroyo::three_point List of all members.

Public Member Functions

 diffractive_wavefront ()
 diffractive_wavefront (const diffractive_wavefront< T > &dwf)
 diffractive_wavefront (const char *filename)
 diffractive_wavefront (const iofits &iof)
 diffractive_wavefront (const diffractive_wavefront_header< T > &dwfh, T *data=NULL, bool rl_img=true, bool intrlvd=true)
 ~diffractive_wavefront ()
diffractive_wavefrontoperator= (const diffractive_wavefront< T > &dwf)
void resize (const vector< long > &axes)
void mask ()
template<class U>
void install (const pixel_amp_array< U > &pixamparr)
template<class U>
void install (const pixel_phase_array< U > &pixpharr)
pixel_amp_array< T > extract_amps () const
pixel_phase_array< T > extract_phases () const
void wrap_phases ()
void read (const char *filename)
void read (const iofits &iof)
void write (const char *filename) const
void write (iofits &iof) const
void write_amps_to_ppm (double min, double max, bool logscale, bool colorbar, colormap *cmap, const char *filename, long min_dimen=-1) const
void write_phases_to_ppm (double min, double max, bool colorbar, colormap *cmap, const char *filename, long min_dimen=-1) const
void print (ostream &os, const char *prefix) const
std::complex< T > data (int n) const
void set_data (int n, std::complex< T > &dat)
void set_propagation_direction (const three_vector &prop_dir)
void set_wavefront_curvature (double curvature)
void exact_propagator (double distance, double final_pixel_scale=-1, vector< long > final_axes=vector< long >())
void geometric_propagator (double distance)
void near_field_angular_propagator (double distance)
void near_field_fresnel_propagator (double distance)
void far_field_fresnel_propagator (double distance)
void far_field_fraunhoffer_propagator (double distance)
void far_field_fresnel_goertzel_reinsch_propagator (double distance, double final_pixel_scale, vector< long > final_axes)
void far_field_fraunhoffer_goertzel_reinsch_propagator (double distance, double final_pixel_scale, vector< long > final_axes)
void finite_difference_method_propagator (double distance)
void rotate (double angle)
double total_power () const
template<class U>
void pad_array (int npad, std::complex< U > value)
void clip_array (int nclip)
template<class U>
diffractive_wavefront< T > & operator+= (std::complex< U > c)
template<class U>
diffractive_wavefront< T > & operator-= (std::complex< U > c)
template<class U>
diffractive_wavefront< T > & operator *= (std::complex< U > c)
template<class U>
diffractive_wavefront< T > & operator/= (std::complex< U > c)

Protected Member Functions

void real_imag_conversion () const
void amp_phase_conversion () const
void interleaved_conversion () const
void non_interleaved_conversion () const

Protected Attributes

T * wfdata
 The array of complex elements.
bool real_imag
 A flag to indicate whether data is real-imag or amp-phase.
bool interleaved
 A flag to indicate whether data is interleaved.

Friends

class one_to_one_optic
class one_to_many_optic
template<class U, class V>
diffractive_wavefront< U > & operator+= (diffractive_wavefront< U > &lhs_dwf, const diffractive_wavefront< V > &rhs_dwf)
template<class U, class V>
diffractive_wavefront< U > & operator-= (diffractive_wavefront< U > &lhs_dwf, const diffractive_wavefront< V > &rhs_dwf)
template<class U, class V>
diffractive_wavefront< U > & operator *= (diffractive_wavefront< U > &lhs_dwf, const diffractive_wavefront< V > &rhs_dwf)
template<class U, class V>
diffractive_wavefront< U > & operator/= (diffractive_wavefront< U > &lhs_dwf, const diffractive_wavefront< V > &rhs_dwf)
bool operator== (const diffractive_wavefront< T > &dwf1, const diffractive_wavefront< T > &dwf2)

Detailed Description

template<class T>
class Arroyo::diffractive_wavefront< T >

A class to represent a diffractive diffractive_wavefront.


Constructor & Destructor Documentation

template<class T>
Arroyo::diffractive_wavefront< T >::diffractive_wavefront  ) 
 

Null constructor

template<class T>
Arroyo::diffractive_wavefront< T >::diffractive_wavefront const diffractive_wavefront< T > &  dwf  ) 
 

Copy constructor

template<class T>
Arroyo::diffractive_wavefront< T >::diffractive_wavefront const char *  filename  ) 
 

Construct from a file

template<class T>
Arroyo::diffractive_wavefront< T >::diffractive_wavefront const iofits iof  ) 
 

Construct from an iofits object

template<class T>
Arroyo::diffractive_wavefront< T >::diffractive_wavefront const diffractive_wavefront_header< T > &  dwfh,
T *  data = NULL,
bool  rl_img = true,
bool  intrlvd = true
 

Construct from the bits

template<class T>
Arroyo::diffractive_wavefront< T >::~diffractive_wavefront  ) 
 

Null destructor


Member Function Documentation

template<class T>
void Arroyo::diffractive_wavefront< T >::amp_phase_conversion  )  const [protected]
 

Convert array to amp/phase storage. This conversion is idempotent.

template<class T>
void Arroyo::diffractive_wavefront< T >::clip_array int  nclip  ) 
 

Clip each edge of the array by nclip pixels

template<class T>
std::complex< T > Arroyo::diffractive_wavefront< T >::data int  n  )  const
 

Return nth data element as a complex number.

The data is indexed as n - i*axes[0]+j, where

0 <= i < axes[1]

0 <= j < axes[0]

template<class T>
void Arroyo::diffractive_wavefront< T >::exact_propagator double  distance,
double  final_pixel_scale = -1,
vector< long >  final_axes = vector< long >()
 

Propagate without approximation by direct computation of the Rayleigh-Sommerfeld diffraction formula

This propagator permits a change in the dimensionality and pixel scale of the final array. These parameters may be reset using the default arguments, whose default values leave these parameters unchanged.

Time scale:

for NxN array, this requires N^{4} operations

Arguments:

distance is in meters

optional final_pixel_scale must be positive definite

optional axes must have 2 dimensions with positive definite values. These values may be even or odd.

template<class T>
pixel_amp_array< T > Arroyo::diffractive_wavefront< T >::extract_amps  )  const
 

Extract amplitudes from the diffractive_wavefront

template<class T>
pixel_phase_array< T > Arroyo::diffractive_wavefront< T >::extract_phases  )  const
 

Extract phases from the diffractive_wavefront

template<class T>
void Arroyo::diffractive_wavefront< T >::far_field_fraunhoffer_goertzel_reinsch_propagator double  distance,
double  final_pixel_scale,
vector< long >  final_axes
 

Propagate using far field fraunhoffer propagator and the Goertzel-Reinsch algorithm

This propagator permits a change in the dimensionality and pixel scale of the final array.

Time scale:

Unknown

Arguments

Distance is in meters

Optional final_pixel_scale is in meters per pixel

Optional axes must have 2 dimensions with positive definite values. These values may be even or odd.

template<class T>
void Arroyo::diffractive_wavefront< T >::far_field_fraunhoffer_propagator double  distance  ) 
 

Propagate using far field fraunhoffer propagator This function is an approximate form for the far_field_fresnel_propagator

Time scale:

Requires 1 fft

Arguments

Distance is in meters

template<class T>
void Arroyo::diffractive_wavefront< T >::far_field_fresnel_goertzel_reinsch_propagator double  distance,
double  final_pixel_scale,
vector< long >  final_axes
 

Propagate using far field fresnel propagator and the Goertzel-Reinsch algorithm

This propagator permits a change in the dimensionality and pixel scale of the final array.

Time scale:

unknown

Arguments

Distance is in meters

Optional final_pixel_scale is in meters per pixel

Optional axes must have 2 dimensions with positive definite values. These values may be even or odd.

template<class T>
void Arroyo::diffractive_wavefront< T >::far_field_fresnel_propagator double  distance  ) 
 

Propagate using far field frenel propagator (the paraxial approximation)

Time scale:

Requires 1 fft

Arguments:

Distance is in meters

template<class T>
void Arroyo::diffractive_wavefront< T >::finite_difference_method_propagator double  distance  ) 
 

Propagate using finite difference method

Arguments:

Distance is in meters

template<class T>
void Arroyo::diffractive_wavefront< T >::geometric_propagator double  distance  ) 
 

Propagate the wavefront geometrically. The effect of this propagator is to translate the wavefront along the z axis of its three frame by the distance provided.

template<class T>
template<class U>
void Arroyo::diffractive_wavefront< T >::install const pixel_phase_array< U > &  pixpharr  ) 
 

Install phases from a pixel_phase_array

template<class T>
template<class U>
void Arroyo::diffractive_wavefront< T >::install const pixel_amp_array< U > &  pixamparr  ) 
 

Install amplitudes from a pixel_amp_array

template<class T>
void Arroyo::diffractive_wavefront< T >::interleaved_conversion  )  const [protected]
 

Convert array to interleaved storage

That is, when real_imag == TRUE, we have real[0],imag[0],real[1],imag[1]... and when real_imag == FALSE, we have amp[0],phase[0],amp[1],phase[1]...

This conversion is idempotent.

template<class T>
void Arroyo::diffractive_wavefront< T >::mask  ) 
 

Perform a pixel by pixel check, zeroing the wavefront phases if the corresponding wavefront amplitudes are zero.

template<class T>
void Arroyo::diffractive_wavefront< T >::near_field_angular_propagator double  distance  ) 
 

Propagate using angular spectrum

This function will later handle verging beams using GLAD's formulation

Time scale:

Requires 2 ffts

Arguments:

Distance is in meters

template<class T>
void Arroyo::diffractive_wavefront< T >::near_field_fresnel_propagator double  distance  ) 
 

Propagate using near field fresnel propagator (the paraxial approximation for the angular spectrum) This function is an approximate form for the near_field_angular_propagator

This function will later handle verging beams using GLAD's formulation

Time scale:

Requires 2 ffts

Arguments:

Distance is in meters

template<class T>
void Arroyo::diffractive_wavefront< T >::non_interleaved_conversion  )  const [protected]
 

Convert array to contiguous storage.

That is, when real_imag == TRUE, we have real[0],...real[N-1],imag[0]...imag[N-1] and when real_imag == FALSE, we have amp[0],...amp[N-1],phase[0]...phase[N-1]

This conversion is idempotent.

template<class T>
template<class U>
diffractive_wavefront< T > & Arroyo::diffractive_wavefront< T >::operator *= std::complex< U >  c  ) 
 

Operator *= for doubles

template<class T>
template<class U>
diffractive_wavefront< T > & Arroyo::diffractive_wavefront< T >::operator+= std::complex< U >  c  ) 
 

Operator += for doubles

template<class T>
template<class U>
diffractive_wavefront< T > & Arroyo::diffractive_wavefront< T >::operator-= std::complex< U >  c  ) 
 

Operator -= for doubles

template<class T>
template<class U>
diffractive_wavefront< T > & Arroyo::diffractive_wavefront< T >::operator/= std::complex< U >  c  ) 
 

Operator /= for doubles

template<class T>
diffractive_wavefront< T > & Arroyo::diffractive_wavefront< T >::operator= const diffractive_wavefront< T > &  dwf  ) 
 

Operator =

template<class T>
template<class U>
void Arroyo::diffractive_wavefront< T >::pad_array int  npad,
std::complex< U >  value
 

Pad each edge of the array by npad pixels and initialize to the specified value

template<class T>
void Arroyo::diffractive_wavefront< T >::print ostream &  os,
const char *  prefix
const [virtual]
 

Print information about the diffractive_wavefront

Implements Arroyo::wavefront.

template<class T>
void Arroyo::diffractive_wavefront< T >::read const iofits iof  )  [virtual]
 

Read diffractive_wavefront from an iofits object

Implements Arroyo::wavefront.

template<class T>
void Arroyo::diffractive_wavefront< T >::read const char *  filename  )  [virtual]
 

Read diffractive_wavefront from a file

Implements Arroyo::wavefront.

template<class T>
void Arroyo::diffractive_wavefront< T >::real_imag_conversion  )  const [protected]
 

Convert array to real/imag storage. This conversion is idempotent.

template<class T>
void Arroyo::diffractive_wavefront< T >::resize const vector< long > &  axes  ) 
 

Resize the array of data

template<class T>
void Arroyo::diffractive_wavefront< T >::rotate double  angle  ) 
 

Rotate array by angle

Arguments:

Angle is in radians

template<class T>
void Arroyo::diffractive_wavefront< T >::set_data int  n,
std::complex< T > &  dat
 

Set nth data element to a complex number

The data is indexed as n - i*axes[0]+j, where

0 <= i < axes[1]

0 <= j < axes[0]

template<class T>
void Arroyo::diffractive_wavefront< T >::set_propagation_direction const three_vector prop_dir  ) 
 

Set the propagation direction to lie along the direction prop_dir. This member function modifies the phase of the wavefront to account for the change in direction.

template<class T>
void Arroyo::diffractive_wavefront< T >::set_wavefront_curvature double  curvature  ) 
 

Sets wavefront curvature in the header and removes this curvature from the phase

template<class T>
double Arroyo::diffractive_wavefront< T >::total_power  )  const
 

Return total power in the image

template<class T>
void Arroyo::diffractive_wavefront< T >::wrap_phases  )  [inline]
 

Wrap phases in the diffractive_wavefront into the interval [-M_PI,M_PI)

template<class T>
void Arroyo::diffractive_wavefront< T >::write iofits iof  )  const [virtual]
 

Write diffractive_wavefront to an iofits object

In general, details of the fits file format should be invisible to the library user. However, for diffractive wavefronts it is useful to know that you can display the amplitudes using ds9 filename and the phases using ds9 filename[1]

Implements Arroyo::wavefront.

template<class T>
void Arroyo::diffractive_wavefront< T >::write const char *  filename  )  const [virtual]
 

Write diffractive_wavefront to a file

In general, details of the fits file format should be invisible to the library user. However, for diffractive wavefronts it is useful to know that you can display the amplitudes using ds9 filename and the phases using ds9 filename[1]

Amplitudes mean the amplitude of the complex phasor - not the amplitude squared.

Implements Arroyo::wavefront.

template<class T>
void Arroyo::diffractive_wavefront< T >::write_amps_to_ppm double  min,
double  max,
bool  logscale,
bool  colorbar,
colormap cmap,
const char *  filename,
long  min_dimen = -1
const
 

Write diffractive_wavefront amplitudes to a ppm file. The data is discretized into 255 levels per RGB color in this operation, using the colormap provided. If the amplitudes fall outside the range [min, max], this function throws an error.

The format of a ppm file may be found at www.dcs.ed.ac.uk/home/mxr/gfx/

This function is meant to facilitate the creation of mpegs using ppmtompeg.

template<class T>
void Arroyo::diffractive_wavefront< T >::write_phases_to_ppm double  min,
double  max,
bool  colorbar,
colormap cmap,
const char *  filename,
long  min_dimen = -1
const
 

Write diffractive_wavefront phases to a ppm file. The data is discretized into 255 levels per RGB color in this operation, using the colormap provided. If the phases fall outside the range [min, max], this function throws an error.

The format of a ppm file may be found at www.dcs.ed.ac.uk/home/mxr/gfx/

This function is meant to facilitate the creation of mpegs using ppmtompeg.


Friends And Related Function Documentation

template<class T>
friend class one_to_many_optic [friend]
 

The optics are going to transform the diffractive_wavefront, and any practical, efficient implementation requires access to the protected wfdata array. So we make the base class of the optic inheritance hierarchy a friend of diffractive_wavefront, and then write protected member functions in optic that return protected data from diffractive_wavefront.

template<class T>
friend class one_to_one_optic [friend]
 

The optics are going to transform the diffractive_wavefront, and any practical, efficient implementation requires access to the protected wfdata array. So we make the base class of the optic inheritance hierarchy a friend of diffractive_wavefront, and then write protected member functions in optic that return protected data from diffractive_wavefront.

template<class T>
template<class U, class V>
diffractive_wavefront<U>& operator *= diffractive_wavefront< U > &  lhs_dwf,
const diffractive_wavefront< V > &  rhs_dwf
[friend]
 

Friend declaration for operator *= for diffractive_wavefronts

template<class T>
template<class U, class V>
diffractive_wavefront<U>& operator+= diffractive_wavefront< U > &  lhs_dwf,
const diffractive_wavefront< V > &  rhs_dwf
[friend]
 

Friend declaration for operator += for diffractive_wavefronts

template<class T>
template<class U, class V>
diffractive_wavefront<U>& operator-= diffractive_wavefront< U > &  lhs_dwf,
const diffractive_wavefront< V > &  rhs_dwf
[friend]
 

Friend declaration for operator -= for diffractive_wavefronts

template<class T>
template<class U, class V>
diffractive_wavefront<U>& operator/= diffractive_wavefront< U > &  lhs_dwf,
const diffractive_wavefront< V > &  rhs_dwf
[friend]
 

Friend declaration for operator /= for diffractive_wavefronts

template<class T>
bool operator== const diffractive_wavefront< T > &  dwf1,
const diffractive_wavefront< T > &  dwf2
[friend]
 

Friend operator == for diffractive_wavefronts


Member Data Documentation

template<class T>
bool Arroyo::diffractive_wavefront< T >::interleaved [mutable, protected]
 

A flag to indicate whether data is interleaved.

template<class T>
bool Arroyo::diffractive_wavefront< T >::real_imag [mutable, protected]
 

A flag to indicate whether data is real-imag or amp-phase.

The following functions non-destructively modify the order and representation of the data. These conversions help to modify the data so that it may be transformed efficiently by different fft libraries and may be modified by optics. e.g. FFTW requires interleaved real-imag, while Intel MKL requires non-interleaved real-imag

template<class T>
T* Arroyo::diffractive_wavefront< T >::wfdata [mutable, protected]
 

The array of complex elements.


The documentation for this class was generated from the following file:
Generated on Thu Nov 29 17:16:34 2007 for arroyo by  doxygen 1.3.9.1