TwiceAsNice  2019-02-18
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Lics::LicsPcamSnapshot Class Reference

A one-time snapshot of an image from the buffer of the Patrol Camera. More...

#include <LicsPcamSnapshot.h>

Inheritance diagram for Lics::LicsPcamSnapshot:
Inheritance graph
Collaboration diagram for Lics::LicsPcamSnapshot:
Collaboration graph

Public Member Functions

 LicsPcamSnapshot (const Lics::LicsIIFSide &sxordx, const Laos::LaosSeAOType &ao, const std::string &catfil, const double mang, const double parang, const double ra, const double dec, bool bat)
 constructor specifiying one of the two sides. More...
 
 ~LicsPcamSnapshot ()
 close the ICE interface. More...
 
int run (int argc, char *argv[])
 The function which will be called intermediately through Application::start() More...
 
Nice::SeqPoint centroids (Basda::Image< ushort > &img)
 Extract star centroids from the image via sex(1). More...
 
Nice::SeqPoint toFmum (const Nice::SeqPoint pxlst)
 Convert Pcam pixel coordinates to SE F coordinates. More...
 
 LicsPcamSnapshot (const Lics::LicsIIFSide &sxordx, const Laos::LaosSeAOType &ao, const std::string &catfil, const double mang, const double parang, const double ra, const double dec, bool bat)
 
 ~LicsPcamSnapshot ()
 
int run (int argc, char *argv[])
 
Nice::SeqPoint centroids (Basda::Image< ushort > &img)
 
Nice::SeqPoint toFmum (const Nice::SeqPoint pxlst)
 
- Public Member Functions inherited from Nice::Application
 Application ()
 
 ~Application ()
 
int init (int &, char *[])
 
int start (int, char *[])
 
void loadTypes ()
 
void enableHeartbeat ()
 
void enableLogger ()
 
virtual void interruptCallback (int _i)
 
 Application ()
 
 ~Application ()
 
int init (int &, char *[])
 
int start (int, char *[])
 
void loadTypes ()
 
void enableHeartbeat ()
 
void enableLogger ()
 
virtual void interruptCallback (int _i)
 

Public Attributes

Lics::LicsIIFSide sdx
 Specifies SX or DX. More...
 
float pxscal
 pixel scale [deg/pix] More...
 
float beamcntr [2]
 The pixel coordinates of the beam center on the Patrol camera. More...
 
Lics::LicsStarcat cat
 the star catalog provided on the command line More...
 
double motang
 K-mirror motor angle [rad]. More...
 
double pang
 parallactic angle [rad] More...
 
double radec [2]
 right ascension and declination [deg] More...
 
bool batch
 flag for batch-type (non-GUI) operation More...
 

Protected Member Functions

void ds9atF (Basda::Image< ushort > &img) const
 Show the PCAM picture in SE coordinates with ds9(1). More...
 
void ds9atPcam (Basda::Image< ushort > &img) const
 Show the PCAM picture plus the stars with ds9(1). More...
 
void ds9atF (Basda::Image< ushort > &img) const
 
void ds9atPcam (Basda::Image< ushort > &img) const
 

Protected Attributes

Laos::LaosSeAOType ghws
 the type of focal plane. HWS or Pcam in this application const static Laos::LaosSeAOType ghws; More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Nice::Application
static void exit (int)
 
static const char * appName ()
 
static bool isInitialized ()
 
static void wait ()
 
static void shutdown (int _int=0)
 
static Ice::CommunicatorPtr communicator ()
 
static Ice::ObjectAdapterPtr adapter (const std::string &="")
 
static const Ice::ObjectPrx & addService (const std::string &_name, Ice::ObjectPtr &_object)
 
static JointPtr preinit ()
 
static JointPtr config (const std::string &_node="")
 
static Nice::JointPtr loadFile (const std::string &_filename)
 
static Nice::PrioThreadPoolPtr threadpool ()
 
static void startHeartbeat ()
 
static void startLogger ()
 
static void distribute (const Nice::JointPtr &_seed, bool _recursive=true)
 
static std::string fileByPath (const std::string _filename, bool _create=false)
 
static void destroyOnInterrupt ()
 
static void shutdownOnInterrupt ()
 
static void ignoreInterrupt ()
 
static void callbackOnInterrupt ()
 
static void holdInterrupt ()
 
static void releaseInterrupt ()
 
static bool interrupted ()
 
static void exit (int)
 
static const char * appName ()
 
static bool isInitialized ()
 
static void wait ()
 
static void shutdown (int _int=0)
 
static Ice::CommunicatorPtr communicator ()
 
static Ice::ObjectAdapterPtr adapter (const std::string &="")
 
static const Ice::ObjectPrx & addService (const std::string &_name, Ice::ObjectPtr &_object)
 
static JointPtr preinit ()
 
static JointPtr config (const std::string &_node="")
 
static Nice::JointPtr loadFile (const std::string &_filename)
 
static Nice::PrioThreadPoolPtr threadpool ()
 
static void startHeartbeat ()
 
static void startLogger ()
 
static void distribute (const Nice::JointPtr &_seed, bool _recursive=true)
 
static std::string fileByPath (const std::string _filename, bool _create=false)
 
static void destroyOnInterrupt ()
 
static void shutdownOnInterrupt ()
 
static void ignoreInterrupt ()
 
static void callbackOnInterrupt ()
 
static void holdInterrupt ()
 
static void releaseInterrupt ()
 
static bool interrupted ()
 
- Static Protected Member Functions inherited from Nice::Application
static int end (int)
 
static void setCtrlCCallback (IceUtil::CtrlCHandlerCallback)
 
static int end (int)
 
static void setCtrlCCallback (IceUtil::CtrlCHandlerCallback)
 

Detailed Description

A one-time snapshot of an image from the buffer of the Patrol Camera.


Since
2017-08-21
Author
Richard J. Mathar

Constructor & Destructor Documentation

◆ LicsPcamSnapshot() [1/2]

Lics::LicsPcamSnapshot::LicsPcamSnapshot ( const Lics::LicsIIFSide sxordx,
const Laos::LaosSeAOType ao,
const std::string &  catfil,
const double  mang,
const double  parang,
const double  ra,
const double  dec,
bool  bat 
)

constructor specifiying one of the two sides.


Parameters
sxordxSpecifies SX or DX.
catfiloptional name of the star catalog file in the durrent file system
mangK-mirror nominal angle in radians.
parangparallactic angle in radians.
raright ascension in degrees
decdeclination in degrees
Since
2018-08-21
Author
Richard J. Mathar

◆ ~LicsPcamSnapshot() [1/2]

Lics::LicsPcamSnapshot::~LicsPcamSnapshot ( )

close the ICE interface.


◆ LicsPcamSnapshot() [2/2]

Lics::LicsPcamSnapshot::LicsPcamSnapshot ( const Lics::LicsIIFSide sxordx,
const Laos::LaosSeAOType ao,
const std::string &  catfil,
const double  mang,
const double  parang,
const double  ra,
const double  dec,
bool  bat 
)

◆ ~LicsPcamSnapshot() [2/2]

Lics::LicsPcamSnapshot::~LicsPcamSnapshot ( )

Member Function Documentation

◆ centroids() [1/2]

Nice::SeqPoint Lics::LicsPcamSnapshot::centroids ( Basda::Image< ushort > &  img)

Extract star centroids from the image via sex(1).


Parameters
[in]imgThe reasonably recent Pcam image (of this side).
Returns
A list of pixel coordinates in the pcam image. The number of coordinates is freely defined by the noise threshold through the sex(1) configuration here, not related to the star catalogu defined elsewhere. The pixel coordintates are in the FITS-system, where the lower left coordinate is (1,1). The pixel sequence is sorted with the brightest stars first, the faintest last.
Since
2017-08-22
Author
Richard J. Mathar

◆ centroids() [2/2]

Nice::SeqPoint Lics::LicsPcamSnapshot::centroids ( Basda::Image< ushort > &  img)

◆ ds9atF() [1/2]

void Lics::LicsPcamSnapshot::ds9atF ( Basda::Image< ushort > &  img) const
protected

Show the PCAM picture in SE coordinates with ds9(1).


Parameters
imgThe Basda image. The 2D array of numbers of the PCam.

The procedure pops up a ds9 window which shows the patrol camera image properly flipped (to account for the dichroic between Pcam and SE arms) and rotated (by the angle implicit in the measurements of 03/2017). It also shows the coordinate system of the SE motors in units of micrometers as used everywhere in the GUIs. It does shows (predicted) star positions of the catalog in small boxes.

Author
Richard J. Mathar
Since
2017-10-24
Todo:
work precession into the positions and counter-rotate the ra/dec to J2000.

Parameters
imgThe Basda image. The 2D array of numbers of the PCam.

The procedure pops up a ds9 window which shows the patrol camera image properly flipped (to account for the dichroic between Pcam and SE arms) and rotated (by the angle implicit in the measurements of 03/2017). It also shows the coordinate system of the SE motors in units of micrometers as used everywhere in the GUIs. It does shows (predicted) star positions of the catalog in small boxes.

Author
Richard J. Mathar
Since
2017-10-24
Todo:
work precession into the positions and counter-rotate the ra/dec to J2000.

◆ ds9atF() [2/2]

void Lics::LicsPcamSnapshot::ds9atF ( Basda::Image< ushort > &  img) const
protected

◆ ds9atPcam() [1/2]

void Lics::LicsPcamSnapshot::ds9atPcam ( Basda::Image< ushort > &  img) const
protected

Show the PCAM picture plus the stars with ds9(1).


Parameters
imgThe Basda image. The 2D array of numbers of the PCam.

The procedure pops up a ds9 window which shows the patrol camera image in its native orientation and the stars marked by squares.

Author
Richard J. Mathar
Since
2017-11-17

◆ ds9atPcam() [2/2]

void Lics::LicsPcamSnapshot::ds9atPcam ( Basda::Image< ushort > &  img) const
protected

◆ run() [1/2]

int Lics::LicsPcamSnapshot::run ( int  argc,
char *  argv[] 
)
virtual

Implements Nice::Application.

◆ run() [2/2]

int Lics::LicsPcamSnapshot::run ( int  argc,
char *  argv[] 
)
virtual

The function which will be called intermediately through Application::start()


First use case (if the star catalog is empty): The function tries to connect to laos.{sx|dx}.hws.pcam.ccd47-svr and to retrieve a single image on that specific side. It runs sex(1) through the image to extract the center coordinates of a set of stars (with a criterion that these must raise above the background by a factor of 2). These pixel coordinates within the patrcol camera are then converted with the affine mapping from experiments of Feb 2017 to micrometers in the HWS star enlarger plane. For each of these positions in the SE plane, we proceed with the same algorithm as in the GWS case:

  • a list of SE arms (of size between none and 8) is collected that can reach that point.
  • For all possible mixes of assigments of points to SE arms we check whether that assignment would lead to a SE overlap (defined by an overlap in the contour of the SE pairs once positioined). We accept assignments where no SE position pair collides. If needed, points are dropped to reduce the number of collisions until a collision-free set of assignments is found. From all assignments which manage to assign an equal number of points, those are prefereed with a minimum total protruding distance of the SE arms into the field (along y). Note that there is no preference given to dropping faint stars preferentially.
  • The best assignment of (a possible subset) of points is sent as a map of SE numbers to micron (points) to the associated HWS SE GUI and at the same time the program calls the python preset program to move the SE to these positions. [At that point, the motor controllers may still detect collisions, due to two possible simplifications here: collisions with the SE's that are not assigned are not tested here, and the motor trajectory checker looks at the entire dynamical process of moving the SE arms from the current position set to the assigned ones.]

Second use case (if the star catalog contains stars):

  • Try to retrieve a single image of the Pcam on the side.
  • Re-display that image with ds9 by superimposing the stars (effectively equinox 2000 but with proper motions to the current epoch) in the image. The choice of the rotation/flip depends on the ghws setting (LINC_HWS for SE, LINC_PCAM for pcam)
Returns
An integer as a status value. 0 if successful.
Since
2017-08-21
Author
Richard J. Mathar

Implements Nice::Application.

◆ toFmum() [1/2]

Nice::SeqPoint Lics::LicsPcamSnapshot::toFmum ( const Nice::SeqPoint  pxlst)

Convert Pcam pixel coordinates to SE F coordinates.


Parameters
[in]pxlstThe list of pcam pixel coordinates.
Returns
A list of pixel coordinates in the HWS F plane (microns).
Author
Richard J. Mathar
Since
2017-08-24

◆ toFmum() [2/2]

Nice::SeqPoint Lics::LicsPcamSnapshot::toFmum ( const Nice::SeqPoint  pxlst)

Member Data Documentation

◆ batch

bool Lics::LicsPcamSnapshot::batch

flag for batch-type (non-GUI) operation


◆ beamcntr

float Lics::LicsPcamSnapshot::beamcntr

The pixel coordinates of the beam center on the Patrol camera.


◆ cat

Lics::LicsStarcat Lics::LicsPcamSnapshot::cat

the star catalog provided on the command line


◆ ghws

Laos::LaosSeAOType Lics::LicsPcamSnapshot::ghws
protected

the type of focal plane. HWS or Pcam in this application const static Laos::LaosSeAOType ghws;


◆ motang

double Lics::LicsPcamSnapshot::motang

K-mirror motor angle [rad].


◆ pang

double Lics::LicsPcamSnapshot::pang

parallactic angle [rad]


◆ pxscal

float Lics::LicsPcamSnapshot::pxscal

pixel scale [deg/pix]


◆ radec

double Lics::LicsPcamSnapshot::radec

right ascension and declination [deg]


◆ sdx

Lics::LicsIIFSide Lics::LicsPcamSnapshot::sdx

Specifies SX or DX.



The documentation for this class was generated from the following files: