cvsmei $SSW_SMEI_UCSD/camera/idl/toolbox/cvsmei.pro
[Next]
 NAME:
	cvsmei
 PURPOSE:
	Convert positions between various SMEI-related coordinate frames
 CATEGORY:
	camera/idl/toolbox
 CALLING SEQUENCE:
	FUNCTION cvsmei, $
	    camera	= camera     , $
	    quaternion	= quaternion , $

	    mode	= mode	     , $
	    from_mode	= from_mode  , $
	    to_mode	= to_mode    , $

	    from_ccd	= from_ccd   , $
	    from_camera = from_camera, $
	    from_equatorial    = from_equatorial   , $
	    from_helioecliptic = from_helioecliptic, $
	    from_map	= from_map   , $

	    time	= time	     , $

	    rectangular = rectangular, $
	    degrees	= degrees    , $
	    force_unit	= force_unit , $

	    to_ccd	= to_ccd     , $
	    to_camera	= to_camera  , $
	    to_equatorial = to_equatorial, $
	    to_helioecliptic = to_helioecliptic, $
	    to_map	= to_map     , $

	    inside	= inside     , $
	    boolean	= boolean    , $
	    ndim	= ndim	     , $
	    silent	= silent     , $
	    count	= count
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
	from_map	array[2,n]; type: numerical
			scalar; type: string
		       Pixel locations in a skymap, specified as a zero-base
		       array index (i.e. lower-left pixel is [0,0].

			    If set to string 'MAP' then the position of all
			    pixels in the skymap for the specified mode are used.

			    The type of map is set using keywords "mode" or "from_mode"
			    (see below)

	from_equatorial array[2,n] or array[3,n]
			    positions in the sky as spherical or rectangular
			    equatorial coordinates.

			/rect NOT SET: spherical coordinates
			    rvec[0,*] is RA;
			    rvec[1,*] is declination
			    rvec[3,*] (usually the distance)

			/rect SET: rectangular coordinates
			    rvec[0,*] is x-coordinate (toward vernal equinox)
			    rvec[1,*] is y-coordinate
			    rvec[3,*] is z-coordinate (toward equatorial north)

	from_helioecliptic
			array[2,n] or array[3,n]
			    positions in the sky as spherical or rectangular
			    helioecliptic coordinates

			/rect NOT SET: spherical coordinates
			    rvec[0,*] is helioecliptic (sun-centered) longitude;
			    rvec[1,*] is ecliptic longitude
			    rvec[3,*] (usually the distance)

			/rect SET: rectangular coordinates
			    rvec[0,*] is x-coordinate (toward sun)
			    rvec[1,*] is y-coordinate
			    rvec[3,*] is z-coordinate (toward ecliptic north)

	from_camera	array[3,n]
			    positions in the sky as unit vectors in the
			    UCSD camera frame.

	from_ccd	array[2,n]; type: double
			scalar; type: string

			    If set to string 'CCD' then the position of all
			    pixels in the image for the specified mode are used.

			    pixel locations on the CCD, specified as a zero-based
			    array index (i.e. lower-left pixel is [0,0])
			    The unit is the pixel size for mode 0.
			    Override this by explicitly setting the 'mode' keyword
			    (so set mode=0 for engineering mode pixels).

	/to_map 	returns array[2,n]; type: double
			    output is in pixel coodinates in a sky map
			    selected with the "mode" or "to_mode" keywords
	/to_equatorial	returns array[3,n] or array[2,n]; type: double
			    output is in equatorial sky coordinates (rectangular
			    array[3,n ] if /rectangular is SET.
			    array[2,n] (RA and dec) if /rectangular NOT set.
	/to_helioecliptic
			returns array[3,n] or array[2,n]; type: double
			    output is in helioecliptic sky coordinates (rectangular
			    array[3,n ] if /rectangular is SET.
			    array[2,n] (helioecliptic (sun-centered) longitude and latitude
			    if /rectangular NOT set.
	/to_camera	returns array[3,n]; type: double
			    output is a unitvector in the UCSD camera frame
			    (with z-axis along camera optical axis)
	/to_ccd 	returns array[2,n]; type: double
			    output is in pixel coordinates on the CCD
			    The units are mode-dependent.

	/rectangular	only used if 'from_equatorial' or /to_equatorial is set
			    if set then 'from_equatorial' is in rectangular
			    coordinates. The 1st dimension MUST be 3; if it is
			    not program execution halts.
			    If /to_equatorial is set then the output is in
			    rectangular coordinates.

	/degrees	only used if 'from_equatorial' or /to_equatorial is set
			    if set, all angles are in degrees (default: radians).

	/force_unit	only used if 'from_equatorial' or 'from_camera' are set
			    forces conversion of vectors to unit vectors
			    For 'from_equatorial' vectors converted to camera
			    coordinates must be unit vectors. By default only
			    vectors deviating from unit vectors by more than the
			    machine precision are explicitly scaled to unit vectors.

	camera=camera	scalar; type: integer; default: 1
			    camera number (1,2 or 3)
			    This determines the fixed S/C-to-camera quaternion for
			    conversions between camera and equatorial frames;
			    and CCD-related parameters (fov size, etc.) for
			    conversions between camera and ccd coordinates
	quaternion=quaternion
			array[4]; type: double
			    Coriolis S/C quaternion
			    Only needed for conversions between camera frame
			    and equatorial frame.

	from_mode=from_mode
	to_mode=to_mode
	mode=mode	scalar; type: integer or string; default: 0

			If /to_ccd and/or /from_ccd are set:

			    mode number (0,1 or 2)

			    The 'from_mode' and 'to_mode' keyword are necessary only
			    when both 'from_ccd' and /to_ccd are used (i.e. when
			    converting CCD coordinates between different modes.
			    'from_mode' takes priority over 'mode' if from_ccd is set.
			    'to_mode' takes priority over 'mode' if /to_ccd is set.

		       If /to_map and/or /from_map are set:

		       mode string: "lores", "eqmap", "npmap", "spmap", or "eclsun".
			    "lores" (low-resolution skymap),
			    "eqmap" (high-resolution equatorial map),
			    "npmap" (hi-res map of north pole) or
			    "spmap" (hi-res map of south pole)
			    "eclsun" (lo-res sun-centered map)

			    The 'from_mode' and 'to_mode' keyword are necessary only
			    when both 'from_map' and /to_map are used (i.e. when
			    converting between different types of skymap.

	/boolean	only used for conversions between camera frame and
			CCD coordinates.
			    if set then the output array 'inside' is a byte array of zeros
			    and ones indicating whether the corresponding vectory is
			    outside/inside the field of view (instead of a list of
			    indices from the IDL 'where' function identifying vectors
			    inside the field of view).
 OUTPUTS:
	R		array[3,n]; type: float
			    output locations as specified by /to_equatorial, /to_camera
			    or /to_ccd keyword.
 OPTIONAL OUTPUT PARAMETER:
	inside=inside	array[n]; type: long (/boolean NOT set) or byte (/boolean set).
			    Will only exist for conversion between CCD and sky coordinates
			    (either camera or equatorial)..
			    If /boolean is not set then 'inside' is a list of indices of
			    vectors inside field of view
			    If /boolean is set then 'inside' is a byte array with 0 for
			    vectors inside or 1  for vectors inside the field of view.
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLED BY:
	qImage_cw_DrawEphem, qImage_cw_Where, smei_findpnt, smei_frm_cvhdr
	smei_frm_where, smei_sky_atlocation, smei_sky_cleanedge_fix
	smei_sky_cleanedge_sample, smei_sky_getmask, smei_sky_read, smei_sky_track
	smei_star_fit, smei_star_remove, smei_zld_remove [1], smei_zld_weekly
 COMMON BLOCKS:
	common cvsmei_save, map_modes, str_modes, cxy_modes, dpb_modes, dim_modes, $
	    from_maptype_save, to_maptype_save
 CALLS: ***
	AngleRange, BadValue, CV_COORD, CvRotation, CvSky, InitVar, Inside_Wedge, IsTime, IsType
	SubArray, SyncDims, ToDegrees, ToRadians, boost, cvsmei_init, flt_string, gridgen
	smei_cam_quaternion, smei_camera, smei_radial2theta, smei_theta2radial, who_am_i
 PROCEDURE:
	There are four groups of coordinate systems involved:
	- CCD coordinates (for three different modes)
	- The native camera coordinate frame
	- The J2000 equatorial coordinate frame
	- Skymap coordinates (for lores maps, and three different
	  hires maps: equator, north and south pole)

	Conversions are done as follows:

	    CCD <---> Camera <---> J2000 Equatorial <---> Skymaps

	Phase 1:
	if CCD		if /to_ccd then convert to CCD (m0)
			if not /to_ccd then convert to Camera
	if Camera	do nothing
	if J2000	do nothing
	if Skymaps	convert to J2000

	After phase 1 we have Camera or J2000 coordinates
	unless /to_ccd was set (then we have CCD m0 coordinates)

	Phase 2:
	if Camera	if /to_map then convert to J2000
	if J2000	if /to_ccd then convert to Camera

	We now have coordinates that are at most one
	conversion from the final frame.

	Phase 3:
	if /to_ccd	    convert from CCD (m0) or Camera
	if /to_camera	    already in Camera or convert from J2000
	if /to_equatorial   already in J2000 or convert from Camera
	if /to_map	    convert from J2000

	Conversions between camera coordinates and equatorial
	coordinates require a Coriolis quaternion and a camera
	quaternion. This is provided by explicitly specifying a
	camera number and Coriolis quaternion through keywords
	'camera' and 'quaternion'
 MODIFICATION HISTORY:
	MAR-2005, Paul Hick (UCSD/CASS)
	    Extracted from smei_sky2ccd.
	MAR-2008, Paul Hick (UCSD/CASS)
	    Bug fix in conversion from hires equat map to polar
	    maps. Force output for RA into [0,360]
	APR-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Fairly substantial rewrite to incorporate conversions
	    from and to helioecliptic maps.


cvsmei_init $SSW_SMEI_UCSD/camera/idl/toolbox/cvsmei_init.pro
[Previous] [Next]
 NAME:
	cvsmei_init
 PURPOSE:
	Set scaling parameters for cvsmei
 CATEGORY:
	camera/idl/toolbox
 CALLING SEQUENCE:
	PRO cvsmei_init 		, $
	    mode    = mode		, $
	    str     = str		, $
	    cxy     = cxy		, $
	    mpb     = mpb		, $
	    dim     = dim		, $
	    degrees = degrees		, $
	    from_maptype = from_maptype , $
	    to_maptype	 = to_maptype	, $
	    reset   = reset		, $
	    silent  = silent		, $
	    get     = get
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
	mode = mode	scalar; type: string
			    map type: one of 'lores','eqmap','npmap','spmap','eqfull','eclsun'
	str  = str	scalar; type: string
	cxy  = cxy	array[2]; type: any
	mpb  = mpb	scalar; type: double
	dim  = dim	array[2]; type: integer
	/degrees	if set, angular units are degrees (default: radians)
	/get		if set, retrieve settings
	/reset		if set, reset everything for standard full-sky maps
	/silent 	suppress informational messages
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	InitVar, IsType, ToDegrees, destroyvar
 CALLED BY:
	cvsmei, smei_zld_remove [1]
 COMMON BLOCKS:
	common cvsmei_save, map_modes, str_modes, cxy_modes, dpb_modes, dim_modes, $
	    from_maptype_save, to_maptype_save
 PROCEDURE:
	Common block updates
 MODIFICATION HISTORY:
	FEB-2006, Paul Hick (UCSD/CASS)
	APR-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added mode 'eclsun'