[Previous]
[Next]
NAME:
MagnifyArray
PURPOSE:
Rebin an image to a integer multiple of its original size by
copying pixel values
CATEGORY:
Tricks
CALLING SEQUENCE:
result = MagnifyArray(array [, mag, /undo])
INPUTS:
array array[n,m]; type: any
any 2-dimensional array
OPTIONAL INPUT PARAMETERS:
mag scalar; type: integer; default: 2
magnification factor; must be an integer
/undo undoes a previous magnification operation (the magnification
factor must be the same to retrieve the original array)
OUTPUTS:
result array[n*magnification,m*magnification]
the resulting array enlarged by the magnification factor.
array element array[i,j] from the input image is replicated
in array elements
result[i*magnification..i*magnification+magnification-1,
j*magnification..j*magnification+magnification-1]
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar, IsType, SuperArray
CALLED BY:
img_read, qImage_cw_Blowup, qImage_cw_BoxZoom, qImage_cw_Where, qView_Movie
qView_Save2File, qView_Wall, qvu_draw, smei_frm_flatfield, smei_frm_rebin
smei_setup_roi, smei_star_fit
RESTRICTIONS:
PROCEDURE:
Both IDL rebinning functions (REBIN and CONGRID) use interpolation
procedures, and hence in general will produce pixel values not present
in the original array.
MagnifyArray replicates pixel values in blocks of magnification
x magnification pixels.
MODIFICATION HISTORY:
FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
MAKE_SMEI_ARG
PURPOSE:
Generate a SMEI_ARGUMENT from a sequence, image or number and
descriptors.
CATEGORY:
OPS
CALLING SEQUENCE:
argref = make_smei_arg(descriptor)
INPUTS:
descriptor str/num A descriptor or a number (or array).
KEYWORD_PARAMETERS:
get_level int The calling level from which to get
the object being argumentified
(usually only used by the
/transient If set, then any new argument object
is generated with the transient flag.
OUTPUTS:
argref objref The argument object reference
NOTES:
When the argument is expressed as a string, then the object
referred must exist in the caller or at the top ($MAIN$) level
in SSWIDL. The
format is "name{plane}[start:stop:step]", if no plane is given
then the "processed" plane is assumed, if no range specifier
is given for a sequence then the whole sequence is assumed.
CALLS: ***
smei_msg
CALLED BY:
MAKE_SMEI_OP
MODIFICATION HISTORY:
Original: 28/10/03; SJT
Get from caller or specified level: 30/10/03
Tidy up level handling: 4/11/03; SJT
Added transient flag: 5/11/03; SJT
[Previous]
[Next]
NAME:
MAKE_SMEI_OP
PURPOSE:
Simple interface to generating SMEI operations
CATEGORY:
OPS
CALLING SEQUENCE:
make_smei_op, ref, operator, arg0[, ... argn]
INPUTS:
operator string The operator or function to apply
arg0 obj/str Either: a SMEI_ARGUMENT object
reference, or a string defining an
argument , or a numeric (possibly
array) value.
OPTIONAL INPUTS:
arg1 .. arg9 obj/str Up to 9 further arguments to the
operator in the same form as arg0
KEYWORD PARAMETERS:
/return_operator If set, then return the SMEI_OPERATOR
object reference, by default the
generated sequence is returned.
get_level int The calling level from which to get
the object being argumentified
(usually only used by the
interpreter).
For "function" operators, any keys to the function can be passed.
OUTPUTS:
ref objref The sequence or operator reference generated.
NOTES:
When the argument is expressed as a string, then the object
referred must exist at the top $MAIN$ level in SSWIDL. The
format is "name{plane}[start:stop:step]", if no plane is given
then the "processed" plane is assumed, if no range specifier
is given for a sequence then the whole sequence is assumed.
CALLS: ***
MAKE_SMEI_ARG, self_help, smei_msg
CALLED BY:
MAKE_SMEI_OPF
RESTRICTIONS:
A Maximum of 10 arguments to the operator may be specified
MODIFICATION HISTORY:
Original: 28/10/03; SJT
[Previous]
[Next]
NAME:
MAKE_SMEI_OPF
PURPOSE:
Functional interface for MAKE_SMEI_OP
CATEGORY:
ops
CALLING SEQUENCE:
ref = make_smei_opf(operator, arg0[,...argn])
INPUTS:
operator string The operator or function to apply
arg0 obj/str Either: a SMEI_ARGUMENT object
reference, or a string defining an
argument , or a numeric (possibly
array) value.
OPTIONAL INPUTS:
arg1 .. arg9 obj/str Up to 9 further arguments to the
operator in the same form as arg0
KEYWORD PARAMETERS:
/return_operator If set, then return the SMEI_OPERATOR
object reference, by default the
generated sequence is returned.
get_level int The calling level from which to get
the object being argumentified
(usually only used by the
interpreter).
For "function" operators, any keys to the function can be passed.
OUTPUTS:
ref objref The sequence or operator reference generated.
NOTES:
When the argument is expressed as a string, then the object
referred must exist at the top $MAIN$ level in SSWIDL. The
format is "name{plane}[start:stop:step]", if no plane is given
then the "processed" plane is assumed, if no range specifier
is given for a sequence then the whole sequence is assumed.
CALLS: ***
MAKE_SMEI_OP, smei_msg
RESTRICTIONS:
A Maximum of 10 arguments to the operator may be specified
MODIFICATION HISTORY:
Original: 28/10/03; SJT
Add get_level keyword: 30/10/03; SJT
[Previous]
[Next]
NAME:
makemovie
CALLS:
[Previous]
[Next]
NAME:
MASK_OFF
PURPOSE:
To set the off sky regions of the image to a specified colour
CATEGORY:
Utils
CALLING SEQUENCE:
mask_off, image, index
INPUTS:
image byte The image to mask
index byte The value to use in the off-sky area
projection int The projection of the image
CALLS: ***
AITOFF, REVERSE
RESTRICTIONS:
The proper plot transform must have been set.
MODIFICATION HISTORY:
Original: 18/7/03; SJT
Handle projection information: 13/2/04; SJT
[Previous]
[Next]
NAME:
max_pos
PURPOSE:
Finds the position of maximum in a 2D array
CALLING SEQUENCE:
max = max_pos(f)
INPUTS:
f array
OUTPUTS:
max fltarr(2) 2D array containing the position of the maximum
max(0) = x-coordinate of maximum
max(1) = y-coordinate of maximum
(values based on array index)
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS
ArrayLocation
CALLS: ***
ArrayLocation
CALLED BY:
xyoff
PROCEDURE:
The indices of the element with the max. value are obtained from
a call to `max'.
If the element has a neighbour on either side (in horizontal or
vertical direction) the x and y positions of the maximum are refined
by fitting a quadratic polynomial through the maximum array element
and its two neighbours.
MODIFICATION HISTORY:
H. Cohl, 20 Nov, 1990 --- Initial implementation.
[Previous]
[Next]
NAME:
MCLEANER
PURPOSE:
Remove blemishes from images by successive median filters.
CATEGORY:
Utils
CALLING SEQUENCE:
cimg = mcleaner(img[, thresh])
INPUTS:
img float The images to be cleaned.
OPTIONAL INPUTS:
thresh float The threshold at which to consider a feature
to be a blemish (default 0.5)
KEYWORD PARAMETERS:
max_scale int The largest median scale to use
(default 21)
iscorr byte A names variable to hold a map of
which pixels have been corrected.
resid float A named variable to hold the
corrections applied.
/show If set, then show the progress of the
cleaning. (Assumes a window big enough
for 2 copies of the imput image is
available).
OUTPUTS:
cimg float The cleaned image.
PROCEDURE:
Median filters of increasing sizes from 3 up to max_scale are
applied. If a the difference between the original image and the
median-fltered version divided by 1 plus the sum of the
orignal and the filtered exceeds the threshold, then the
pixel is replaced by the median filtered version.
MODIFICATION HISTORY:
Original: 9/8/04
Increase spacing of scales from 2 to 4: 24/11/04; SJT
[Previous]
[Next]
NAME:
MercatorProj
PURPOSE:
Transforms latitude and longitude to X and Y coordinates in the
Mercator map projection.
CALLING SEQUENCE:
Pos = MercatorProj(Pos)
INPUTS:
Pos array[2,n]; type: float
n locations in the sky
Pos[0,n] longitudes
Pos[1,n] latitudes in [-90.,90.]
OPTIONAL INPUT PARAMETERS:
/degrees if set then all angles are in degrees (default: radians)
dabg array[3]; type: float: default: none
Euler angles for a rotation to be applied to
'Pos' prior to the Mercator projection.
(see FishEye)
zero_phase scalar; type: float; default: none
Additional offset applied to phase angle
(see FishEye)
OUTPUTS:
Pos array[2,n]; type: float
X,Y Cartesian coordinates (same structure as input array)
(in radians or degrees)
The longitude is scaled to [-180,+180].
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
AngleRange, EulerRotate, IsType, SyncDims
CALLED BY:
PlotEarthSkymap, PlotPolarSkymap
PROCEDURE:
MODIFICATION HISTORY:
FEB-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
MIN_NZ
Extract the smallest positive element of an array.
Call:
val = min_nz(array[, mindex, max=max])
Return Value:
val any The smallest positive value or -1 if no positive
values.
Argument:
array any input The array whose min is needed
mindex long output The (first) location in the array at
which the min value is found.
Keyword:
max any output The maximum value in the array.
full input If set, then just return the regular
minimum (to allow a procedure to
choose which by flag)
CALLED BY:
mk_minim, mk_stdim_list
History:
Prototype: 24/1/91; SJT
Improve and changes to smallest >0: 22/2/91; SJT
Add MAX keyword: 31/3/92; SJT
Add optional second argument for location of min value:
20/8/93; SJT
Add "finite" condition: 6/12/93; SJT
Add full key: 2/5/02; SJT
Add _extra to pass any extra keys direct to min (e.g. /nan):
4/8/04; SJT
[Previous]
[Next]
NAME:
mk_flick
PURPOSE:
Make movie from group of image files
CATEGORY:
sat/idl/util
CALLING SEQUENCE:
PRO mk_flick, movie, filter, $
delay = delay , $
loop = loop , $
mpeg = mpeg , $
png = png , $
gif = gif , $
first = first , $
last = last , $
fps = fps , $
bits = bits , $
timestamp=timestamp , $
frames = frames , $
cleanup = cleanup
INPUTS:
movie scalar; type: string
name of movie file; if no directory is specified the
movie file is created in the current directory
filter scalar or array; type: string
a scalar identifying a group of image files. This
could be a directory (all files) or a filter containing
a wild card. An array should be a list of file names.
OPTIONAL INPUT PARAMETERS:
first=first scalar; type: integer
last =last scalar; type: integer
number of images used to make movies
use only first or last group of files (after sorting
file names) to make a movie
/png makes an mng movie (this is the default)
/mpeg makes an mpeg movie
/gif makes an animated gif movie using gifsicle
Keywords for mng and gif movies (tested with convert and gifsicle):
delay=delay sets the delay between images in units of 0.01 seconds
/loop created an animation with an infinite loop
ffmpeg keywords:
fps=fps frames per second
bits=bits bits per second
OUTPUTS:
(creates movie file)
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
CheckDir, FILEPATH, FindAllSubDirs, GetFileSpec, InitVar, IsType, SetFileSpec
UNIQ [1], UNIQ [2], UNIQ [3], do_file, hide_env, qFramestamp
CALLED BY:
qView_Save2File, vu_movie, vu_quick_movie
RESTRICTIONS:
Runs only on Linux so far.
PROCEDURE:
PNG animation (mng movie):
Uses 'convert'. This is part of ImageMagick, and is usually located
in /usr/X11R6/bin or /usr/bin. It is called with keywords -loop 0
(if /loop is set) and -delay <delay> (if delay=delay is specified).
GIF animation (gif movie):
Uses 'gifsicle'. It is called with keywords --loop (if /loop
is set) and --delay=<delay> (if delay=delay is specified).
MPG animation (mpeg movie)
Uses 'ffmpeg'. It is called with keywords fps and bits (if provided
as keywords).
The executable is located by spawning a 'which' command, i.e. the
movie maker program must be in the path.
MODIFICATION HISTORY:
APR-2001, Paul Hick (UCSD/CASS)
SEP-2001, Paul Hick (UCSD/CASS)
Merged Kevin's mk_mpeg with this procedure.
MAY-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added PNG animation. This is now the default.
OCT-2006, John Clover, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
MPEG support is now done with ffmpeg
[Previous]
[Next]
NAME:
MK_IMGHDRTXT
PURPOSE:
Make an image header listing file (to speed up searching for
images).
CATEGORY:
UTILS
CALLING SEQUENCE:
mk_imghdrtxt, path
INPUTS:
path string The directory for and in which to make the
img_hdr.txt file (if omitted use the current
directory).
CALLS: ***
FF_SUMMARY, self_help
SIDE EFFECTS:
A file called img_hdr.txt if generated in the specified directory
FILE FORMAT:
The fields written are:
Filename A35
Start time (I4.4,I4.3,I3.2,':',I2.2)
Duration F7.3
Image size (I5,'x',I4)
Flags (' ',A7)
MODIFICATION HISTORY:
Original: 7/1/03; SJT
Modify to allow use of a tree to store files: 1/7/03; SJT
[Previous]
[Next]
NAME:
mkhdr_frm
PURPOSE:
Adds parameters to the fits header
CATEGORY:
camera/idl/frm
CALLING SEQUENCE:
new_hdr = mkhdr_frm(hdr)
INPUTS:
newhdr the hdr that is having parameters added
to it
hdr hdr information to add on
OPTIONAL INPUT PARAMETERS:
OUTPUTS:
OPTIONAL OUTPUT PARAMETERS:
newhdr=newhdr array[1]; type: structure
frame header
INCLUDE:
@compile_opt.pro
CALLS: ***
FXADDPAR [1], FXADDPAR [2]
SEE ALSO:
SIDE EFFECTS:
RESTRICTIONS:
PROCEDURE:
MODIFICATION HISTORY:
JUL-2003, Austin Duncan (UCSD/CASS; a5duncan@yahoo.com)
[Previous]
[Next]
NAME:
mpc_body
PURPOSE:
Get list of bodies for which MPC ephemerides are available
CATEGORY:
smei/gen/idl/ephem
CALLING SEQUENCE:
FUNCTION mpc_body, body, file=file, number=number, index=index, count=count, total_count=total_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:
Result 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:
big_body, big_eph, big_orbit, mpc_eph, smei_frm_where
PROCEDURE:
> Currently only 9P/Tempel (comet Tempel 1 around 'deep impact' time) is available
> The MPC files are searched for in the subdirectory 'mpc' of the directory
where this procedure is located.
MODIFICATION HISTORY:
JUL-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Based on usno_body()
[Previous]
[Next]
NAME:
mpc_eph
PURPOSE:
Get position from MPC ephemerides
CATEGORY:
smei/gen/idl/ephem
CALLING SEQUENCE:
FUNCTION mpc_eph, UT, body, $
center = center , $
location = location , $
speed = speed , $
to_sphere = to_sphere , $
degrees = degrees , $
precess = precess , $
to_ecliptic = to_ecliptic,$
source = source , $
get = get , $
_extra = _extra , $
silent = silent
INPUTS:
UT scalar; type: double
Julian date when ephemerides are needed
body scalar; type: string or integer; default: 'tempel_1'
body name or body number (see: mpc_body)
OPTIONAL INPUT PARAMETERS:
center=center
scalar; type: integer; default: jpl_body(/sun)
by default, heliocentric coordinates are returned.
if center is set to a non-zero value between 1 and 9
then the coordinates are centered on the corresponding
planet (e.g. center=3 returns geocentric coordinates)
source=source
scalar; type: string; default: who_am_i(/dir)/mpc
By default MPC ephemeris files are looked for in subdirectory
mpc of the directory where this source code is located
Use this keyword to point to another directory.
OUTPUTS:
Result array[6] or array[6,*]; type: double
array[0:2,*] = position in AU
array[3:5,*] = velocity in AU/day
If the MPC ephemeris could not be determined
(because the ephemeris file could not be located or because
the time is outside the range of the ephemeris)
then all components are set to the double precision NaN
value !values.d_nan.
OPTIONAL OUTPUT PARAMETERS:
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
AngleRange, AngleUnits, BadValue, CV_COORD, CvPrecess, CvSky, FILEPATH, InitVar, IsTime
IsType, SuperArray, TimeGet, TimeInterpol, TimeLimits, TimeOp, TimeSet, TimeUnit
flt_read, jpl_body, jpl_eph, mpc_body, who_am_i
CALLED BY:
big_eph, smei_frm_where
PROCEDURE:
Ephemeris files can be retrieved from
http://cfa-www.harvard.edu/iau/MPEph/MPEph.html
Fill out the form asking for geocentric coordinates and specify
- name of minor planet or comet
- ephemeris start date
- number of dates to output
Other fields should not matter. Save the html file produced on the
website and put in the subdirectory mpc of the directory where this
source code file is located.
The ephemeris record should look like this:
Date UT R.A. (J2000) Decl. Delta r El. Ph. m1 Sky Motion
h m s "/min P.A.
2005 04 01 000000 13 21 22.5 +12 55 12 0.800 1.772 160.0 11.1 11.2 0.45 286.7
MODIFICATION HISTORY:
JUL-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu)