scalarproduct $SMEI/ucsd/gen/idl/toolbox/math/scalarproduct.pro
[Previous] [Next]
 NAME:
	scalarproduct
 PURPOSE:
	Calculate scalar product for two vectors
 CATEGORY:
	gen/idl/toolbox/math
 CALLING SEQUENCE:
	result = scalarproduct(r1, r2 [, /cylin, /sphere, /rect, /degrees, /angle])
 INPUTS:
	    r1	    arrays[3,*]; type: int or float
	    r1	    arrays[3,*]; type: int or float
			vectors for which the product is to be taken.
			the first dimension identifies the three coordinates: Cartesian (default),
			cylindrical or spherical.
 OPTIONAL INPUT PARAMETERS:
	    /angle	if set then information about the angle between the two vectors is returned:
			    i.e. cos(angle) = |r1.r2|/|r1||r2|
	    /cylin, /sphere, /rect
			indicates whether input vectors are in cylindrical, spherical or rectangular
			    coordinates. If none is set then rectangular is assumed.
	    /degrees	if set, and spherical or cylindrical coordinates are used, then the angles
			    are assumed to be in degrees (default: radians)
 OUTPUTS:
	    result  array[*]	same type as input
			scalar products or angle information are returned as array[n]
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
 CALLS: ***
	CV_COORD, InitVar, SyncArgs, SyncDims
 CALLED BY:
	RotationMeasure, jpl_phase
 PROCEDURE:
 >	The arrays r1 and r2 do not necessarily have the same dimensions, i.e.
	if r1 is an array[3,n] and r2 is an array[3] then r2 is interpreted as an array[3,n]
	with all n vectors the same (SyncArgs is used to synchronize the array dimensions).
 >	Arrays r1 and r2 can have more than two dimensions, i.e. if r1 and r2 are both
	arrays[3,n,m] then the scalar products will be returned as array[n,m]
 MODIFICATION HISTORY:
	AUG-1999, Paul Hick (UCSD/CASS)
	NOV-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Extracted from vectorproduct procedure.


set_page $SMEI/ucsd/sat/idl/util/set_page.pro
[Previous] [Next]
 NAME:
	set_page
 PURPOSE:
	Setup procedure for controlling output to plot device or graphics file
	The output procedure is completed by a call to get_page
 CALLING SEQUENCE:
	PRO set_page,	$
	    eps 	= eps	    , $
	    gif 	= gif	    , $
	    bmp 	= bmp	    , $
	    png 	= png	    , $
	    xysize	= xysize    , $
	    aspect	= aspect    , $
	    fullsize	= fullsize  , $
	    winaspect	= winaspect , $
	    landscape	= landscape , $
	    portrait	= portrait  , $
	    silent	= silent    , $
	    setup_only	= setup_only, $
	    file	= file	    , $
	    zbuffer	= zbuffer   , $
	    printer	= printer   , $
	    display	= display   , $
	    ctable	= ctable    , $
	    old_device	= old_device, $
	    new 	= new	    , $
	    bigsize	= bigsize   , $
	    xoff	= xoff	    , $
	    yoff	= yoff	    , $
	    smallsize	= smallsize , $
	    notwin	= notwin    , $
	    font	= font
 OPTIONAL INPUT PARAMETERS:
	The following keywords control the size and orientation of the output page.
	They only affect EPS, PS, HP or PRINTER devices (as keywords in the 'device'
	call). EPS is selected with the /eps keyword. PS, HP and PRINTER is used
	depending on !ThePrinter (initialized during startup).

	/landscape	plot in landscape mode
	/portrait	plot in portrait mode
			    If neither of these is set then /landscape is used
			    Only used to set up PS, EPS or default PRINTER.
	xysize=xysize	scalar, or array[2]; type: float
			    horizontal and vertical size of page (in cm for printer,
			    in pixel for display and z-buffer). If a scalar is
			    specified it is assumed to be the horizontal size
	/fullsize	overrides 'xysize' keyword. For the printer xysize is set
			    to the full page size, for other devices [!d.x_size,
			    !d.ysize] is used

			If xysize is not specified then default values are selected
			depending on whether /landscape of /portrait is used.
			If specified then aspect (or /winaspect) overrides either
			xsize of ysize to establish the proper aspect.

	aspect=aspect	scalar; type: float
			    aspect ratio (=ratio vertical/horizontal size
	/winaspect	same as: aspect = !d.y_size/!d.x_size
			    i.e. the aspect ratio of the active window is used
	/silent 	suppresses informational messages
	/setup_only	the command 'set_page, /setup, /silent' is used during
			    IDL_startup to set up the default printer. The plot
			    device is NOT changed, and !ThePlotFile is NOT set (i.e.
			    is set to the null string)

	/eps		sets the plot device to PS and opens an EPS file
			    !ThePlotFile is set to IDL.EPS or 'File'
	/gif		sets the plot device to !TheTerminal
			    !ThePlotFile is set to IDL.GIF or 'File'
	/png		sets the plot device to !TheTerminal
			    !ThePlotFile is set to IDL.PNG or 'File'
	/bmp		sets the plot device to !TheTerminal
			    !ThePlotFile is set to IDL.BMP or 'File'
	/zbuffer	NOT WORKING YET
 OUTPUTS:
	xysize=xysize	array[2]; type: integer
			    [!d.x_size, !d.y_size] on return
	old_device=old_device
			scalar; type: string
			    original graphics device (i.e. value of !d.name when
			    this procedure is called)
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	FILEPATH, GetFileSpec, InitVar, IsType, LOADCT, Reset_Colors, SetFileSpec, destroyvar
	do_file, twin
 CALLED BY:
	IDL_postop_linux, IDL_postop_vms, IDL_postop_win, even_light_corrections
	even_light_photometry, even_light_registration, qset_page_submit, show_wso
	smei_frm_summary, smei_hdr_plot, smei_sky, vu_earthskymap, vu_insitu, vu_planarcut
	vu_solardisk, vu_synopticmap
 SEE ALSO:
	qset_page
 PROCEDURE:
	Pretty darn ugly.
	The plot device is set to !ThePrinter, or PS (if /eps is set) or
	!TheTerminal (if /gif or /bmp are set).
	!ThePlotFile is always set. Unless argument 'File' is used
	the file name will be IDL.EPS, IDL.GIF or IDL.BMP (if /eps, /gif or /bmp are
	set) or IDL.HP, IDL.PS or IDL.PRINTER (depending on the value of
	!ThePrinter). Note that in the last case (IDL.PRINTER) no plot file is used
	since the output goes directly to the printer.
	For HP and PS the graphics output is collected in the output file, which is
	then send to the printer using get_page
 MODIFICATION HISTORY:
	MAR-1995, Paul Hick (UCSD/CASS)
	MAR-1998, Paul Hick (UCSD/CASS); added PRINTER device
	MAR-2000, Paul Hick (UCSD/CASS)
	    added /gif and /bmp keywords, updated documentation
	???-2002, Paul Hick (UCSD/CASS)
	    added /png keyword
	AUG-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    added /color to device call for EPS


SetFileSpec $SMEI/ucsd/gen/idl/toolbox/files/setfilespec.pro
[Previous] [Next]
 NAME:
	SetFileSpec
 PURPOSE:
	Split file names into file components.
	Optionally parse the file names.
 CATEGORY:
	gen/idl/toolbox/files
 CALLING SEQUENCE:
	PRO SetFileSpec, FileSpec, FileParts, $
	    parse   = Parse , $
	    nosave  = NoSave, $
	    strict  = strict, $
	    status  = Status
 INPUTS:
	FileSpec    string array or scalar, containing file names
		(read-only)
 OPTIONAL INPUT PARAMETERS:
	/parse	    if set, the file names are parsed.
		parsing is successful if
		- The directory exists
		- There is write access to the directory
		- The file name is valid (the file may or may not exist)
		  (if no file name is specified this step is skipped)
		If the parsing is succesful, missing file parts will
		be added to the FileParts array; if not all parts are
		set to the null string.
	/nosave     by default, the FileParts array returned as ouput
		is saved internally in a common block (which can
		be accessed with GetFileSpec and PutFileSpec).
		if nosave is set, the internal data are not overwritten.
	/strict     by default the file type is the part of the
		filename trailing the last dot, i.e. if the file name
		is file.txt.gz, the file type is .gz.
		If /strict is set the type becomes the part following
		the first dot, i.e. the type is .txt.gz.
 OUTPUTS:
	FileParts   string array with one dimension more than
		FileSpec; the extra first dimension has 6 elements,
		containing node, device, directory, name, type, version
		!!! the FileParts argument is sometimes useful in
		combination with the /nosave keyword. Preferably this
		argument should not be used; instead use GetFileSpec
		and PutFileSpec to manipulate the same information.
 OPTIONAL OUTPUT PARAMETERS:
	status=Status	long integer array with same dimensions as FileSpec.
		If keyword Parse set:
		  0 : indicates that parsing failed
		  1 : indicates that parsing was succesfull
		If keyword Parse not set, all values are set to 1
 CALLS: ***
	CheckDir, FILEPATH, FindAllFiles, InitVar, IsType, SyncDims, os_separator, strposn
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
	@filespec_common.pro	; Common block with arrays File and Parts
 CALLED BY:
	FindAllFiles, FindAllSubDirs, GetFileSpec, PutFileSpec, bin_read, bin_write, do_file
	findfile_fix, forecast_ftp, get_page, gunzip_file, makemovie, mk_flick, nso_fe_read
	qImage, qImage_Pick, qImage_cw_SmeiMask, qRemoteView_Pick, qSave2File_Save, qView
	qView_FileFilter, qView_PickFiles, qView_Save2File, qView_TMO_tracksky
	qset_page_pick, set_page, smei_buf, smei_frm_update, usno_body, vu_check
	vu_earthskymap, vu_extract, vu_get_page, vu_getdata, vu_header, vu_image, vu_insitu
	vu_movie, vu_quick_movie, vu_remoteview, vu_vox_write, www_help_crosslinks
	www_help_files, www_help_get_header, www_help_get_info
 SIDE EFFECTS:
	Internal data are maintained internally (a copy of FileParts)
 RESTRICTIONS:
	FileSpec containing relative directory specifications
	(e.g. [], [-] on VMS, or . and .. on Win32 and Unix), cause
	problems for GetFileSpec. If these are present, then /parse
	should be used to remove them.
 PROCEDURE:
 >	Parsing: the existence check for the directory is done using CheckDir.
	The fully-parsed directory returned by CheckDir is used, so the parse
	keyword can be used to expand environment variables, e.g.
	    SetFileSpec, '$dat/tmo/*.nic', /parse
	    print, GetFileSpec()
	would print (provided the directory exists):
	    /big/oftp/dat/tmo/*.nic
 > If a wildcard is specified in the file name then only the directory
	is parsed.
 >  For an existing file the full file name is obtained using FindAllFiles.
   If the file does not exist, an attempt is made to open
	the file with OPENW to establish that the syntax is valid;
	FindAllFiles is used to obtain the full file name before closing and
	deleting the file again.
 >	The filenames are split up into parts by a series of strposn calls
 >	FileSpec='' (null string) is interpreted as the current working directory,
	and will always return status=1.
 MODIFICATION HISTORY:
	DEC-1997, Paul Hick (UCSD/CASS)
	FEB-2002, Paul Hick (UCSD/CASS)
	    Remove bug which caused problems when multidimensional arrays
	    of filenames were processed.
	JAN-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    If a wildcard (*) is specified in the filename part then only the
	    directory is checked when the /parse keyword is set.


SetRange $SMEI/ucsd/gen/idl/toolbox/setrange.pro
[Previous] [Next]
 NAME:
	SetRange
 PURPOSE:
	Set range of values, checking against a default range
 CATEGORY:
	Tricks
 CALLING SEQUENCE:
	new = SetRange(default, range [, /lower_limit])
 INPUTS:
	default 	array[2]; type: any
			    upper and lower limits on allowed values
 OPTIONAL INPUT PARAMETERS:
	range		scalar or array[2]
			    range to be checked against 'default'
	/lower_limit	if set then a scalar 'range' is interpreted as
			a lower limit (default is upper limit)
 OUTPUTS:
	new		array[2]
			    updated range of values
			    if 'range' undefined then 'new' is set to 'default'
			    if 'range' is scalar then new = [range,default[1]] is
			    returned (/lower_limit is set), or new = [default[0],range[1]]
			    is returned (/lower_limit not set
			    Always 'range' is constrained to stay inside the limits set by 'default'
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	InitVar
 CALLED BY:
	RemoteView_rgbo
 PROCEDURE:
	Trivial
 MODIFICATION HISTORY:
	JUN-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


setup3d $SMEI/ucsd/sat/idl/toolbox/tricks/setup3d.pro
[Previous] [Next]
 NAME:
	setup3d
 PURPOSE:
	Sets up scaling (!x.s, !y.s, !z.s) and transformation matrix (!p.t)
 CATEGORY:
 CALLING SEQUENCE:
	setup3d, d0, d1, n0, n1 [, /rotate, /oblique]
	setup3d, d0, d1, n0, n1 [, rotate=[[a,b,c],[d,e,f]], oblique=[p,q] ]
 INPUTS:
	d0	scalar or array[3]; default: -1.5*[1,1,1]
	d1	scalar or array[3]; default:  1.5*[1,1,1]
		    begin and end of data coordinate range
		    scalars are interpreted as scalar*[1,1,1]
	n0	scalar or array[3]; default:  0.0*[1,1,1]
	n1	scalar or array[3]; default:  1.0*[1,1,1]
		    begin and end of normal coordinate range
		    scalars are interpreted as scalar*[1,1,1]

		!x.s, !y.s and !z.s are set up to map data ranges [d0,d1] to normal ranges [n0,n1]
 OPTIONAL INPUT PARAMETERS:
	rotate=rotate
		array[3,n] or array[3*n]; type: float
		    The special form /rotate is identical to rotate=[ [ 0.,-20.,0.], [20., 0. ,0.] ]
		    Set of rotations to be set up in !p.t matrix
		    rotations are processed left to right; rotate[0,*], rotate[1,*] and rotate[2,*]
		    are rotations around x,y and z-axis respectively
	oblique=oblique
		array[2]; type: float
		    The special form /oblique is identical to oblique=[.4,-125]
		    Parameters for an oblique projection
	/xyplane    Puts x-y plane in plane of screen
	/yzplane    Pust y-z plane in plane of screen
	/xzplane    Puts x-z plane in plane of screen
 OUTPUTS:
	Sets !x.s, !y.s, !z.s and !p.t
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	T3D, t3d_oblique
 CALLED BY:
	PlotPlanarCut, PlotSolarDisk, RemoteView_PlotVertices, even_light_figures
	qvu_draw
 RESTRICTIONS:
 PROCEDURE:
	!p.t is first reset. Then clockwise rotations around y and z-axis over 90 degrees are
	executed to point the x-axis perpendicular to the screen, the y-axis pointing right and the
	z-axis pointing up in the plane of the screen.
	After that the rotations supplied as keywords are applied, followed by the oblique projection.
 MODIFICATION HISTORY:
	AUG-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


sgp4_eph $SMEI/ucsd/gen/idl/ephem/sgp4_eph.pro
[Previous] [Next]
 NAME:
	sgp4_eph
 PURPOSE:
	Get location of Coriolis spacecraft in ECI coordinates
	(at current epoch; see Procedure).
 CATEGORY:
	gen/idl/ephem
 CALLING SEQUENCE:
	FUNCTION sgp4_eph, tt_obs, body_, km=km,    $
	    location=location, source=source, precess=precess
 INPUTS:
	tt_obs		array[n]; type: time structure
			    UT time
 OPTIONAL INPUTS:
	body_		scalar; type: string; default: 'sat27640'
			    spacecraft designation
			    The default sat27640 is Coriolis.
	km=km		if set, return distance in km instead of AU
	source=source	scalar; type: string; default: who_am_i(/dir)/sgp
			    directory where TLE file is located (by default the
			    subdir sgp of the dir where this file is located.
	/precess	precess position and velocity vector to J2000 coordinates
			    (used by big_eph)
 OUTPUTS:
	rr[6,n] 	location and velocity
			    if /location is set only r[0:2,n] is returned
			    if the required file with TLEs is not found
			    then the output vector contains NaNs.
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	ArrayLocation, BadValue, CvPrecess, FILEPATH, InitVar, SuperArray, TimeFixYear
	TimeLimits, TimeOp, TimeSet, TimeUnit, hide_env, sgp_alias, txt_read, who_am_i
 CALLED BY:
	big_eph, smei_frm_cvhdr, smei_frm_where, smei_sgp4_orbits, smei_sgp4_quat
 PROCEDURE:
	The file with orbital elements is 'body.txt' i.e. sat27640.txt for
	Coriolis. The file is looked for in the subdirectory sgp of the
	directory where this source code is located. Used keyword 'source'
	to point to another subdirectory.
	Orbital elements can be retrieved from www.space-track.org

	Excerpt from http://celestrak.com/columns/v02n01/:

	"As it turns out, the NORAD SGP4 orbital model takes the standard
	two-line orbital element set and the time and produces an ECI
	position and velocity for the satellite. In particular, it puts it
	in an ECI frame relative to the "true equator and mean equinox of
	the epoch" of the element set. This specific distinction is
	necessary because the direction of the Earth's true rotation axis
	(the North Pole) wanders slowly over time, as does the true direction
	of the vernal equinox. Since observations of satellites are made
	by stations fixed to the Earth's surface, the elements generated
	will be referenced relative to the true equator. However, since the
	direction of vernal equinox is not tied to the Earth's surface, but
	rather to the Earth's orientation in space, an approximation must
	be made of its true direction. The approximation made in this case is
	to account for the precession of the vernal equinox but to ignore the
	nutation (nodding) of the Earth's obliquity (the angle between the
	equatorial plane and the ecliptic)."
 MODIFICATION HISTORY:
	MAR-2005, Paul Hick (UCSD/CASS)
	SEP-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Reduced memory requirements by extracting TLE bracketing the
	    input time range tt_obs


sgp4_orbit_period $SMEI/ucsd/gen/idl/ephem/sgp4_orbit_period.pro
[Previous] [Next]
 NAME:
	sgp4_orbit_period
 PURPOSE:
 CATEGORY:
 CALLING SEQUENCE:
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
 OUTPUTS:
 OPTIONAL OUTPUT PARAMETERS:
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 EXTERNAL:
 CALLS: ***
	BadValue, SyncArgs, sgp4_tlm
 CALLED BY:
	smei_sgp4_orbits
 PROCEDURE:
 MODIFICATION HISTORY:
	JUNE-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


sgp4_tlm $SMEI/ucsd/gen/idl/ephem/sgp4_tlm.pro
[Previous] [Next]
 NAME:
	sgp4_tlm
 PURPOSE:
	Extract orbital elements covering bracketing tt_obs from
	tlm data base file
 CATEGORY:
	gen/idl/ephem
 CALLING SEQUENCE:
	status = sgp4_tlm(tt_obs,body_,source=source,tlm=tlm,tt_tlm=tt_tlm)
 INPUTS:
	tt_obs		array[n]; type: time structure
			    UT time
 OPTIONAL INPUTS:
	body_		scalar; type: string; default: 'sat27640'
			    spacecraft designation
			    The default sat27640 is Coriolis.
	source=source	scalar; type: string; default: who_am_i(/dir)/sgp
			    directory where TLE file is located (by default the
			    subdir sgp of the dir where this file is located.
 OUTPUTS:
	status		scalar; type: integer
			    0: the ephemeris find is not found or there
				is a read error. In this case tlm and tt_tlm
				won't exist
			    1: tlms found
	tlm=tlm 	array[2,ntlm]; type: string
			    tlm (each tlm consists of two records)
			    the tlms will bracket the input time period tt_obs
	tt_tlm		array[ntlm]; type: time structure
			    times extracted from tlm records
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	ArrayLocation, FILEPATH, InitVar, SuperArray, TimeFixYear, TimeLimits, TimeOp, TimeSet
	TimeUnit, hide_env, sgp_alias, txt_read, who_am_i
 CALLED BY:
	sgp4_orbit_period
 PROCEDURE:
	The file with orbital elements is 'body.txt' i.e. sat27640.txt for
	Coriolis. The file is looked for in the subdirectory sgp of the
	directory where this source code is located. Used keyword 'source'
	to point to another subdirectory.
	Orbital elements can be retrieved from www.space-track.org
 MODIFICATION HISTORY:
	DEC-2005, Paul Hick (UCSD/CASS)
	    Extracted from sgp4_eph


sgp_alias $SMEI/ucsd/gen/idl/ephem/sgp_alias.pro
[Previous] [Next]
 NAME:
	sgp_alias
 PURPOSE:
	Translates aliases for satellite names to their sgp names
 CATEGORY:
	gen/idl/ephem
 CALLING SEQUENCE:
	name = alias_sgp(body)
 INPUTS:
	body	    array: type: string
			alias for satellite name
 OUTPUTS:
	name	    array: type: string
			sgp name for satellite
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLED BY:
	big_body, big_eph, sgp4_eph, sgp4_tlm
 PROCEDURE:
	Currently only aliases 'coriolis','windsat' and 'smei' are
	converted to sgp name 'sat2740'
 MODIFICATION HISTORY:
	JUN-2006, Paul Hick (UCSD/CASS)
	SEP-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Bugfix? Unidentified bodies would be returned in lowercase.
	    Now they remain untouched.


sgp_body $SMEI/ucsd/gen/idl/ephem/sgp_body.pro
[Previous] [Next]
 NAME:
	sgp_body
 PURPOSE:
	Get list of bodies for which SGP ephemerides are available
 CATEGORY:
	smei/gen/idl/ephem
 CALLING SEQUENCE:
	sgp_nams = sgp_body([body, files=files, numbers=numbers, count=count])
 OPTIONAL INPUT PARAMETERS:
	body	    scalar or array; type: integer or string
			    integer: list of body numbers
			    string : list of body names
				only valid entries on this list are processed
				If not specified then all bodies are processed
 OUTPUTS:
	names		array[count]; type: string
			    list of body names for which ephemeris files
			    are available; if none exist (count=0) then names=''
 OPTIONAL OUTPUT PARAMETERS:
	count=count	scalar; type: integer
			    # requested bodies for which ephemeris files are present
			    i.e. # elements in input 'body' with invalid entries removed
	file=file	array[count]; type: string
			    file names of the ephemeris files; null-string if count=0
	number=number	array[count]; type: integer
			    body numbers; -1 if count=0
	index=index	array[count]; type: integer
			    index numbers between 0, and total_count-1; -1 if count=0
	total_count=total_count
			scalar; type: integer
			    total # bodies for which ephemeris files are present
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	FILEPATH, GetFileSpec, IsType, hide_env, where_common, who_am_i
 CALLED BY:
	RemoteView_BodyLoc, big_body, big_eph
 PROCEDURE:
 >	Currently only 9P/Tempel (comet Tempel 1 around 'deep impact' time) is available
 >	The SGP files are searched for in the subdirectory 'sgp' of the directory
	where this procedure is located.
 MODIFICATION HISTORY:
	JUL-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Based on usno_body()


show_wso $SMEI/user/phick/pro/show_wso.pro
[Previous] [Next]
 NAME:
	show_wso
 PURPOSE:
 CALLS: ***
	FILEPATH, InitVar, PlotSynopticMap, SuperArray, WhatIs, get_page, gridgen, set_page
	view, wso_read
 MODIFICATION HISTORY:


skyd_cat $SMEI/ucsd/camera/idl/toolbox/skyd_cat.pro
[Previous] [Next]
 NAME:
	skyd_cat
 PURPOSE:
	Creates the initial orbit catalogues needed by the
	SMEI skyd daemon.
 CALLING SEQUENCE:
	PRO skyd_cat, $
	    camera	= camera    , $
	    mode	= mode	    , $
	    source	= source    , $
	    dig 	= dig	    , $
	    destination = destination,$
	    smeidb	= smeidb    , $
	    full_count	= full_count, $
	    keepskip	= keepskip
 OPTIONAL INPUTS:
	camera=camera	    array or scalar; type: integer; default: [1,2,3]
				SMEI cameras to be processed
	mode=mode	    array or scaler; type: integer; default: [0,1,2]
				modes to be processed
	source=source	    scalar or array; type: string; default: SMEISKY?
				list of directories with skymaps.
				The default SMEISKY? is translated to all
				directories assigned to env vars $SMEISKYn
	/dig		    If /dig is set then the skymaps should be located
				in subdirectories c1,c2,c3.
				IF source=SMEISKY? then always /dig is assumed
	destination=destination
			    scalar; type: string; default: $TUB
				destination directory for the skyd catalogues
	/smeidb 	    forces destination=$SMEIDB/cat/list
				(see PROCEDURE)
	/full_count	    by default the sky catalogues are based on the frame
			    counts for frames satisfying the default conditions
			    used by smeidb_sky for frame selection (not a "just-bad"
			    frame, good quaternion, shutter open and base OK;
			    this is the second set of 4 columns in
			    the smei_frm_orb_m<mode>.txt files).
			    If full_count is set then the unrestricted counts for
			    all frames per orbit (the first set of 4 columns in the
			    smei_frm_orb_m<mode>.txt files) is used.
	/keepskip	    by default, orbits marked 'skip' are not written
			    into the catalogue files. Set /keepskip to override.
 INCLUDE:
	@compile_opt.pro
 CALLS: ***
	CheckDir, FILEPATH, FXPAR, FindAllFiles, GetFileSpec, HEADFITS, InitVar, TimeGet
	TimeSet, TimeUnit, boost, destroyvar, flt_string, hide_env, timeposn, txt_read
 PROCEDURE:
	The skyd catalogues are derived from the files
	smei_frm_orb_m0.txt, smei_frm_orb_m1.txt and smei_frm_orb_m2.txt
	in directory $SMEIDB/cat/list. These files list the numbers
	of frames for each camera in each of three modes.
	These files are created and maintained by the IDL procedure
	smei_orbits_stat (through a daily cronjob).

	The skyd_catalogues will have names skyd_c<cam>m<mode>.txt
	where <cam> is the camera id (1,2,3) and <mode> the mode id
	<0,1,2>. The files are written to directory 'destination'.
	If /smeidb is set the destination directory is the same
	as for the smei_frm_orb_m*.txt files ($SMEIDB/cat/list).
	These catalogues are accessed by the Python script
	skyd_orbit (which in turn is used by the SMEI
	skyd daemon skyd_wait.
 MODIFICATION HISTORY:
	DEC-2005, Paul Hick (UCSD/CASS)
	MAR-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added keyword /full_count


skyd_equ $SMEI/ucsd/camera/idl/toolbox/skyd_equ.pro
[Previous] [Next]
 NAME:
	skyd_equ
 PURPOSE:
	Creates the initial orbit catalogues needed by the
	SMEI skyd daemon.
 CALLING SEQUENCE:
	PRO skyd_equ, $
	    camera	= camera    , $
	    destination = destination,$
	    smeidb	= smeidb    , $
	    full_count	= full_count, $
	    keepskip	= keepskip
 OPTIONAL INPUTS:
	camera=camera	    array or scalar; type: integer; default: [1,2,3]
				SMEI cameras to be processed
	destination=destination
			    scalar; type: string; default: $TUB
				destination directory for the skyd_equ catalogues
	/smeidb 	    forces destination=$SMEIDB/cat/list
				(see PROCEDURE)
	/keepskip	    by default, orbits marked 'skip' are not written
			    into the catalogue files. Set /keepskip to override.
 INCLUDE:
	@compile_opt.pro
 CALLS: ***
	CheckDir, FILEPATH, FXPAR, FindAllFiles, GetFileSpec, HEADFITS, InitVar, REVERSE, SFLOAT
	TimeGet, TimeSet, TimeUnit, boost, hide_env, smei_coriolis, smei_star_readpnt
	timeposn, txt_read, where_common
 PROCEDURE:
	The skyd_equ catalogues are derived from the content of
	directories ....

	The skyd_catalogues will have names skyd_c<cam>m<mode>.txt
	where <cam> is the camera id (1,2,3) and <mode> the mode id
	<0,1,2>. The files are written to directory 'destination'.
	If /smeidb is set the destination directory is the same
	as for the smei_frm_orb_m*.txt files ($SMEIDB/cat/list).
	These catalogues are accessed by the Python script
	skyd_orbit (which in turn is used by the SMEI
	skyd daemon skyd_wait.
 MODIFICATION HISTORY:
	DEC-2005, Paul Hick (UCSD/CASS)
	MAR-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added keyword /full_count


skyd_pass2make $SMEI/sys/skyd/skyd_pass2make.pro
[Previous] [Next]
 NAME:
	skyd_pass2make
 PURPOSE:
	Runs through SKYD orbit catalogues to replace
	orbits marked "pass" back to "make"
 CATEGORY:
	skyd
 CALLING SEQUENCE:
	PRO skyd_pass2make
 INPUTS:
 OUTPUTS:
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	destroyvar, txt_read
 PROCEDURE:
 MODIFICATION HISTORY:
	DEC-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


skyd_version $SMEI/ucsd/camera/idl/toolbox/skyd_version.pro
[Previous] [Next]
 NAME:
	skyd_version
 PURPOSE:
	Creates catalogue with software version numbers used
	to create skymap database
 CALLING SEQUENCE:
	PRO skyd_version, $
	    camera	= camera    , $
	    destination = destination,$
	    smeidb	= smeidb
 OPTIONAL INPUTS:
	camera=camera	    array or scalar; type: integer; default: [1,2,3]
				SMEI cameras to be processed
	destination=destination
			    scalar; type: string; default: $TUB
				destination directory for the skyd_equ catalogues
	/smeidb 	    forces destination=$SMEIDB/cat/list
				(see PROCEDURE)
 INCLUDE:
	@compile_opt.pro
 CALLS: ***
	CheckDir, FILEPATH, FXPAR, HEADFITS, InitVar, SFLOAT, TimeGet, TimeSet, TimeUnit, hide_env
	smei_getfile, smei_star_readpnt
 PROCEDURE:
 MODIFICATION HISTORY:
	JUN-2008, Paul Hick (UCSD/CASS)


smei_base_testcase $SMEI/ucsd/camera/idl/toolbox/smei_base_testcase.pro
[Previous] [Next]
 NAME:
	smei_base_testcase
 PURPOSE:
	Runs test case for smei_base program and validates results
 CATEGORY:
	camera/idl/toolbox
 CALLING SEQUENCE:
	PRO smei_base_testcase, make=make, db=db, keep=keep,	$
	    source=source, digsource=digsource
 OPTIONAL INPUT PARAMETERS:
	/make	    if set, the testcase results are regenerated
	source=source	passed to smei_base
	/digsource  passed to smei_base
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	CheckDir, FILEPATH, FindAllFiles, GetFileSpec, InitVar, IsType, TimeGet, TimeOp, TimeSet
	TimeUnit, flt_string, smei_getfile, smei_property, txt_read, who_am_i
 PROCEDURE:
	The testcase results are stored in an ASCII file in the
	same directory as this procedure (smei_base_testcase.txt).
	The file contains frame names and values for pedestal and
	dark current.

	The executable smei_base is run for all frames in the testcase.
	Resulting Fits frames are written to $TUB/smei_base_testcase.
	These files are cleaned up afterward.

	Differences between pedestal and dark current should be at
	the single precision level.
 MODIFICATION HISTORY:
	DEC-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_buf $SMEI/ucsd/camera/idl/buf/smei_buf.pro
[Previous] [Next]
 NAME:
	smei_buf
 PURPOSE:
	Main procedure for processing l1a files
 CATEGORY:
	camera/idl/buf
 CALLING SEQUENCE:
	PRO smei_buf, tmp_list
 INPUTS:
	tmp_list	scalar; type: string; default: $TUB/l1a_list.txt
			    name of ascii file created by Python script l1a.py
			    (the file will be deleted after it has been read)
 OUTPUTS:
	.nic files to $dat/smei/nic
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	CheckDir, FILEPATH, GetFileSpec, InitVar, SetFileSpec, TimeGet, TimeOp, TimeSystem
	TimeUnit, do_file, hide_env, smei_buf_get, smei_buf_getframe, smei_buf_mget
	txt_read
 PROCEDURE:
 >	This procedure is accessed primarily through the Python script
	l1a.py, which creates the main IDL main program and the input
	file 'tmp_list'.
 >	All frames are extracted from the specified list of *.buf files
	and written to disk as *.nic files.
 MODIFICATION HISTORY:
	MAR-2003, Paul Hick (UCSD/CASS)
	FEB-2004, Paul Hick (UCSD/CASS)
	    Added option for 'noclones' check.
	    Added option to move processed L1A files to other directory
	MAR-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added option to allow writing of Fits files and Nic files.


smei_buf_get $SMEI/ucsd/camera/idl/buf/smei_buf_get.pro
[Previous] [Next]
 NAME:
	smei_buf_get
 PURPOSE:
	Extracts data area for specified frames
 CATEGORY:
	camera/idl/buf
 CALLING SEQUENCE:
	PRO smei_buf_get, frame_headers, source=source, destination=destination,    $
	    nic=nic, fits=fits, ptr_data=ptr_data, gzip=gzip,	    $
	    trange=trange, count=count, silent=silent, _extra=_extra
 INPUTS:
	frame_headers	array; type: smei_frm_hdr structure
			    frame header array (as returned by smei_buf_getframe)
 OPTIONAL INPUT PARAMETERS:
	trange=trange	array[n]; type: time structure
			    time info for tracking down SMEI frames.
			    See smei_buf_getframe for more information.
	source=source	scalar; type: string; default: /media/cdrecorder
			    directory where the L1A files are located.
			    If trange is used this is passed to smei_buf_getframe.
			    If frame_headers is specified than this is added to
			    frame_headers.l1a_file (which does not include a
			    directory).
	destination=destination
			scalar; type: string
			    directory into which to write the individual frame files
			    Output files have form c#frm_YYYY_DDD_HHMMSS (for padded
			    frames) or c#roi_YYYY_DDD_HHMMSS (for unpadded ROI
			    frames). # is the camera number (1,2 or 3).
	/nic		if set (and a valid destination is specified) then frame are
			    written in NIC file format (i.e. the data are stored in
			    the same way as for the TMO data, but the trailer has
			    a totally different structure)
	/fits		if set (and a valid destination is specified) then a fits
			    file is written
			    (at this point the frame headers are not written into
			    the fits file.
	/split_dir	if writing out lots and lots of frames it is probably better
			    to distribute the frames over multiple directories.
			    If /split_dir is set then each day of data is split in
			    4-hour intervals over 6 directories with names
			    destination/YYYY_DDD/HH with HH=00,04,08,12,16,20
	If the output keyword ptr_data is set, and /nic, /fits are not set
	then the frame data ar returned as a heap variable.

	/overwrite	    will unconditionally overwrite existing files when
			    writing individual frames to disk
	/gzip		    gzip directories
 OPTIONAL OUTPUT PARAMETERS:
	count=count	    # frames found

	ptr_data=ptr_data
			array; type: pointer
			    the frame data corresponding to 'hdr'
			    i.e. *ptr_data[i] is the 2D frame data array.
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	CheckDir, FILEPATH, InitVar, IsTime, IsType, TimeGet, TimeSet, TimeUnit, hide_env
	smei_buf_getframe, smei_buf_gzip, smei_buf_prep, smei_buf_read, smei_frm_write
	smei_property, smei_setup_roi, txt_read
 CALLED BY:
	smei_buf
 EXAMPLE:
	The most efficient way to replace a damaged frame in the SMEI database from a DVD
	is the following command:
	    smei_buf_get, timeset('2005_006_160819'), cam=2, /fits, dest=getenv('TUB'), /usedb
	This requires that the proper DVD is mounted on /media/cdrecorder (specify
	source=<source> to override the default) and that the SMEI database is accessible.
	Note: dest='SMEIDB?' will NOT work.
 PROCEDURE:
	If either /fits or /nic is set then data are saved to binary files in
	the destination directory (no pointer data will be returned).

	File names will have the form c#frm_YYYY_DDD_HHMMSS.ext:
	#   = camera id (1,2 or 3)
	ext = 'fts' or 'nic'

	If neither /nic nor /fits is specified then data can be extracted in
	ptr_data.

	/fits SET:

	Writes bare fits file (no extra frame header info is put in the file yet,
	just the data are stored).

	/nic SET (obsolete; we don't use .nic files anymore):

	A 512 byte trailer is added after the data array.
	The first 3 bytes are the characters 'buf' (to distinguish these
	files from e.g. the TMO data files). The next 256 is the unmodified
	header from the original frame (except for byte swapping to put the
	data in native machine format.

 MODIFICATION HISTORY:
	MAR-2003, Paul Hick (UCSD/CASS)
	MAY-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Changed default source from /media/cdrecorder to /media/CDROM


smei_buf_getframe $SMEI/ucsd/camera/idl/buf/smei_buf_getframe.pro
[Previous] [Next]
 NAME:
	smei_buf_getframe
 PURPOSE:
	Extracts individual frames from all *.buf files in the specified
	source directory.
 CATEGORY:
	camera/idl/buf
 CALLING SEQUENCE:
	FUNCTION smei_buf_getframe, trange, $
	    source  = source	, $
	    camera  = camera	, $
	    count   = count	, $
	    dups_too= dups_too	, $
	    usedb   = usedb	, $
	    silent  = silent
 INPUTS:
	trange		array[n]; type: time structure
			    n=0: if not specified than all frames in all L1A files in
				    'source' are extracted.
			    n=1: extract frame for specified time
			    n=2: extract all frames between trange[0] and trange[1]
			    n>2: extract frames for specified times
 OPTIONAL INPUT PARAMETERS:
	source=source	scalar, array; type: string
			    scalar: source directory containing L1A *.buf files
			    array : list of fully-qualified names of L1A files
	camera=camera	scalar, array[2], array[3]
			    numbers 1, 2, or 3, identifying the cameras to be extracted
			    if 'camera' not set then all cameras are extracted.
	/usedb		if set then an attempt is made to find a file pointer in the
			    first L1A file to be accessed close to trange[0] (by
			    looking for nearby frames in the SMEI data base).
			    (this is primarily used to replace corrupted frames in the
			    SMEI data base).
 OUTPUTS:
	hdr	    array; type: smei_frm_hdr structure
 OPTIONAL OUTPUT PARAMETERS:
	count=count	scalar; type: integer
			    # frames returned in 'hdr'
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	CheckDir, FindAllFiles, GetFileSpec, InitVar, IsTime, IsType, TimeGet, TimeLimits
	TimeOp, TimeSet, TimeUnit, UNIQ, boost, destroyvar, smei_buf_read, smei_getfile
	smei_property, where_common
 EXTERNAL:
	smei_buf_hdr__define, smei_frm_hdr__define
 CALLED BY:
	smei_buf, smei_buf_get
 PROCEDURE:
	Frame headers are stored in the same order as they are read from the
	L1A files, i.e. there will be contiguous groups of frames from each
	L1A files. Each L1A file appears to be chronological, but subsequent
	files overlap (because of the double dump?). As a result the frame
	header array as a whole (from more than one L1A file) is probably not
	chronological.
 MODIFICATION HISTORY:
	MAR-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_buf_gzip $SMEI/ucsd/camera/idl/buf/smei_buf_gzip.pro
[Previous] [Next]
 NAME:
	smei_buf_gzip
 PURPOSE:
	Controls gzipping of new frames in SMEI data base.
 CATEGORY:
	camera/idl/buf
 CALLING SEQUENCE:
	PRO smei_buf_gzip, last_dir, need_gzip
 INPUTS:
	need_gzip	scalar; type: integer
			    # frames to be gzipped
	last_dir	scalar; type: string
			    name of directory to be gzipped
 OUTPUTS:
	need_gzip	scalar; type: integer
			    reset to zero
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	IsType, hide_env
 CALLED BY:
	smei_buf_get, smei_buf_mget, smei_buf_prep
 PROCEDURE:
 MODIFICATION HISTORY:
	OCT-2004, Paul Hick (UCSD/CASS)


smei_buf_hdr__define $SMEI/ucsd/camera/idl/buf/smei_buf_hdr__define.pro
[Previous] [Next]
 NAME:
	smei_buf_hdr__define
 PURPOSE:
	Structure definition for file header of SMEI .buf files
 CATEGORY:
	camera/idl/buf
 CALLING SEQUENCE:
	hdr = {smei_buf_hdr}
 INPUTS:
	(none)
 OUTPUTS:
	(none)
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 EXTERNAL BY:
	smei_buf_getframe, smei_buf_splitfile
 PROCEDURE:
	See Don Mizuno's, SMEI_CONVERT memo
 MODIFICATION HISTORY:
	MAR-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_buf_mget $SMEI/ucsd/camera/idl/buf/smei_buf_mget.pro
[Previous] [Next]
 NAME:
	smei_buf_mget
 PURPOSE:
	Extracts all frames from specified l1a_files
 CATEGORY:
	camera/idl/buf
 CALLING SEQUENCE:
	PRO smei_buf_mget, l1a_files, destination=destination, nic=nic, fits=fits,  $
	    _extra=_extra, nowrite=nowrite, gzip=gzip, silent=silent
 INPUTS:
	l1a_files	array; type: string
			    fully-qualified names of l1a_files
 OPTIONAL INPUT PARAMETERS:
	destination=destination
			scalar; type: string
			    directory into which to write the individual frame files
			    Output files have form c#frm_YYYY_DDD_HHMMSS (for padded
			    frames) or c#roi_YYYY_DDD_HHMMSS (for unpadded ROI
			    frames). # is the camera number (1,2 or 3).
	/nic		if set (and a valid destination is specified) then frame are
			    written in NIC file format (i.e. the data are stored in
			    the same way as for the TMO data, but the trailer has
			    a totally different structure)
	/fits		if set (and a valid destination is specified) then a fits
			    file is written
			    (at this point the frame headers are not written into
			    the fits file.
	/split_dir	if writing out lots and lots of frames it is probably better
			    to distribute the frames over multiple directories.
			    If /split_dir is set then each day of data is split in
			    4-hour intervals over 6 directories with names
			    destination/YYYY_DDD/HH with HH=00,04,08,12,16,20

	/overwrite	    if set existing frames are overwritten
			    (passed to smei_buf_prep)
 OPTIONAL OUTPUT PARAMETERS:
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLED BY:
	smei_buf
 SEE ALSO:
	smei_buf_get, smei_buf_getframe
 CALLS: ***
	CheckDir, InitVar, IsType, hide_env, smei_buf_gzip, smei_buf_prep, smei_buf_read
	smei_frm_write, smei_property, smei_setup_roi
 PROCEDURE:
	This is a faster alternative to smei_buf_get. It processes all
	l1a_files in sequence and extracts/writes to disk all frame data.

	If either /nic of /fits is set then data are saved to binary files in
	the destination directory (no pointer data will be returned).

	File names will have the form c#frm_YYYY_DDD_HHMMSS.ext:
	#   = camera id (1,2 or 3)
	ext = 'nic' or 'fts'

	/nic SET:

	A 512 byte trailer is added after the data array.
	The first 3 bytes are the characters 'buf' (to distinguish these
	files from e.g. the TMO data files). The next 256 is the unmodified
	header from the original frame (except for byte swapping to put the
	data in native machine format.

	/fits SET:

	STILL NEEDS WORK
	Writes bare fits file (no extra frame header info is put in the file yet,
	just the data are stored).
 MODIFICATION HISTORY:
	APR-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_buf_prep $SMEI/ucsd/camera/idl/buf/smei_buf_prep.pro
[Previous] [Next]
 NAME:
	smei_buf_prep
 PURPOSE:
	Decide whether a frame extracted from an L1A file needs to be
	written to disk.
 CATEGORY:
	camera/idl/buf
 CALLING SEQUENCE:
	FUNCTION smei_buf_prep, hdri, destination, $
	    nic 	= nic	    , $
	    fits	= fits	    , $
	    last_dir	= last_dir  , $
	    filelist	= filelist  , $
	    split_dir	= split_dir , $
	    overwrite	= overwrite , $
	    count	= count     , $
	    last_time	= last_time , $
	    noclones	= noclones  , $
	    comment	= comment   , $
	    gzip	= gzip	    , $
	    need_gzip	= need_gzip
 INPUTS:
	hdri		array[1]; type: frame header structure
			    frame header
	destination	scalar; type: string
			    name of existing directory where to write the file

			    If split_dir is NOT set then frames will be written
			    directly to 'destination'
			    If split_dir is SET then files are written into subdirectories
			    destination/year_doy/c1, destination/year_doy/c2 or
			    destination/year_doy/c3
	count		array[4]; type: integer
			    Counters to be updated.
 OPTIONAL INPUT PARAMETERS:
	/nic		write nic file
	/fits		write fits file

	/split_dir	if writing out lots and lots of frames it is probably better
			    to distribute the frames over multiple directories.
			    If /split_dir is set then each day of data is split in
			    4-hour intervals over 6 directories with names
			    destination/YYYY_DDD/HH with HH=00,04,08,12,16,20
	/overwrite	by default frames are not written to drive if a file for
			    the frame already exists, UNLESS the new frame was from
			    the 1st telemetry dump. Set this keyword to
			    unconditionally overwrite existing files.
			    (setting -overwrite speeds up processing by a factor 2).

	count		array[4]; type: integer
			    The count array MUST EXIST on input for updates to
			    occur. One or more of the counters are incremented by 1.
			    count[0]: # frames written to disk as .nic or .fts
				file (updated in smei_frm_write)
			    count[1]: # frames skipped because file already exists
				(updated here)
			    count[2]: # frames with times earlier than the most
				recent frame (updated here) that are written to
				disk (these should be frames from the second dump;
				if the second dump contains the same frames as the
				first the number of these frames should be small)
			    count[3]: # clone frames (updated here)
	last_time	array[1]; type: time structure
			    time of most recent frame processed
 OUTPUTS:
	filename	scalar; type: string
			    fully-qualified file name to be used for output file.
			    If /overwrite is NOT set and the file exists already
			    then the null-string is returned.
	count		array[3]; type: integer
			    updated file counters
	last_time	array[1]; type: time structure
			    updated frame time
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLED BY:
	smei_buf_get, smei_buf_mget
 COMMON BLOCKS:
	common save_three_clones, last_hdrs, last
	common save_double_dump , overlap_on, overlap_l1a, first_dump
 CALLS: ***
	CheckDir, FILEPATH, InitVar, IsType, TimeGet, TimeLimits, TimeOp, TimeUnit, UNIQ, boost
	destroyvar, hide_env, smei_buf_gzip, smei_filename, smei_filepath, smei_frm_read
	smei_property
 RESTRICTIONS:
	If /split_dir is set then a 'mkdir --parents' is spawned to to create
	subdirectories, and gzip is spawned to compress files. This works in
	Linux, but not in Windows without some modifications.
 PROCEDURE:
 MODIFICATION HISTORY:
	MAR-2003, Paul Hick (UCSD/CASS)
	MAY-2003, Paul Hick (UCSD/CASS)
	    If /overwrite is NOT and a frame exists already the telemetry times are
	    compared. If the new frame is earlier than the one already on disk,
	    then it is still overwritten.
	    This determination is made from the name of the original telemetry file
	    which is stored in the frame header.
	JUL-2003, Paul Hick (UCSD/CASS)
	    Force overwrite if there is read error on an existing .nic file.
	FEB-2004, Paul Hick (UCSD/CASS)
	    Added /noclones keyword
	    Added new code to deal with double dump frames. Should reduce disk I/O
	    considerably.
	AUG-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Introduced error handler bracketing calls to smei_property(hdr,/tlm_time).
	    Occasionally the tlm_file name is screwy enough to crash
	    smei_property. If this happens continue assuming that the new frame
	    is from a second dump.


smei_buf_read $SMEI/ucsd/camera/idl/buf/smei_buf_read.pro
[Previous] [Next]
 NAME:
	smei_buf_read
 PURPOSE:
	Read Level 1A file in 'buf' format
 CATEGORY:
	camera/idl/buf
 CALLING SEQUENCE:
	FUNCTION smei_buf_read, l1a_file, pointer,  $
	    get_file_header = get_file_header,	$
	    file_header     = file_header    ,	$
	    frame_headers   = frame_headers  ,	$
	    frame_nr	    = frame_nr	     ,	$
	    frame_data	    = frame_data     ,	$
	    get_next_frame  = get_next_frame ,	$
	    silent	    = silent	     ,	$
	    force_close     = force_close    ,	$
	    trunc_time	    = trunc_time     ,	$
	    start_pointer   = start_pointer
 INPUTS:
	l1a_file	    scalar; type: string
				fully-qualified file name of SMEI l1a*.buf file.
				To close an open file, set l1a_file = ''
	pointer 	    scalar; type: integer
				file pointer in l1a_file where the requested frame starts.
				This argument is optional, but if known, speeds up
				the process of finding a frame in the L1A file.
 OPTIONAL INPUT PARAMETERS:
	/get_file_header    only fill file_header structure
	/get_next_frame     get next frame from file
			    If this keyword is set then the data file is kept open
			    with the file pointer after the current frame.
	frame_nr=frame_nr
			    get frame with number 'frame_nr'
			    The frame number specified here should be taken
			    from the header array returned in a previous call
			    (this is a 1-based frame number).
	trunc_time	    array[1]; type: time structure
			    used only when collecting all frame headers (i.e.
			    keywords frame_nr_defined and get_next_frame NOT set,
			    and argument have_pointer NOT set). The collection of
			    frames stops at the indicated time instead of
			    continuing until the end-of-file is reached.
	start_pointer	    scalar; type: integer
				when new l1a_file is opened move to file pointer
				to start_pointer and start processing from there
				instead of from the beginning of the file.
				'start_pointer' is destroyed to avoid using
				in another l1a_file.
 OUTPUTS:
	status		    scalar; type: integer
				0: failure; 1: success
 OPTIONAL OUTPUT PARAMETERS:
	file_header=file_header
			    array[1]; type: file header structure
	frame_headers=frame_headers
			    array[n]; type: frame header structure array
				an array with with headers for all frames is returned
			    array[1]; type: frame header structure
				if 'frame_nr' is specified than the
				header for the matching frame is returned
	frame_data=frame_data
			    array[n], array[n,m]; type: unsigned int, long or float
				if 'frame_nr' is set then the matching frame
				data are returned here.
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
	@smei_roi_mask.pro	; ROI mask common block
 CALLED BY:
	smei_buf_get, smei_buf_getframe, smei_buf_mget
 COMMON BLOCKS:
	common smei_read_buf_file, iu, open_file, open_hdr, pntr, last_frm, frm_count
 CALLS: ***
	InitVar, IsTime, IsType, TimeGet, TimeLimits, TimeOp, TimeUnit, boost, destroyvar
	hide_env, smei_buf_splitfile, smei_filename, smei_frm_cvhdr, smei_property
	smei_setup_roi, who_am_i
 PROCEDURE:
	The content of SMEI .buf files is described in Don Mizuno's memo:

	The data area is padded to a 2D frame using the mask stored in
	the ASCII file smei_buf_roi.txt. This file contains a 318 x 64 array with values 0,1,2 and 3.
	0: pixels outside the region of interest
	1: pixels in the smei fov
	2: pixels in the covered columns left and right
	3; pixels in the square open areas outside the smei fov
 MODIFICATION HISTORY:
	MAR-2003, Paul Hick (UCSD/CASS)
	APR-2003, Paul Hick (UCSD/CASS)
	    Fixed bug in frame header structure. The naxes values in the raw
	    header were not updated when the ROI was applied (so the nic files
	    prior to today (Apr 20) have naxes=[0,0] in the trailer).
	MAR-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Entry frame_header.n_satured is filled here using the
	    data extracted from the L1A file.


smei_buf_splitfile $SMEI/ucsd/camera/idl/buf/smei_buf_splitfile.pro
[Previous] [Next]
 NAME:
	smei_buf_splitfile
 PURPOSE:
	Analyze content of 256-ascii file header in SMEI L1A *.buf file
 CATEGORY:
	camera/idl/buf
 CALLING SEQUENCE:
	FUNCTION smei_buf_splitfile, byte_hdr
 INPUTS:
	ascii_hdr	array[256]; type: byte
			    256-byte header
 OUTPUTS:
	Result		array[1]; type: smei_buf_hdr structure
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 EXTERNAL:
	smei_buf_hdr__define
 CALLS: ***
	GetFileSpec, TimeOp, TimeSet, timeposn
 CALLED BY:
	smei_buf_read
 PROCEDURE:
	The file header is actually stored in ascii form, so the input byte
	array is converted to string before processing
 MODIFICATION HISTORY:
	MAR-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Based on SMEI Convert 1.0


smei_cam2angle $SMEI/ucsd/camera/idl/toolbox/smei_cam2angle.pro
[Previous] [Next]
 NAME:
	smei_cam2angle
 PURPOSE:
	Get angles from unit vector in SMEI camera frame
 CATEGORY:
	camera/idl
 CALLING SEQUENCE:
	angle = smei_cam2angle(runit [,stheta=stheta, rtheta=rtheta])
 INPUTS:
	runit	    array[3,n]; type: float or double
			x,y,z components of unit vector in UCSD camera frame
 OPTIONAL INPUT PARAMETERS:
	/stheta     if set, then the direction cosine angles are returned
			this is the default if no keywords are specified.
	/rtheta     if set, then the rotation angles from
			Buffington et al., SPIE 4853, 490, 2002.
		    are returned
 OUTPUTS:
	angle	    array[2,n]; type: double
			requested theta-x and theta-y angles
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	InitVar, ToRadians
 CALLED BY:
	smei_findcrazy, smei_frm_hbar, smei_frm_where
 SEE ALSO:
 PROCEDURE:
	/stheta set
	    locations in the sky as direction cosine angles theta-x and
	    These are the direction cosine angles required by Andy's formulae for
	    mapping sky locations to CCD positions ('Defining the field of
	    view for the SMEI cameras', A. Buffington, 11 July 2001.)
	    !!! These are not the same as the theta-x, theta-y angles
	    in Buffington et al., SPIE 4853, 490, 2002.
	/rtheta
	    !!! These are the theta-x, theta-y angles
	    in Buffington et al., SPIE 4853, 490, 2002.
	    i.e. angles used in determining the performance of the baffle,
	    incl. the glare.
 MODIFICATION HISTORY:
	MAR-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_cam_quaternion $SMEI/ucsd/camera/idl/toolbox/smei_cam_quaternion.pro
[Previous] [Next]
 NAME:
	smei_cam_quaternion
 PURPOSE:
	Get quaternion that rotates from ECI (=J2000) frame to UCSD
	camera frame for given Coriolis s/c quaternion and camera.
 CATEGORY:
	camera/idl/frm
 CALLING SEQUENCE:
	qcam = smei_cam_quaternion(hdr)
	qcam = smei_cam_quaternion(quaternion, camera)
	qcam = smei_cam_quaternion(uttime, camera)
 INPUTS:
	hdr	array[n]; type: SMEI_FRM_HDR structure
		    hdr.quaternion and hdr.camera are used
		    to calculate the camera quaternion.
		array[n]; type: time structure
		    UT time is used to get the quaternion
		    assuming the Coriolis is in its
		    nominal attitude.
		array[4] or array[4,n]; type: double
		    Coriolis quaternion (as extracted from
		    frame header). If 'hdr' is a quaternion
		    then 'camera' needs to specified too.
 OPTIONAL INPUTS:
	camera	    scalar or array[n]; type: integer
		    camera number (as extracted from frame header)
 OUTPUTS:
	qcam	    array[4] or array[4,n]; type: double
		    camera quaternion (relative to same coord
		    system as Coriolis quaternion)
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	CombineRotations, IsTime, IsType, smei_camera, smei_property, smei_sgp4_quat
 CALLED BY:
	cvsmei, smei_ccd2sky, smei_frm_where, smei_sky2cam
 SEE ALSO:
	smei_orient_test
 PROCEDURE:
	Camera quaternion rotates from J2000 equatorial coordinates to
	UCSD camera coordinates.
 MODIFICATION HISTORY:
	JUN-2003, Paul Hick (UCSD/CASS
	FEB-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added option to input time and retrieve the
	    the nominal quaternion.


smei_camera $SMEI/ucsd/camera/idl/toolbox/smei_camera.pro
[Previous] [Next]
 NAME:
	smei_camera
 PURPOSE:
	Defines parameters for the SMEI fov
 CATEGORY:
	SMEI
 CALLING SEQUENCE:
	R = smei_camera(/get_center)
 INPUTS:
	nsize = nsize	    array[2]; type: long integer; default:[1280,360]
				CCD frame size (pixels)
	center= center	    array[2]; type: float; default: [631.65, 1233.03]
				x- and y-coordinate of center of field of view arc
	optical_axis	    array[2]; type: float; default: [-89.5 (deg), 1179.50 (pix)]
				azimuth and radius of optical axis
				identifies the location of the optical axis relative
				to the fov center in terms of polar coordinates. By
				default. The optical axis is near azimuth 270
				(vertically below the center) at ~ 1200 pixels
				distance.
	fov_size	    array[2,2]; type: float: default:[30 (deg), 42.5 (pix)]#[-1,1]
				the size of the SMEI fov in polar coordinates
				The fov is ~ 60 degrees in azimuth by 85 pixels
				in the radial direction, and is centered on the
				optical axis.
	quaternion	    array[4]; type: double: default
				quaternion describing orientation of cameras
				relative to the spacecraft structure.
	fov_tosky	    array[2,2] type: float
				scaling from CCD coordinates to sky coordinates
	fov_toccd

 OPTIONAL INPUT PARAMETERS:
	/get_nsize	    retrieve frame size
	/get_center	    retrieve center of field of view arc
	/get_optical_axis   retrieve optical axis coordinates
	/get_fov_size	    retrieve field of view size
	/get_fov_limits     retrieve limits of field of view
	/get_quaternion     retrieve camera quaternions
	/get_fov_tosky	    retrieve CCD-to-sky transformation constants
	/get_fov_toccd

	/get_structure	    retrieve structure containing all field of view information

	/degrees	    if set then all angles (input and output) is in degrees
			     (default: radians)
 OUTPUTS:
	Output depends on the keyword selection.
	If /get_fov_limits is set the limits of the field of view are returned:

	R	array[2,2]; type: float
		limiting values in azimuth and radius of the fov
		in the form [[angle1,radius1],[angle2,radius2]].
		Angle1 and angle2 are in radians between [-!pi,+!pi].
		The fov runs counterclockwise from 'angle1' to 'angle2'.

	If /get_structure is set then a structure is returned containing all
	field of view information:

	R	array[1]; type: structure
		{SMEI_fov,  $
		    camera  : camera,
		    nsize	: nsize,
		    center	: center,
		    axis	: optical_axis,
		    size	: fov_size,
		    limits	: fov_limits,
		    quaternion	: quaternion,
		    tosky	: fov_tosky,
		    radial_profile: ptr to radial_profile}
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	CombineRotations, InitVar, IsType, ToDegrees, ToRadians
 CALLED BY:
	TMO_tracksky, cvsmei, qGlitch_Run, qImage_cw_SMEI, smei_cam_quaternion
	smei_ccd2sky, smei_sky2cam, smei_sky2ccd, stardistance
 SEE ALSO:
	smei_orient_test
 PROCEDURE:
	Default values are used unless other values are specified as input arguments
	The fov limits are calculated from the location of the optical axis and
	the size of the field of view.
 MODIFICATION HISTORY:
	FEB-2000, Paul Hick (UCSD/CASS)
	MAR-2003, Paul Hick (UCSD/CASS)
	    Added numbers for flight cameras.
	JAN-2004, Paul Hick (UCSD/CASS)
	    Added camera values from Aarons indexing program. These used the center
	    values from Andys memo, and camera quaternions obtained by trial-and-error.
	    These numbers are now the default.
	FEB-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Update camera quaternions with values used by the Fortran
	    SMEI programs. Presumably these are the best we have.


smei_camera_gain $SMEI/ucsd/camera/idl/star/smei_camera_gain.pro
[Previous] [Next]
 NAME:
	smei_camera_gain
 PURPOSE:
	Returns the camera gain at specified time
 CATEGORY:
	camera/idl/sky
 CALLING SEQUENCE:
	FUNCTION smei_camera_gain, tt, $
	    camera	= camera    , $
	    zero_time	= zero_time , $
	    zero_gain	= zero_gain , $
	    delta_gain	= delta_gain
 INPUTS:
	tt		array[n]; type: time structure
			    UT time
 OPTIONAL INPUTS:
	camera=camera	scalar or array[n]; type: integer; default: 2
			    camera number, 0,1,2,3
			    camera=0 will always return gain=1.00
	zero_time=zero_time
			array[1]; type: time structure;
			    default: TimeSet(yr=2003,doy=0)
			    Time origin for gain correction
	zero_gain=zero_gain
			array[4]; type: float; default: 1.0/[0.00,0.97,1.00,0.92]
			    gains for "camera 0" and three cameras at time zero_time
	delta_gain=delta_gain
			array[4]; type: float; default: [0.00,-0.005,-0.01,-0.01]
			    gain change per year for "camera 0" and three cameras
 OUTPUTS:
	gain		array[n]; type: float
			    gain correction at specified times
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	InitVar, TimeOp, TimeSet, TimeUnit
 CALLED BY:
	smei_sky_read, smei_star_fit, smei_star_remove, smei_zld_remove
 PROCEDURE:
	The sensitivity of the cameras appears to be decreasing at a
	rate of about 1% per year. (But see next paragraph)

	JUL-2008:
	From looking at a timeseries of a patch of 31x31 skybins centered on the
	galactic center for the period 2003-2008 we found that the gain for
	camera 1 is decreasing by about 0.5%/year. For camera 2 the original
	number of 1%/year is still acceptable, but may actually be closer to
	1.1%/year. For camera 3 the current 1%/year may be a bit large, but
	it is not clear by how much.

	Andy set the time origin for the gain to 2003, doy 0 (NOT doy 1).
	So the time origin is at 2002 Dec 31, 0 UT.
 MODIFICATION HISTORY:
	JUL-2006, Jordan Vaughan, Paul Hick (UCSD/CASS)
	NOV-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    zero_gain was defined wrong. The gain for camera 1 at zero_time
	    is 1.0/0.97 (NOT 0.97); for camera 3 it is 1.0/0.92 (NOT 0.92).
	    I.e., cameras 1 and 3 are MORE sensitive than camera 2;
	    NOT less sensitive as originally coded.


smei_ccd2sky $SMEI/ucsd/camera/idl/obsolete/smei_ccd2sky.pro
[Previous] [Next]
 NAME:
	smei_ccd2sky
 PURPOSE:
	Convert from CCD coordinates to positions in the sky
 CATEGORY:
	SMEI
 CALLING SEQUENCE:
	R = smei_ccd2sky( rvec, [ camera=camera, quaternion=quaternion, /degrees])
 INPUTS:
	rvec		array[2,*]; type: float
			    x- and y- coordinates of locations on the CCD
			    These are converted to sky coordinates if inside the
			    field of view. If no points lie inside the field of
			    view then the scalar BadValue(rvec) is returned.
			    If rvec is not specified then all pixels in a
			    frame are processed.
 OPTIONAL INPUT PARAMETERS:
	/rectangular	if set then the return value is in rectangular coordinates
			(with 1st dimension of 3).

	camera=camera	This keyword can be any one of the following three.
			array[1]; type: smei_buf_frm structure
			    this determines the camera and the quaternion.
			    The keywords 'quaternion' and 'qcamera' are ignored.
			array[1]; type: smei_camera_fov structure
			    structure containing information about SMEI field of
			    view; usually the return value of smei_camera
			    with the /get_structure keyword set.
			scalar; type: integer
			    camera number (1,2 or 3).
			If not specified then camera=1 is assumed.

			The camera number is used as argument to smei_camera to
			obtain the fov structure.

	quaternion=quaternion
			array[4]; type: float
			    Coriolis quaternion, or (if /qcamera is set) the
			    camera quaternion (i.e. the quaternion
			    constructed by smei_cam_quaternion).
	/qcamera	indicates that 'quaternion' already is the camera
			quaternion for the camera specified in 'camera'.
	/degrees	if set, all in- and output angles are in degrees
			    (default: radians). Note that the 'fov' structure
			    must be consistent with the setting of /degrees.
	/boolean	if set then the output array 'inside' is returned as an
			2D array of indices. (set this keyword only if rvec
			is NOT specified, i.e. when processing a whole frame.
	distort=distort
			NOT IMPLEMENTED YET
 OUTPUTS:
	R	    array[2,n]; type: float
			spherical coordinates (longitude, latitude)
			for all pixels inside the SMEI fov
 OPTIONAL OUTPUT PARAMETERS:
	inside=inside
		    array[  n]; type: long integer (if /twod NOT set)
		    array[2,n]; type: long integer (if /twod set0
			one- or two-D CCD pixel indices for all the pixels
			listed in R
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	AngleRange, BadValue, CV_COORD, CvRotation, InitVar, Inside_Wedge, IsType, SubArray
	SyncDims, ToDegrees, ToRadians, boost, gridgen, smei_cam_quaternion, smei_camera
	smei_radial2theta
 PROCEDURE:
 MODIFICATION HISTORY:
	OCT-1998, Paul Hick (UCSD/CASS)
	FEB-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu); added quaternion keyword


smei_coriolis $SMEI/ucsd/gen/idl/ephem/smei_coriolis.pro
[Previous] [Next]
 NAME:
	smei_coriolis
 PURPOSE:
	Returns time at which Coriolis was in specified orbit
 CALLING SEQUENCE:
	FUNCTION smei_coriolis, tt_or_orbit , $
	    orbital_period  = orbital_period, $
	    number	    = number	    , $
	    fraction	    = fraction	    , $
	    doublex	    = doublex
 INPUTS:
	tt_or_orbit	    array; type: time structure or any numerical type
				if input are times then output is the
				orbit number; if input is numerical then
				output is the orbit time.
 OPTIONAL INPUTS:
	/orbital_period     return orbital period
				if set then the orbital period at the specified
				time or orbit number is returned
				(if tt_or_orbit is not specified then
				tt_or_orbit=0 is assumed)
	/number 	    these three keywords are used only if a time
	/fraction	    structure is specified as input (the keywords
	/doublex	    are passed to smei_orbit_get.
 OUTPUTS:
	smei_coriolis	    array; type: numerical or time structure
				orbit number or orbit time (depending on input
				tt_or_orbit
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	FILEPATH, InitVar, IsTime, IsType, TimeGet, TimeLInterpol, TimeOp, TimeSet
	smei_orbit_get, smei_orbit_set, timeposn, txt_read, who_am_i
 CALLED BY:
	TimeGet, TimeSet, skyd_equ, smei_frm_findpoint, smei_getfile, smei_orb_fractions
	smei_orbits_stat, smei_shutterwrong, smei_star_fit
 PROCEDURE:
	Orbit n0(=0) starts at t0 = 2002/12/31 23:56:41.900.
	The orbital period at this time was p0=0.0705612268519d0 days (6096.490 s),
	and has been decreasing since with dp=0.084 msec per orbit.
	(0.42s reduction in SMEI period per 365 days).

	The effective orbital period for orbit n is p0-(n-n0)*dp.
	The start times for each orbit becomes:

	t(n0+0) = t0
	t(n0+1) = t(n0+0)+p0-1*dp
	t(n0+2) = t(n0+1)+p0-2*dp
	...
	t(n0+n) = t(n0+n-1)+p0-n*dp = t0+n*p0-0.5*n*(n+1)*dp
 MODIFICATION HISTORY:
	JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_cv_catalogue $SMEI/ucsd/camera/idl/star/smei_cv_catalogue.pro
[Previous] [Next]
 NAME:
	smei_cv_catalogue
 PURPOSE:
	Modifies formatting in bright star catalogue
 CATEGORY:
	camera/idl
 CALLING SEQUENCE:
	PRO smei_cv_catalogue
 INPUTS:
	Text file brightstars.txt in same directory as this routine.
 OUTPUTS:
	updata catalogue (overwrites old one)
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	FILEPATH, txt_read, who_am_i
 PROCEDURE:
	Fixes format problem with small negative latitudes. The minus sign
	in front of zero degrees is moved to the minute (or even the seconds
	field) e.g. entry -0 20 20 is changed to 0 -20 20
 MODIFICATION HISTORY:
	MAR-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_filename $SMEI/ucsd/camera/idl/toolbox/smei_filename.pro
[Previous] [Next]
 NAME:
	smei_filename
 PURPOSE:
	Construct or deconstructs file name for SMEI data files from/into its
	components (time,camera,file extension, and map mode)
 CATEGORY:
	camera/idl/frm
 CALLING SEQUENCE:
	FUNCTION smei_filename, tt, $
	    camera  = camera, $
	    mode    = mode  , $
	    m0	    = m0    , $
	    upto    = upto  , $
	    pos_tt  = pos_tt, $
	    type    = type  , $
	    dir     = dir   , $
	    ccd     = ccd
 INPUTS:
	tt		array[n]; type; time structure or string
			    time or file name

			If tt is a file name, two conditions must
			be met for a successfull deconstruction:
			- it must contain a valid time string
			    (see timeposn).
			- the time must be preceeded by an
			    underscore
			If these are not met then the 'camera'
			'mode' and 'm0' fields are not set
			(i.e. camera=-1, mode=m0='')
 OPTIONAL INPUT PARAMETERS:
	If input 'tt' is a time structure, the file name is
	constructed using the following additional input:

	camera=camera	scalar or array[n]; type: integer; default: 1
			    camera number (1,2, or 3)
	type=type	scalar or array[n]; type: string; default: '.fts.gz'
			    file type
	mode=mode	scalar or array[n]; type: string or integer; default: 0
			    file mode, e.g. 'frm', 'cal','sky','equ'
			    If an integer is specified it is assumed to be the
			    frame binning mode 0 (1x1), 1 (2x2) or 2 (4x4),
			    in which case the mode will be 'm'+mode
	upto=upto	scalar; type: integer; default: TimeUnit(/sec)
			    sets time unit where file name is truncated
			    (only used if input 'tt' is time structure)
 OUTPUTS:
	If input 'tt' is time structure:

	result		array[n]; type: string
			    name of SMEI file

	If input 'tt' is a file name

	result		array[n]; type: time structure
			    time coded into SMEI file (e.g. time of
			    frame or start time of orbit)
 OPTIONAL OUTPUT PARAMETERS:
	If input 'tt' is a filename several parameters coded into
	the file are extracted:

	camera=camera	array[n]; type: integer
			    camera number (1,2, or 3)
	mode=mode	array[n]; type: string or integer; default: 0
			    file mode, e.g. 'frm', 'cal','sky','equ',
			    'l1a'.
			    If ccd=1 then mode is return as integers
			    If ccd=0 then the mode for CCD frames
			    is returned as 'm0','m1','m2'.
	ccd=ccd 	set to 1 if all entries are CCD frames
	type=type	array[n]; type: string
			    file type (may be a double type
			    e.g. .fts.gz)
	directory=directory
			array[n]; type: string
			    directory (null-string if not present)
	m0=m0		array[n]; type: string
			    null-string or 'm0'
			    Set to 'm0' if the directory name
			    ends in 'c#m0' (where # is the camera
			    number).
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	GetFileSpec, InitVar, IsTime, IsType, SyncArgs, TimeGet, TimeSet, TimeUnit, UNIQ
	strreverse, timeposn
 CALLED BY:
	img_read, qImage_cw_Property, qsmei_sky_pick, smei_buf_prep, smei_buf_read
	smei_filepath, smei_findpnt, smei_frm_cvhdr, smei_getfile, smei_hdr_get
	smei_property, smei_sky_field, smei_sky_read, smei_sky_track, smei_star_remove
	smei_zld_remove
 PROCEDURE:
	Uses the standard SMEI template for file names:
	    c1m0_2003_123_123456.fts.gz
 MODIFICATION HISTORY:
	MAY-2004, Paul Hick (UCSD/CASS)
	JUL-2004, Paul Hick (UCSD/CASS)
	    Modified to deal with new frame name syntax with mode coded
	    into the file name
	JUL-2004, Paul Hick (UCSD/CASS)
	    Updated documentation
	MAR-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Substantial rewrite of deconstruction section.
	    Added pos_tt and ccd keywords.


smei_filepath $SMEI/ucsd/camera/idl/toolbox/smei_filepath.pro
[Previous] [Next]
 NAME:
	smei_filepath
 PURPOSE:
	Construct path to SMEI file (frame or skymap)
 CATEGORY:
	camera/idl/frm
 CALLING SEQUENCE:
	FUNCTION smei_filepath, tf, $
	    base    = base  , $
	    source  = source, $
	    camera  = camera, $
	    mode    = mode  , $
	    m0	    = m0, $
	    type    = type  , $
	    upto    = upto  , $
	    full    = full
 INPUTS:
	tf		undefined; scalar, or array[1]
			    if defined then either a time (in the form of a standard
			    time structure), or the name of a SMEI frame or skymap
			    (e.g. 'c2m0_2003_123_456789')
			    NOTE: if tf is NOT defined than keyword source MUST be
			    set to an existing directory.
 OPTIONAL INPUT PARAMETERS:
	source=source	scalar; type: string; default: SMEIDB?
			    directory where to look for SMEI frames.
			    If the directory does not exist then the current SMEI
			    drive is used. The default value SMEIDB? will result
			    in an automatic determination of a source directory
			    using the information in file smei_drives.txt.

	The SMEI frames are stored in directories of the form
	$SMEIDB#/yyyy_doy/hh. By default the name of the full directory
	where the frames for time 'tf' are located is returned.

	/base		if set only the part $SMEIDB# is returned
	/day		if set only the part $SMEIDB#/yyyy_doy is returned
 OUTPUTS:
	ff		scalar; type: string
			    directory where frame(s) for specified time are located
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLED BY:
	smei_buf_prep, smei_findpnt, smei_frm_read, smei_getfile, smei_hdr_get
	smei_hdr_update, smei_mksidereal, smei_property, smei_sky_read, smei_star_remove
	smei_zld_remove, smeidb_mounted
 COMMON BLOCKS:
	common smei_filepath_save, checkdrives, sdat
 CALLS: ***
	CheckDir, FILEPATH, InitVar, IsTime, IsType, TimeGet, TimeOp, TimeSet, TimeUnit
	destroyvar, flt_read, smei_filename, who_am_i
 PROCEDURE:
	The SMEI data are distributed across several hard drives.
	Env variables SMEIDB1, SMEIDB2, etc. exist pointing to the mount
	points of each drive. Each drive contains data for the time range
	specified in the file 'smei_drives.txt'.

	SMEI data are organized in separate folders for each day. E.g. the
	folder $SMEIDB1/2003_100/c2 contains all SMEI frames
	day of year 100 (in year 2003) for camera 2.

	If tf is NOT defined then the YYYY_DOY part in the returned path
	will be missing. This is useful to locate skymaps (which usually are
	split up by camera only, not by time).
 MODIFICATION HISTORY:
	JUN-2003, Paul Hick (UCSD/CASS)
	    Introduced to deal with multiple hard drives containing
	    SMEI data frames.
	MAY-2004, Paul Hick (UCSD/CASS)
	    Modified to reflect new directory structure of SMEI data base
	    (frames are now organized in a separate directory for each
	    doy of year, with subdirectories for each of the cameras)
	AUG-2006, Paul Hick (UCSD/CASS)
	    Modified to do something useful when tf is not defined.
	FEB-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Generalized to work with data other than CCD frames
	    (skymaps, hdr and png files)


smei_findcrazy $SMEI/ucsd/camera/idl/toolbox/smei_findcrazy.pro
[Previous] [Next]
 NAME:
	smei_findcrazy
 PURPOSE:
	Look for 'crazy frames'
 CATEGORY:
 CALLING SEQUENCE:
	PRO smei_findcrazy, trange, source=source, camera=camera, mode=mode, copy=copy
 INPUTS:
	trange		passed to smei_hdr_get
 OPTIONAL INPUT PARAMETERS:
	camera
	mode
 OUTPUTS:
 OPTIONAL OUTPUT PARAMETERS:
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 EXTERNAL:
 CALLS: ***
	GetFileSpec, InitVar, boost, destroyvar, do_file, smei_cam2angle, smei_frm_hbar
	smei_hdr_get
 SEE ALSO:
 PROCEDURE:
 MODIFICATION HISTORY:
	JAN-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_findpnt $SMEI/user/phick/pro/smei_findpnt.pro
[Previous] [Next]
 NAME:
	smei_findpnt
 PURPOSE:
 CATEGORY:
	user/phick/idl
 CALLING SEQUENCE:
	PRO smei_findpnt, wanted_map	, $
	    silent	= silent	, $
	    from_mode	= from_mode	, $
	    to_mode	= to_mode	, $
	    npeak	= npeak 	, $
	    destination = destination	, $
	    _extra	= _extra
 INPUTS:
	wanted_map	array[n]; type: string, time structure or integer
			    passed to smei_getfile
			    Selects skymap files to be processed
	destination	scalar; type: string; default: $TUB
			    destination directory of output file
 OPTIONAL INPUT PARAMETERS:
	source=source	scalar; type: string
			    passed to smei_getfile
			    source directory for sky maps

	/silent 	if set, suppresses informational messages

 OUTPUTS:
	Files in destination directory
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	AngleUnits, ArrayLocation, BadValue, FILEPATH, FindPeaks, InitVar, REVERSE, SuperArray
	TimeSet, boost, cvsmei, destroyvar, hide_env, smei_filename, smei_filepath
	smei_getfile, smei_sky, smei_star_fit, smei_star_info, smei_star_writepnt
	smei_zld_model, sphere_distance
 PROCEDURE:
 MODIFICATION HISTORY:
	FEB-2008, Paul Hick (UCSD/CASS)


smei_frm_base $SMEI/ucsd/camera/idl/frm/smei_frm_base.pro
[Previous] [Next]
 NAME:
	smei_frm_base
 PURPOSE:
	Calculate pedestal and dark current for frame
 CATEGORY:
	smei/camera/idl/misc
 CALLING SEQUENCE:
	PRO smei_frm_base, hdr, img, silent=silent,			$
	    cam_full=cam_full, cam_ok=cam_ok, init=init, reset=reset,	$
	    clear=clear, frm=frm, step=step, status=status,		$
	    nfill_control=nfill_control, nbad_control=nbad_control
 INPUTS:
	hdr	    array[1]; type: structure
			frame header
	img	    array; type: integer
			frame data
 OPTIONAL INPUT PARAMETERS:
	nfill_control=nfill_control
		    scalar; type: integer; default: 10
	/init	    initialize all camera/mode combinations
	/reset	    re-initialize the current camera/mode combination only
	/clear	    clear all variables stored internally in common block
	silent	    =0: display all messages
		    =1: suppress non-essential messages
		    =2: suppress all messages
 OUTPUTS:
	hdr	    array[1]; type: structure
			frame header with a number of values filled, in particular
			hdr.pedestal, hdr.dark current, hdr.squares, hdr.centerpix
	img	    array; type: float
			image with pedestal and dark current subtracted
			Any negative elements after subtraction are set to zero
			(these will mostly be pixels in the semi-covered columns
			(5 and 315 for mode 2 data)
 OPTIONAL OUTPUT PARAMETERS:
	cam_ok=cam_ok
		    scalar; type: byte
		    0: failed to determine pedestal and/or dark current
		    1: pedestal and dark current determined successfully
	nfill_control=nfill_control
		    scalar; type: integer
			# good frames used to build reference base values
	cam_full=cam_full
		    0: still busy accumulating reference base data (based on
			nfill_control preceeding good frames) for current
			camera/mode combination
		    1: reference data for preceeding nfill_control good frames
			available
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
	@smei_roi_mask.pro	; SMEI masks
 CALLED BY:
	smei_frm_track
 COMMON BLOCKS:
	common smei_frm_base_save, ped_threshold, drk_threshold,	    $
	    ped_mean_init, drk_mean_init, ped_sigma_init, drk_sigma_init,   $
	    nfull, nbads, ifull, bfull, nbad, badv, $
	    peds_mean, peds_sigma, drks_mean, drks_sigma,$
	    ped_mean , ped_sigma , drk_mean , drk_sigma , $
	    drk_nout_init, drk_dout_init, drks_nout, drk_nout, drk_dout,    $
	    drk_lr_ratio
 CALLS: ***
	ArrayLocation, BadValue, InitVar, IsType, MEAN, STDDEV, TimeGet, TimeUnit, destroyvar
	smei_property, smei_setup_roi, where_common, who_am_i
 PROCEDURE:

 MODIFICATION HISTORY:
	MAY-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_frm_comments $SMEI/ucsd/camera/idl/frm/smei_frm_comments.pro
[Previous] [Next]
 NAME:
	smei_frm_comments
 PURPOSE:
	Returns comments for Fits header in SMEI frame
 CATEGORY:
 CALLING SEQUENCE:
	FUNCTION smei_frm_comments, hdr
 INPUTS:
	hdr array[1]; type: SMEI__FRM_HDR structure
		SMEI frame header
 OUTPUTS:
	str array[n]; type: string
		list of comments (one for each tag name
		in the SMEI__FRM_HDR structure
 OPTIONAL OUTPUT PARAMETERS:
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLED BY:
	smei_frm_cvhdr
 PROCEDURE:
 MODIFICATION HISTORY:
	MAR-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


smei_frm_cp $SMEI/ucsd/camera/idl/frm/smei_frm_cp.pro
[Previous] [Next]
 NAME:
	smei_frm_cp
 PURPOSE:
	Copy SMEI frames from SMEI data base
 CATEGORY:
	ucsd/camera/idl/frm
 CALLING SEQUENCE:
	PRO smei_frm_cp, trange, destination=destination, unzip=unzip, camera=camera, mkdir=mkdir, _extra=_extra
 INPUTS:
	trange		    array[2]; type: time structure
			    time range to be copied (see TimeSet)
 OPTIONAL INPUT PARAMETERS:
	camera=camera	scalar, or array[n] (n=1,2,3); default: [1,2,3]
			    cameras to be copied
	/unzip		if set files are unzipped
	/mkdir		if set then the destination directory specified using
			    the'destination' keyword is created if it doesn't exist already

	Passed to smei_getfile:

	silent=silent	controls informational messages
	mode=mode	scalar, or array[n] (n=0,1,2); default: none
			if set only the specified modes are selected
 OUTPUTS:
	(none)
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	CheckDir, FILEPATH, GetFileSpec, InitVar, IsTime, TimeGet, TimeOp, TimeSet, TimeUnit
	do_file, hide_env, smei_getfile
 RESTRICTIONS:
	Files are copied in groups of typically about 4000 frames at a time.
	See do_file for more details. The limitation arises from a restriction
	on the length of a shell command (usually 128 kB).
 PROCEDURE:
 >	Files for camera 1 are copied into subdirectory c1 of destination
	directory (the subdirectory is created if it does not exist yet).
	Same for cameras 2 and 3.
 > Specifying the mode keyword requires that file headers need to be read
	to determine the mode (the camera number is coded into the file name).