[Previous]
[Next]
NAME:
GAUSS_CLEANER
PURPOSE:
Convenient compound call of GAUSS_REMOVE to clean up SMEI
images (probably better-suited to Fisheyes than Aitoffs)
CATEGORY:
Utils
CALLING SEQUENCE:
imgc = gauss_cleaner(img)
INPUTS:
img float The image to be cleaned
OUTPUTS:
imgc float The cleaned image.
CALLS: ***
GAUSS_REMOVE
EXAMPLE:
A typical usage of this procedure would be in conjunction with
the SMEI_CALCULATE interface. e.g.:
smei_calculate, ss1, '(gauss_cleaner ss)'
MODIFICATION HISTORY:
Original: 30/7/04; SJT
[Previous]
[Next]
NAME:
GAUSS_REMOVE
PURPOSE:
Clean up an image by subtracting discrete gauassian features
from it.
CATEGORY:
Utils
CALLING SEQUENCE:
imgn = gauss_remove(img[, wsize=wsize, threshold=threshold, $
show=show, order=order, residual=residual])
INPUTS:
img float The image to be cleaned, this must be a named
variable as ithe cleaing is done in place.
KEYWORD PARAMETERS:
wsize int The size of the window to use for the fitting
(default 25x25)
threshold float The theshold for subtracting a feature.
show int If present and non-zero display extra
information about the fitting, if explicitly
zero, then suppress progress info.
order int The order of the polynomial fit to precede the
gaussian fit (default 2)
residual float A named variable to hold the blemishes subtracted.
OUTPUTS:
imgn float The image with the "blemishes" removed
CALLS: ***
GAUSS2DFIT, MEAN, SFIT
CALLED BY:
GAUSS_CLEANER
MODIFICATION HISTORY:
Original: 28/7/04; SJT
Converted to function and renamed: 30/7/04; SJT
[Previous]
[Next]
NAME:
GENERAL_SPEED
PURPOSE:
Calculate apparent HT of TIPD from speed and size
CATEGORY:
Utils
CALLING SEQUENCE:
p = general_speed(t, v, th)
INPUTS:
t the times at which to get heights (hours)
v The actual speed (km/s)
th The size (half angle of the transient) (degrees)
OUTPUTS:
p The apparent height a a function of time.
OPTIONAL OUTPUTS:
vp The apparent speeds
MODIFICATION HISTORY:
Original: 12/6/03
[Previous]
[Next]
NAME:
GeographicInfo
PURPOSE:
Return geographic longitude of specified location
CATEGORY:
Trivial
CALLING SEQUENCE:
PRO GeographicInfo, UT, previous=previous, next=next, degrees=degrees, $
nagoya = nagoya, $
cambridge = cambridge, $
mexart = mexart, $
tmo = tmo, $
location = location, $
geolng = geolng, $
geolat = geolat, $
UTnoon = UTnoon, $
RAnoon = RAnoon, $
RAlocal = RAlocal
INPUTS:
UT array; type: time structure
UT times
/nagoya if set, return location of Nagoya (Japan)
/cambridge if set, return location of Cambridge (UK)
/tmo if set, return location of Table Mntn Obs (US)
location geographic longitude of requested location
(in radian, or if /degrees is set, in degrees)
OPTIONAL INPUT PARAMETERS:
/degrees if set, all input and output angles are in degrees
(default: radians)
/previous check for previous noon
/next check for next noon
if neither /previous or /next is set then the nearest
noon is checked
OPTIONAL OUTPUT PARAMETERS:
geolng scalar; type: float
geographic longitude
geolat scalar; type: float
geographic latitude
UTnoon array; type: time structure
UT for nearest/previous/next time when Sun crossed local meridian
(i.e. local noon)
RAnoon array; type; float
right ascension of local meridian at times UTnoon
RAlocal array; type; float
right ascension of local meridian at times UT
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
AngleRange, BadValue, InitVar, IsTime, IsType, SubArray, SyncArgs, TimeGST, TimeGet
TimeOp, TimeSet, TimeUnit, ToRadians, big_eph, jpl_body
CALLED BY:
PlotEarthSkymap, PlotPolarSkymap, vu_NagoyaSourcemap, vu_nagoyaskymap
PROCEDURE:
Geographic coordinates are hardwired
MODIFICATION HISTORY:
SEP-1999, Paul Hick (UCSD/CASS)
FEB-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added tmo and geolat keywords
[Previous]
[Next]
NAME:
GET_COMP_NAME
PURPOSE:
Return the actually existing possibly compressed name of the
file matching the requested name.
CATEGORY:
Utils
CALLING SEQUENCE:
cfile = get_comp_name(file)
INPUTS:
file string The base filename (including directory if
needed)
KEYWORD INPUTS:
/return_base If set, then strip off any compression
suffix. No checks are made for existence in
this case.
Any keywords accepted by the FILE_TEST function may be passed.
OUTPUTS:
cfile string The actually existing filename. (Returns the
empty string if nothing is found).
CALLED BY:
FF_SUMMARY
PROCEDURE:
Just check for the existence of the possible compressed
forms. And returns the first match.
MODIFICATION HISTORY:
Original: 24/6/05; SJT
[Previous]
[Next]
NAME:
Get_Page
PURPOSE:
Complete output procedure set up with Set_Page.
Submit PostScript or HP file to print queue
CATEGORY:
Plotting
CALLING SEQUENCE:
Get_Page [,File, /color] Close device & print & delete
Get_Page [,File, /killfile] Close device & delete
Get_Page [,File, /keepfile ,/color] Close device & keep
Get_Page [,File, /keepfile, /printfile ,/color]
Close device & print & keep
OPTIONAL INPUTS:
File scalar; type: string; default: !ThePlotFile
file name to be used for plot filefile name. In general the common block
default should be use. Primarily useful for /gif and /bmp ouput.
/keepfile
keepfile=KeepFile
scalar; type: string or byte
(HP only) the plot file will be saved
If KeepFile is a valid file name it is used for the saved plot file.
(this option is only set up for the HP printer on CASS01 and depends
on the LIBPRN command procedure).
/printfile (HP and PS)
if set the plot file is submitted for printing
This is the default for HP and PS
/killfile (HP, PS and EPS)
closes the plot device, and deletes the plot file
/freezedev by default the plot device is set back to !TheTerminal.
If /freezedev is set the device will remain at the setting found when
Get_Page was called (usually the printer device !ThePrinter)
/color plot in color (only for PS files)
/gif
/png
/jpg
/bmp can be used in combination with the File argument to save the
content of the current window into a GIF or BMP file.
If File has the extension .gif or .bmp then the keyword does not need
to be specified.
/silent suppresses a bunch of informational messages
INCLUDE:
@compile_opt.pro ; On error return to caller
CALLS: ***
FILEPATH, GetFileSpec, InitVar, IsDisplay, IsPrinter, IsType, LOADCT, Reset_Colors
SetFileSpec, SuperArray, WRITE_BMP, WRITE_GIF, do_file, hide_env, put_logo, twin
CALLED BY:
even_light_corrections, even_light_photometry, even_light_registration
qBar_Print, qLine_Print, qSave2File_Save, qSet_Page, smei_frm_summary
smei_hdr_plot, smei_sky, vu_get_page, vu_image
SEE ALSO:
Set_Page
PROCEDURE:
Set_Page and Get_Page are supposed to be used together: Set_Page starts the
output procedure, Get_Page completes it. Get_Page uses the file name save in
common block 'devices' to determine what kind of output to produce (EPS, GIF, BMP,
HP, PS, etc.).
For the PRINTER device no plot file is created but instead output is send directly
to the printer. Hence none of the keywords are useful. Get_Page will always close
the PRINTER device (effectively forcing the printer to start printing).
For EPS a file name is selected using 'set_page'. The file name is saved in common
block 'devices'. Here the EPS file is just closed.
For GIF and BMP a tvrd() is executed, and the return value is written into a file
with the name in !ThePlotFile. Alternatively the File argument is used to specify a
file name. If the name does not have extension .gif or .bmp then the keyword /gif
or /bmp must be set explicitly.
MODIFICATION HISTORY:
Based on PSPLOT, written DMZ (ARC, Aug'90)
July 1991, Paul Hick (ARC)
1992, Paul Hick (UCSD/CASS); added option for plotting to HP printer
2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added logo keyword
[Previous]
[Next]
NAME:
GetColors
PURPOSE:
Convert array of function values to equivalent color indexes.
Optionally plot a legend.
CALLING SEQUENCE:
FUNCTION GetColors, Value, BreakVal, BreakName, $
open = open , $
legend = legend , $
rimlegend = rimlegend , $
format = format , $
ctable = ctable , $
cpart = cpart , $
usedcolors = usedcolors, $
badforeground=badforeground, $
badbackground=badbackground, $
charsize = charsize , $
flip = flip , $
noedge = noedge , $
ncolors = ncolors , $
step = step , $
_extra = _extra
INPUTS:
Value array; type: any
function values
BreakVal array; type: any
function values between adjacent colors
OPTIONAL INPUT PARAMETERS:
/legend if set, a legend is plotted at the left
edge of the screen
rimlegend=rimlegend scalar; type: any; default: 0
sets the thickness of the bounding box around the legend
format=format scalar; type: string
format used to label the legend (only used if
BreakVal is a float array)
ctable=ctable scalar; type: integer
used to load a color table with LOADCT
(only if !d.n_colors=16)
cpart=cpart array[2]; type: float
fractions of one; limits the range of color indices
used to cpart*(!d.n_colors-1)
/noedge avoids using color indices 0 and !d.n_colors-1
this overrides the cpart setting.
(these sometimes are set to black and white and don't
fit in with the rest of the color table).
_extra=_extra
/badforeground if set then bad values (detected with the
finite function) are set to the foreground
color (!p.color)
/badbackground if set then bad values are set to the foreground
color (!p.background)
/flip uses color table in reverse order, i.e. with increasing
fnc value corresponding to decreasing color index
OUTPUTS:
Result array; type: byte
array with color indices (same dimensions as Value)
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar, IsType, LOADCT, REVERSE, UNIQ [1], UNIQ [2], UNIQ [3], gridgen
CALLED BY:
PlotEarthSkymap, PlotPlanarCut, PlotPolarSkymap, PlotSolarDisk, PlotSynopticMap
nagoya_glevel, vu_synopticmap
SIDE EFFECTS:
The BreakVal array is sorted
RESTRICTIONS:
#break values = n_elements(BreakVal) must be less than
#colors = !d.n_colors
PROCEDURE:
The BreakVal array with N = n_elements(BreakVal) elements divides the data
range into N+1 interval (the 1st interval covers data values below
BreakVal[0], the last interval covers data value above BreakVal[N-1]. A
data value is matched to a color index depending on the interval it belongs to.
The # colors needed is 1+N (N=n_elements(BreakVal).
The 1+N color indices are calculated as
Col = round( (!d.n_colors-1.)/nBreak*indgen(nCols) )
i.e. as nearly evenly spaced over the full range 0,!d.n_colors-1
[Col[0]=0, Col[nBreak]=!d.n_colors-1]
The legend is a vertical color bar (color 0 to nBreak from bottom
to top) at the left side of the screen. The BreakVal values are
plotted at the borders between adjacent colors. A maximum of 8 evenly
spaced numbers is plotted
MODIFICATION HISTORY:
SEP-1992, Paul Hick (UCSD/CASS)
APR-1993, Paul Hick (UCSD/CASS)
removed restrictions to !d.n_colors=8 and 16
AUG-1999, Paul Hick (UCSD/CASS)
added a check for bad values using the 'finite' function. Corresponding
entries in the Color output array are now set to -1 (these will be ignored
by ColorSkybox).
SEP-1999, Paul Hick (UCSD/CASS)
added badforeground and badbackground options
added /open keyword
SEP-2003, Paul Hick (UCSD/CASS)
added cpart keyword
OCT-2003, Paul Hick (UCSD/CASS)
added /flip and /noedge
MAY-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added /rimlegend
[Previous]
[Next]
NAME:
GetFileSpec
PURPOSE:
Retrieve file name information from the common block
set by SetFileSpec.
CATEGORY:
I/O, string manipulation
CALLING SEQUENCE:
Name = GetFileSpec(from=From, upto=Upto)
INPUTS:
setfile
array; type: string
array of file names is fed into SetFileSpec before anything
else is done. If not specified then the information set up by
a previous call to SetFileSpec is used.
From, UpTo, Part
scalar; type: string
Any of the following six strings can be used:
'NODE','DEVICE','DIRECTORY','NAME','TYPE','VERSION'
(a prefix 'FILE' is permitted, as in 'FILENAME')
The input is case-insensitive
Only a unique starting substrings has to be specified
If From is not specified, From='NODE' is assumed
If UpTo is not specified, From='VERSION' is assumed
OPTIONAL INPUT PARAMETERS:
/AsFileName if UpTo = 'Directory' and AsFileName is set than the
directory names are returned as file names, i.e.
in vms a *.DIR name is returned; in Win32 and Unix
the trailing (back)slash is removed. MacOS is not
implemented.
OUTPUTS:
Name string array
The array structure is determined by the input to the
SetFileSpec call that set up the internal data.
Includes all FileParts in between and including the
From and UpTo strings
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar, IsType, SetFileSpec, SyncDims, os_separator, strposn
CALLED BY:
FindAllFiles, FindAllSubDirs, Get_Page, Set_Page, bin_read, bin_write, do_file
findfile_fix, gunzip_file, gzip_file, htmd_cat, img_read, makemovie, mk_flick
mpc_body, nso_fe_read, qImage, qImage_Pick, qImage_cw_DrawEphem
qImage_cw_Property, qImage_cw_Save, qImage_cw_SmeiMask, qSave2File
qSave2File_Pick, qSave2File_Save, qSet_Page_Pick, qView, qView_FileFilter
qView_PickFiles, qView_Save2File, qView_Shortname, qView_TMO_tracksky
qsmei_sky_Pick, qvu_pick, sgp_body, smei_base_testcase, smei_buf
smei_buf_getframe, smei_findcrazy, smei_frm_cp, smei_frm_cvhdr, smei_frm_get
smei_frm_name, smei_frm_property, smei_frm_read, smei_frm_update, smei_frm_write
smei_getfile, smei_hdr_make, smei_star_remove, smei_star_writepnt, smei_time
smei_zodiac_remove, unhide_env, usno_body, vu_RemoteView, vu_check, vu_earthskymap
vu_get_page, vu_getdata, vu_header, vu_image, vu_movie, vu_quick_movie
vu_vox_sequence, vu_vox_write, vu_write, who_am_i, wso_read, wso_write
www_help_crosslinks, www_help_files, www_help_get_header, www_help_get_info
EXAMPLE:
SetFileSpec, 'ud1:[test]file.txt' Establishes internal data
print, GetFileSpec() Prints: ud1:[test]file.txt
print, GetFileSpec(upto='dir') Prints: ud1:[test]
print, GetFileSpec(from='name') Prints: file.txt
print, GetFileSpect(from='dev',upto='dev') Prints: ud1:
INCLUDE:
@filespec_common.pro ; Common block with arrays File and Parts
SIDE EFFECTS:
> Input is converted to uppercase
RESTRICTIONS:
> Internal data must have been set up by SetFileSpec
PROCEDURE:
Extracts data from common block set by SetFileSpec
MODIFICATION HISTORY:
DEC-1997, Paul Hick
JAN-2001, Paul Hick (UCSD/CASS)
Added part keyword
OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added setfile keyword
[Previous]
[Next]
NAME:
GetNagoyaSources
PURPOSE:
Extract Nagoya IPS observations from yearly data files
CATEGORY:
I/O
CALLING SEQUENCE:
n = GetNagoyaSources(trange, subdir=subdir, point_sources=point_sources)
INPUTS:
trange scalar or array[2]; type: time structure
time range (begin and end time)
a scalar is interpreted as [trange, trange+1 day]
(i.e. a one day time range starting at trange
OPTIONAL INPUT PARAMETERS:
subdir=subdir scalar; type: string; default='daily'
subdirectory in $dat/nagoya where to look for data files
/degrees if set pp will be in degrees (default: radians)
OUTPUTS:
n scalar; type: long;
# ips sources in time range
OPTIONAL OUTPUT PARAMETERS:
point_sources=point_sources
array[n]; type: structure
structure with IPS sources inside time range
point_sources.name = string with source name
point_sources.pp = 2-element array with RA and decl of source
point_sources.tt = time structure with time of observation
point_sources.vv = IPS velocity
point_sources.gg = IPS g-level
point_sources.xy = used by PlotEarthSkymap to set pixel locations of sources
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
BadValue, CvPrecess, FILEPATH, InitVar, IsType, TimeFixYear, TimeGet, TimeOp, TimeSet
TimeString, TimeUnit, ToDegrees, txt_read, vu_point_source
CALLED BY:
qNagoya_PointSources, vu_NagoyaSourcemap, vu_nagoyaskymap
PROCEDURE:
> All relevant yearly IPS data files are read to find observations inside
specified time range. These files are stored in $dat/nagoya/'subdir'
where subdir is supplied as keyword.
> Files containing a list of IPS sources with celestial coordinates
(presumably in B1950) are stored in directory $dat/nagoya/sources
A slightly different list is used each year. Currently this list
contains the source name, right ascension, declination and an expected
source intensity.
> RA and dec for the sources are precessed to the current epoch.
MODIFICATION HISTORY:
SEP-1999, Paul Hick (UCSD/CASS)
JUL-2000, Paul Hick (UCSD/CASS)
record length for nagoya.* files changed from 66 to 76 to
account for extra column with scintillation index data.
MAY-3003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added precession of source coordinates from B1950 to current epoch.
[Previous]
[Next]
NAME:
grd_read
PURPOSE:
Very provisional reader for .grd files
CATEGORY:
gen/idl/util
CALLING SEQUENCE:
status = read_grd(file, data)
INPUTS:
file scalar; type: string
fully-qualified file name
OPTIONAL INPUT PARAMETERS:
/dimension is set then only the array dimension from the header
is returned
OUTPUTS:
status scalar; type: integer
always 1
data array[n,m]; type: float
data array
array[2]: type: integer
(only if /dimension is set)
Size of array (i.e. values of n and m)
OPTIONAL OUTPUT PARAMETERS:
error_message=error_message
scalar; type: string
always null-string
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar, IsType, destroyvar, do_file, flt_string, gunzip_file, hide_env
CALLED BY:
img_read, makemovie, smei_mkglare, smei_mksidereal, smei_mkstdstar
SEE ALSO:
PROCEDURE:
MODIFICATION HISTORY:
JUL-2003, Paul Hick (UCSD/CASS)
SEP-2003, Paul Hick (UCSD/CASS)
Added /dimension keyword
SEP-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added /norow keyword
[Previous]
[Next]
NAME:
gridfill
PURPOSE:
Removes empty bins. An empty bin is given the average over all
neighbours with valid function values.
CATEGORY:
Plotting: contours
CALLING SEQUENCE:
Z = gridfill(Z,nfile=nFill,weightfnc=WeightFnc,status=S)
INPUTS:
Z 2D array; any type
If of type float, then invalid grid values are marked by !values.f_nan
OPTIONAL INPUTS:
nfill=nFill scalar; type integer; default: 0
<= 0: fill all empty bins with extrapolated values
> 0: fill empty bins with more than nFill neighbours
weightfnc=WeightFnc
scalar; type string; default: not present
name of function to calculate weights (see PROCEDURE)
OUTPUTS:
Z 2D array; type float
same as input array with invalid grid values replaced by averages
(if nfill>0 not all invalid values may have been filled in)
OPTIONAL OUTPUTS:
status=S
2D array; type byte
array identifying the extrapolated values:
= 1 contents of bin is same as valid input value
= 2 contents of bin is extrapolated value
nFill>0 only:
= 0 empty bin with less than nFill neighbours
Z[.,.] = !values.f_nan (same as input).
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
ArrayLocation, InitVar
CALLED BY:
InterpolateHeliosphere, PlotSynopticMap, wso_read, wso_write
PROCEDURE:
> If nFill <= 0 then:
Step 1: for each empty bin, count the number of non-empty neighbours
Step 2: find the subset of empty bins with the maximum number of
non-empty neighbours
Step 3: for the subset of step 2, calculate the average over the non-
empty neighbours and assign this average to the empty bin
Step 4: Go to step 1
Repeat until there are no empty bins left.
> nFill > 0:
Step 1: for each empty bin, count the number of non-empty neighbours
Step 2: find the subset of empty bins with nFill or more non-empty
neighbours
Step 3: for the subset of step 2, calculate the average over the non-
empty neighbours and assign this average to the empty bin
Step 4: Return.
> By default neigbouring function values are averaged with weight=1.
If WeightFnc is specified, it is used to calculate the weights instead.
The function has the form
function WeightFnc(I,J,inX,jnY,Z[inX,jnY])
I,J are the indices of the bad pixel; inX,jnY are arrays with the
indices of good neighbour pixels, and Z[inX,jnY] are the
function values in the good neighbours.
MODIFICATION HISTORY:
1990, Paul Hick (UCSD)
24-MAR-1999, Paul Hick (UCSD), converted from Fortran
[Previous]
[Next]
NAME:
gridgen
PURPOSE:
Generate array of x,y,z coordinates for a multi-dim area
CALLING SEQUENCE:
FUNCTION gridgen, nn, $
origin = origin , $
edge = edge , $
open = open , $
one = one , $
range = range , $
multid = multid , $
double = double
INPUTS:
n array[ndim]; type: integer
(ndim = 1,2,3)
dimensions of area in x, x-y, or x-y-z directions
OPTIONAL INPUT PARAMETERS:
/one if set, scales output array to range [0,1] in all dimensions
one=one array[ndim]; type: integer with value 0 or 1
set scaling for each of the dimension in 'n' separately
/open if set, then the pixel centers for the 'pixel edges' [0,n]
is returned
open=open array[ndim]; type: integer with value 0 or 1
set 'open' status for each of the dimensions separately
This is the same as gridgen1d(n, origin=-0.5)
The origin=0.5 is added to the origin specified in keyword
origin.
/edge if set, then coordinates for the 'pixel edges' of pixels
[0,..n-1] is returned
edge=edge array[ndim]; type: integer with value 0 or 1
set 'edge' status for each of the dimensions separately
This is the same as gridgen(n+1, origin=0.5)
The origin=0.5 is added to the origin specified in keyword
origin.
CALLED BY:
EarthSky3DLoc, EarthTransit3DLoc, GetColors, PlotEarthSkymap, PlotPlanarCut
PlotPolarSkymap, PlotSolarDisk, PlotSynopticMap, RemoteView
RemoteView_CMEDensity, RemoteView_CubeFrame, RemoteView_CurrentSheet
RemoteView_FOV_xyz, RemoteView_VertexSphere, RemoteView_rgbo, TMO_skymotion
TMO_tracksky, ThomsonLOSStep, TimeXAxis, big_orbit, even_light, even_light_figures
even_light_pedestal, even_light_platescale, jpl_test, plot3darc, qGlitch_Run
qImage_cw_BoxCosine, qImage_cw_SmeiMask, qImage_cw_ZEllipse, qView_PlotSeries
qvu_draw, smei_ccd2sky, smei_cv, smei_sky, smei_sky_read, smei_star_fit
smei_star_standard, smei_zodiac_fit, vu_get, vu_insitu, vu_insitucurve
vu_planarcut, vu_solardisk, vu_synopticmap, vu_timeseries, vu_type_skymap
vu_vox_drawelatitude, vu_vox_drawelongitude, vu_vox_drawhlatitude
vu_vox_drawhlongitude, vu_vox_draworbit, vu_vox_drawsphere, vu_vox_write
wedge_content, wso_read
Example: gridgen(5, /edge) = [-0.5,0.5,1.5,2.5,3.5, 4.5]
origin=origin
array[ndim]; type: float
defines the origin in units of output grid
(i.e. usually in array indices; but if /one or range are
used then it is in units of the data range)
range=range scalar, array[ndim] or array[2,ndim]
if scalar then the output array is scaled to the range
[0,range] in every dimension
if array[ndim] then the output array is scaled to the ranges
[0,range[i]], i=0,ndim-1, in each dimension
if array[2,ndim] then the output array is scaled to the ranges
[range[0,i],range[1,i]], i=0,ndim-1 in each dimension
/multid (only in ndim > 1) reforms output array to [ndim,n] array.
The default is a two-dim array of size
[ndim,n[0]*n[1]*..*n[ndim-1]]
OUTPUTS:
Result array[ndim,n[0],n[1],..,n[ndim-1]]; type: long integer or float
coordinates across the area
a float array is returned if keywords /one or /range
are used.
CALLS: ***
InitVar, IsType, gridgen1d
INCLUDE:
@compile_opt.pro ; On error, return to caller
RESTRICTIONS:
Currently onle 1, 2 and 3-dim cases are implemented
PROCEDURE:
> The origin is subtracted after applying the scaling implied by
keywords /one and range=range
> Combination of 'replicate' function and matrix multiplication #
MODIFICATION HISTORY:
OCT-2000, Paul Hick (UCSD/CASS)
Result of merging indgen1d, indgen2d, and indgen3d
JAN-2002, Paul Hick (UCSD/CASS)
Change all replicate(1.0,n) statements to replicate(1L,n) in the
last case block.
Using 1.0 will always return a float array even when an integer
return would be acceptable.
NOV-2005, Paul Hick (UCSD/CASS)
Added 4D version
SEP-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Substantial rewrite: generalized to work for any number
of dimensions (memory permitting)
[Previous]
[Next]
NAME:
gridgen1d
PURPOSE:
(For internal use by gridgen only)
CALLING SEQUENCE:
FUNCTION gridgen1d, nn, $
origin = origin, $
edge = edge , $
open = open , $
one = one , $
range = range , $
double = double
INPUTS:
nn scalar; type: integer
number of elements in grid
OPTIONAL INPUTS:
origin=origin
scalar; type: any numerical type
the origin is shifted AFTER
applying keywords one or range.
/open
/edge return edges of bins
the output
/one same as range=[0,1]
range=range
array[2]; type: any numerical type
scale array to this range
If range is of type integer then the grid
also will be type integer unless integer
truncation occurs.
/double if set return double precision grid
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar, IsType
CALLED BY:
gridgen
EXAMPLE:
gridgen(5) = [0,1,2,3,4]
gridgen(5,/open) = [0.5,1.5,2.5,3.5,4.5]
gridgen(5,/open,/edge) = [0,1,2,3,4,5]
gridgen(5,/one) = [0.0,0.25,0.5,0.75,1.0]
gridgen(5,/one,orig=0.5)= [-0.5,-0.25,0.0,0.25,0.5]
PROCEDURE
Sets up 1-dim grid. BE CAREFUL MIXING KEYWORDS.
MODIFICATION HISTORY:
OCT-2000, Paul Hick (UCSD/CASS)
SEP-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
If range is specified as integer then the return
array is returned as integer array also, after
checking that integer truncation has not occurred.
Keyword origin is now applied after processing
keywords one and range (if present).
[Previous]
[Next]
NAME:
GroupPixels
PURPOSE:
Divide a group of pixels in separate groups based on nearness of the pixels in a group
CATEGORY:
Tools
CALLING SEQUENCE:
Loc = GroupPixels(Locations, Positions, range=range, ngroup=nGroup, pgroup=pGroup, lgroup=lGroup)
INPUTS:
Locations 1D array, type integer
array of linear indices of pixel locations
Positions 3D array, type: float
x,y,z positions of pixels in 'Locations' array
(keywords sizeframe or dimension provide alternative
ways to specify x,y,z positions)
OPTIONAL INPUT ARRAY:
sizeframe=sizeframe size vector of image cube
dimension=dimension dimensions of image cube
if either of these is specified, then 'Positions' is ignored
Instead the dimensions of the image cube are used to
to get x,y,z pixel coordinates from 'Locations' using
ArrayLocation.
OPTIONAL INPUT PARAMETERS:
range=Range scalar, or vector with as many elements as Frame has dimensions
default: Range = 1
defines the distance in each dimension of Frame defining
how close the members of a group are.
/ellipsoid if set, Range is used to define an ellipsoidal region
if not set, Range defines a square region.
OUTPUTS:
Loc 1D array, type integer
same as input array Locations but with elements reordered
if Frame is supplied as an array (i.e. if /sizeframe is not set),
then groups will be ordered with the values of the highest
pixel in each group in decreasing order
OPTIONAL OUTPUT PARAMETERS:
ngroup=nGroup scalar, type long integer
number of groups of pixels in Loc
pgroup=pGroup 1D array[nGroup], type long integer
indicates the position in Loc where each group begins
lgroup=lGroup 1D array[nGroup], type long integer
indicates number of pixels in each group
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
ArrayLocation, InitVar, IsType
CALLED BY:
Find2DGlitch
PROCEDURE:
This procedure was written to group pixels in a 3D image cube, but I think it works
with cubes of any number of dimensions.
MODIFICATION HISTORY:
NOV-1998, Paul Hick (UCSD/CASS)
FEB-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added possibility to specify x,y,z coordinates for pixels explicitly
(in addition to specification of size vector of image cube only)
[Previous]
[Next]
NAME:
GuessRecs
PURPOSE:
Guess number of records and record length for binary file
CATEGORY:
Tricks
CALLING SEQUENCE:
R = GuessRecs(iu, approx_recl [, range, recl=recl])
INPUTS:
iu scalar; type: integer
logical unit number of open file
approx_recl scalar; type: integer
approximate record length in bytes
OPTIONAL INPUT PARAMETERS:
range scalar: type: integer: default: 1
range of recordlength tested is approx_recl +/- range
OUTPUTS:
R scalar; type: integer
guess at # records (-1 if not succesful)
OPTIONAL OUTPUT PARAMETERS:
recl = recl scalar: type: integer
guess at record length in bytes (= file size/# records)
(-1 if not succesful)
CALLS: ***
InitVar
CALLED BY:
txt_read
PROCEDURE:
The approximate record length specified as input does not include record
terminators (such as CR or CR+LF combinations).
If the approximate record length specified is L and the range is R then
for all values i=[L-R,L+R] the procedures checks whether i+1 or i+2 are factors
of the file size. The largest i that satisfies this criterion is used to set
the number of records in the file. The record length returned is the ratio of
file size and number of records (i.e. it includes the record terminators).
MODIFICATION HISTORY:
MAR-2000, Paul Hick (UCSD/CASS)
SEP-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Fixed order in which record lengths are tested. approx_recl is tested first.
Then record lenghts increasingly different from approx_recl:
approx_recl-1, approx_recl+1, approx_recl-2, approx_recl+2, etc.
[Previous]
[Next]
NAME:
gunzip_file
PURPOSE:
Unzip .gz. file
CATEGORY:
gen/idl/util
CALLING SEQUENCE:
FUNCTION gunzip_file, zipfile, rawfile, check=check, isgz=isgz, ramdisk=ramdisk
INPUTS:
zipfile scalar; type: string
file to be unzipped
OPTIONAL INPUT PARAMETERS:
/check if set then check whether the file exists
/ramdisk by default the unzipped file is written to $TEMP
if /ramdisk is set the environment variable $ramdisk
is tried first.
OUTPUTS:
status 0: unzip not successfull
1: file succesfully unzipped into file 'rawfile'
rawfile scalar; type: string
name of unzipped file (if status=1) or the blank
string (if status=0)
OPTIONAL OUTPUTS:
isgz=isgz 1 if input file was .gz file; 0 if not.
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
FILEPATH, GetFileSpec, InitVar, SetFileSpec
CALLED BY:
bin_read, flt_read, grd_read, img_read, smei_fts_read, txt_read, vox_read
PROCEDURE:
If the input file 'zipfile' does not exist or is not a .gz file then
status = 0 is returned.
The unzipped output file has the same name as the input file with
the prefix _tmp_ added and the .gz stripped.
By default the file is written to $TEMP. If /ramdisk is set then
$ramdisk is used (if the env var exists). Usually $ramdisk will point
to a ramdisk. Note that the user should set up the ramdisk and make
sure it is big enough to hold the unzipped file.
MODIFICATION HISTORY:
APR-2003, Paul Hick (UCSD/CASS)
JUL-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added /ramdisk keyword.
[Previous]
[Next]
NAME:
gzip_file
PURPOSE:
Unzip .gz. file
CATEGORY:
gen/idl/util
CALLING SEQUENCE:
status = gzip_file( file, zipfile)
INPUTS:
file scalar; type: string
file to be unzipped
OPTIONAL INPUT PARAMETERS:
/check if set then check whether the file exists
/nozip skip the actual zipping; only return the name
of the zipped file if it had been zipped
/force force gzip if file already exists
OUTPUTS:
status 0: zip not successfull
1: file succesfully zipped into file 'zipfile'
zipfile scalar; type: string
name of zipped file (if status=1) or the blank
string (if status=0)
OPTIONAL OUTPUTS:
isgz=isgz 1 if input file was .gz file; 0 if not.
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
FILEPATH, GetFileSpec, InitVar
CALLED BY:
smei_mksidereal, smei_mkstdstar, smei_star_remove, smei_zodiac_remove, vu_write
PROCEDURE:
If the input file 'zipfile' does not exist or is not a .gz file then
status = 0 is returned.
MODIFICATION HISTORY:
OCT-2003, Paul Hick (UCSD/CASS)
NOV-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added /nozip keyword