[Previous]
[Next]
PROJECT: CHIANTI
CHIANTI is an atomic database package for the calculation of
continuum and emission line spectra from astrophysical plasmas. It is a
collaborative project involving the Naval Research Laboratory
(Washington DC, USA), the Arcetri Observatory (Firenze, Italy), and the
Cambridge University (United Kingdom).
NAME:
Z2ELEMENT
PURPOSE:
provide identification strings
CATEGORY:
database.
CALLING SEQUENCE:
Z2ELEMENT, Iz, Name
INPUTS:
Iz: nuclear charge of ion of interest, i.e. 26 for Fe
OUTPUTS:
Name: a string identifying the element
CALLED BY:
CHIANTI_DEM
EXAMPLE:
> z2element,2,name
> print,name
> He
MODIFICATION HISTORY:
Written by: Ken Dere
March 1996: Version 2.0
[Previous]
[Next]
ZANYTIM2CDS
Convert any timestamp to CDS format...
To make this work, we have to escape from the bonds of IDL and invoke
a perl script.
To save overhead on large operations, you can vectorize the operation
by sending (and expecting in return) an array of time strings. If
you send an array instead of a single string, the strings are stored
in a temporary file and fed to perl in a lump.
10/22/96 - Added vectorization
Written 10/17/96 by Craig DeForest
INVOKATION
A = ZMDITIME2CDS(TIMESTR)
Outputs: Returns the CDS time string corresponding to the input time
string.
CALLS:
CALLED BY
closest_time
[Previous]
[Next]
zaspect - Fix up the aspect ratio of non-square-pixel
fits images, for easier manipulation.
To preserve the position information in the image, you can
also scale the image by a set number times the more magnified
axis' original scale. (Default is 3).
CALLS: ***
CONGRID [1], CONGRID [2], CONGRID [3], ISVALID [1], ISVALID [2], ISVALID [3]
ZHDRUNIT
EXAMPLE:
zaspect,in=a,ihdr=ahdr,out=b,ohdr=bhdr,n=3
b gets the image in a, stretched to have square pixels.
bhdr gets ahdr, with the appropriate mods to the image plane
coordinates.
COMMENT:
(Not carefully tested)
HISTORY:
Crufted together in the mists of time, CED
Modified for proper use of CRPIXn, 13-Mar-98 CED
[Previous]
[Next]
Bytscl an array to the specified percentages (as read off of
an xloadct window)
CALLS:
CALLED BY
zmovie
[Previous]
[Next]
ZCHECK_HDR
Check that a FITS header structure contains pointing information. If
it does, return it; if not, return '0'. /fix causes missing
values with defaults to be replaced by their default values.
The replacement happens in-place.
Usage:
if(not zcheck(ihdr,/fix)) then message,'Missing some tags.'
INPUTS:
ihdr - a FITS header structure to be checked. Multi-image structures
are allowed.
KEYWORDS (optional):
fix - causes missing values to be replaced by their defaults
hack - Causes missing values to be filled in, regardless of whether
there is a defined default.
Right now, the default-able values are:
CROT - 0
REFLECT - 0
pointing - Causes us to check only the pointing-related tags.
CAVEAT: ZCHECK_HDR only checks that the tags *exist* in the structure,
not that they have reasonable values.
CALLS: ***
FUG, JOIN_STRUCT [1], JOIN_STRUCT [2], NLM [1], NLM [2], STR2UTC [1], STR2UTC [2]
STR2UTC [3], anytim [1], anytim [2], anytim [3], anytim [4], anytim [5]
data_chk [1], data_chk [2], fitshead2struct, safetag, sswfits_struct [1]
sswfits_struct [2], zstr2utc [1], zstr2utc [2], ztype
CALLED BY:
COORD [1], MAKE_DIPOLES, datify, fixinate_eit, fixinate_lasco, fixinate_mdi
fixinate_trace, mdialign, solar_hdr, zheliographinize, zprfits, zstructify
zwritefits
HISTORY:
Written in the dim past, Craig DeForest
Fixed-up timestamp bug for multiple headers, 14-Jul-99
[Previous]
[Next]
NAME:
ZCLIP
PURPOSE:
Clip out a portion of an image to view, and keep track of its
pointing tags.
CALLING SEQUENCE:
ZCLIP,b=bottom,l=left,h=height,w=width,in=image,out=image
CALLS: ***
HEADFITS [1], HEADFITS [2], HEADFITS [3], ISVALID [1], ISVALID [2], ISVALID [3]
READFITS [1], READFITS [2], READFITS [3], zstructify
RESTRICTIONS:
The image must have the MSSTA alignment tags in the image header.
MODIFICATION HISTORY:
Created by Craig DeForest, 2/4/1995
Cleaned up to a one-pass clip 3/2/1995
Updated to structure-based headers, 14-Apri-1997
Vectorized, 25-April-1997
Modified for proper use of CRPIXn, 13-Mar-98 CED
[Previous]
[Next]
NAME:
ZCONTAINS
PURPOSE:
Determine whether a random fits header contains a particular
point on the Sun.
CALLING SEQUENCE:
ok = zcontains(hdr,x,y,xyhdr)
INPUT PARAMETERS:
HDR - the fits header to examine. May be vectorized.
X,Y - the point to look for
XYHDR - If present, then X and Y are in pixels in the given XYHDR.
INPUT KEYWORDS:
BUFFER - margin around the point which must also be contained
(default 0). This is specified in the same units as X and Y.
ARCSEC - boolean parameter. If specified, then X and Y are in arcsec
in solar coordinates
ARCMIN - boolean parameter. If specified, then X and Y are in arcmin
in solar coordinates
T0 - timestamp. If specified, then the point is derotated
to each header before checking. (Only works if the point
is within the solar disk).
HOWARD - boolean parameter. If specified, then Howard and Harvey
differential rotation is used for T0 compensation.
ALLEN - (default). if specified, then Allen et al differential
rotation is used for T0 compensation.
CARRINGTON - If specified, then Carrington (rigid) rotation is used
for T0 compensation.
RETURNS:
1 if the point is contained in the image described by HDR;
0 if the point is not. The return value has the same dimension
as HDR.
CALLS:
[Previous]
[Next]
zcorralign - Do correlation analysis on small translations to try co-aligning
allegedly identical images.
USAGE:
c = zcorralign,ref,in,[options]
INPUTS:
ref: The reference image
in: The image to be tweaked
OPTIONAL KEYWORD INPUTS:
tm: The maximum number of pixels to allow tweakage
ts: The step size over which to check tweakage
range: (Overrides 'tm') [[minx,maxx],[miny,maxy]] -- specify
the range of tweakage that is allowed
recurse:Causes recursive calls to zero in on a tweakage value
OPTIONAL KEYWORD OUTPUTS:
cmax: An array containing [dx,dy,corr] for the best offset found
CALLS: ***
CORRELATE, FUG, ISVALID [1], ISVALID [2], ISVALID [3], ztweak
Restrictions: for now, a and b should have the same scale and should
be large compared to the number of pixels to be tweaked...
Linear interpolation is used for sub-pixel tweaks.
[Previous]
[Next]
zcurs_ok
PURPOSE
To flash up a bunch of images and allow the user to
accept or reject 'em -- speeds manual inspection of
data cubes. Each image in `cube' is displayed, and the
user can accept or reject is by clicking the mouse
button in the display window.
USAGE
ok_arr = zcurs_ok(cube)
RETURNS
A boolean array indicating whether each image in `cube' was
accepted by the user or not.
HISTORY
Written sometime in early 1998, Craig DeForest
Modified 24-Nov-98: If the images are small enough,
or if we feed in aflag by hand, we do a "mosaic" type
scan. Much more sophisticated browser.
CALLS:
[Previous]
[Next]
NAME:
zd4
PURPOSE:
Rotate and/or reflect a fits image within the D4 group,
ie the symmetry group of a square. Saves processing
power for these operations, over using zscale.
CALLING SEQUENCE:
zscale,in=in,ihdr=ihdr,out=out,ohdr=ohdr, $
[rot=rot],[refl=refl]
PARAMETERS:
[none -- all are keywords]
KEYWORDS:
in, out, ihdr, ohdr: the "usual" zlib fits parameters
rot = the number of 90 degree cw rotations to perform (they're
actually combined algorithmically rather than sequentially)
reflect= the axis to reflect around. 1 = vertical, 2=horizontal
CALLS: ***
ISVALID [1], ISVALID [2], ISVALID [3], SXADDPAR [1], SXADDPAR [2], SXADDPAR [3]
SXPAR [1], SXPAR [2], SXPAR [3]
RESTRICTIONS:
The image must have the MSSTA alignment tags in the image header.
MODIFICATION HISTORY:
Created by Craig DeForest, 5/4/1995
[Previous]
[Next]
NAME:
ZDEGR
PURPOSE:
Degrade a fits image by nxn pixel averaging, to make it smaller
and more manageable. Modify the MSSTA coordinate system appropriately.
to track the change.
CALLING SEQUENCE:
ZDEGR, srcfits, destfits, [n=n]
INPUTS:
srcfits : the fits image to degrade
OPTIONAL INPUT PARAMETERS:
(none)
KEYWORD PARAMETERS:
n : the number of pixels to degrade by
in : the in-memory fits image to use
ihdr (required with in): the header of the image
out: the in-memory variable to put the result in
ohdr (required with out): the header of that image.
(Note that in & out keywords override the fits file names)
CALLS: ***
GETFITS, ISVALID [1], ISVALID [2], ISVALID [3], SXADDPAR [1], SXADDPAR [2]
SXADDPAR [3], SXPAR [1], SXPAR [2], SXPAR [3], WRITEFITS [1], WRITEFITS [2]
RESTRICTIONS:
The image must have the MSSTA alignment tags in the image header.
MODIFICATION HISTORY:
Created by Craig DeForest, 1/31/1995
[Previous]
[Next]
ZDEHELIOGRAPHINIZE
PURPOSE - To project a heliographic image back into the image
plane of an instrument. Match the platescale and pointing information
in a reference FITS header.
USAGE -
zprojectinize, in=in,ihdr=ihdr,out=out,ohdr=ohdr,tohdr=tohdr
REQUIRED KEYWORDS:
in,ihdr,out,ohdr - input and output images and headers.
tohdr - the image header to match with the output transform.
OPTIONAL KEYWORDS:
B0, P0, L1, D - (later)
soho - Specifies that the observer is aboard SoHO (Earth or
instrument-matched by default)
date - Specifies the date on which the observation takes place,
for scale information
CAVEAT:
This algorithm probably breaks if CDELT1 is different than
CDELT2 for either of the images...
CALLS: ***
ARCMIN2HEL, DELVARX [1], DELVARX [2], DELVARX [3], DELVARX [4], FUG, ISVALID [1]
ISVALID [2], ISVALID [3], NLM [1], NLM [2], ZGUESS_LOCATION, ZHDRUNIT, delvarx [5]
safetag, zpb0r [1], zpb0r [2], zunits
CALLED BY:
ZDEROTATE, ZHOVER, make_grid_sphere, zheliographinize
HISTORY:
Written sometime in 1996, CED
Modified for proper CRPIXn usage, 13-Mar-98 CED
Modified to do proper averaging (not sampling), 30-Jun-98 CED
Changed nomenclature of "latlon" to match order of arcmin2hel return.
Also added ZGUESS_LOCATION call. 18-Feb-99 CED
Removed "STOP" for sections with no valid points. 15-Apr-99 CED
Fixed date_obs glitch, 28-Apr-99 CED
Added sine-latitude capability, 21-Jul-99 CED
[Previous]
[Next]
NAME:
ZDEROTATE
PURPOSE
Derotate a solar image to the specified time
CALLING PROCEDURE
ZDEROTATE,in=im,ihdr=ihdr,out=im2,ohdr=ohdr,t0=t0
KEYWORD INPUTS
in,ihdr,out,ohdr - the usual
T0 = the time of interest to which the image should be rotated
METHOD
Uses zheliographinize/zdeheliographinize. This is a bit wasteful
but quicker than the routines used in IMAGE_TOOL (the last time
I checked).
HISTORY
Written C. DeForest, 17-Nov-1998
Added longitude/latitude checks, 18-Feb-99
CALLS:
[Previous]
[Next]
NAME :
zdiff_rot
PURPOSE:
Wrapper around diff_rot -- takes either a number of days or a
pair of timestamps.
CALLING SEQUENCE:
a = zdiff_rot(ddays,latitude)
a = zdiff_rot(tstampfrom,tstampto,latitude)
tstampfrom and tstampto may be vectorized.
KEYWORD PARAMETERS:
ALLEN - use values from Allen, Astrophysical Quantities
HOWARD - use values from Howard et al (DEFAULT)
SIDEREAL- use sidereal rotation rate (DEFAULT)
SYNODIC - use synodic rotation rate
DELTAT - OUTPUT the delta-T, in seconds
HISTORY
Written C. DeForest 27-Oct-97
CALLS:
[Previous]
[Next]
NAME:
ZDIST
PURPOSE:
Calculate the 2-D Cartesian distance between two points
CALLING SEQUENCE:
a=ZDIST(x0,y0,x1,y1)
CALLED BY:
ZGRID
MODIFICATION HISTORY:
Created by Craig DeForest, 1/30/1995
[Previous]
[Next]
NAME:
ZETA_0
EXPLANATION
Returns the value of zeta_0 (the number of vacancies in the ion given
by IZ and ION). See Sect. 2.2 of Mewe et al. (1986, A&AS 65, 511).
INPUTS
IZ Atomic number of ion (e.g., 26 -> Fe)
ION Spectroscopic number of ion (e.g., 13 -> XIII)
OUTPUTS
Value of zeta_0.
CALLS:
CALLED BY
FB_RAD_LOSS
[Previous]
[Next]
FUNCTION:
ZFIND_INDEX
PURPOSE:
Finds fractional index that can be fed into INTERPOLATE (a system
function) to find 'val' in the array 'indep'. Indep must be a
monotonically increasing array.
This is useful if indep is the independent variable of a
plot variable (eg intensity vs. height, height being the indep
variable), and it's desired to interpolate in the dependent variable's
indices. Use find_location on the indep variable to get the index
to feed to INTERPOLATE with the dependent variable.
If val is an array, zfind_index does The Right Thing and treats
each element as a separate scalar.
CALLING SEQUENCE:
index = zfind_index(indep,val)
data = INTERPOLATE(dep,index)
or
data = INTERPOLATE(dep,zfind_index(indep,val))
(where dep is an array of dependent variables, whose value depends
on the corresponding index into the independent variable array 'indep')
CALLS:
CALLED BY
FIELDLINE
[Previous]
[Next]
NAME:
ZGETPLUME
PURPOSE:
Pick out a linear feature from a solar image, given the
(r,theta) coordinates of an endpoint (ra0) and a point alont
the line of the feature (ra1). If _under_ or _over_ is
specified, the line is extrapolated beyond ra0 or ra1
by the specified length.
CALLING SEQUENCE:
zgetplume,in=in,ihdr=ih
KEYWORD INPUTS:
ra = coordinates (r,theta) of the points to transform
hdr = the fits header of the image
zero if set, causes missing values to be mapped to zero, rather
than the minimum value of the input image
lerp if set, causes image values to be lerpped off of the
input image, rather than directly substituted. This
helps reduce pixel aliasing from the coordinate transform.
[others -- Use the Source, Luke!]
EXAMPLE:
CALLS: ***
ISVALID [1], ISVALID [2], ISVALID [3], SXADDPAR [1], SXADDPAR [2], SXADDPAR [3]
SXPAR [1], SXPAR [2], SXPAR [3], ZCOORD, ZRA2XY, zunits
RESTRICTIONS:
(2)the FITS headers must contain the following parameters, which
are unique to MSSTA FITS images:
CTYPE1 = Units of distance on x axis.
CTYPE2 = Units of distance on y axis (not implemented).
CROT = Rotation ccw from solar N = +y (degrees).
CDELT1 = Size of a pixel in x, in units of CTYPE1.
CDELT2 = Size of a pixel in y, in units of CTYPE2.
CRPIX1 = X coordinate of center of the sun's disk.
CRPIX2 = Y coordinate of center of the sun's disk.
REFLECT = T if image is flipped with respect to the sun as
seen by the naked eye; else F.
REFLECT must be false.
MODIFICATION HISTORY:
Reversed ordering of zcoord's return value, 25-Feb-97
C. DeForest, April 1 1995
[Previous]
[Next]
NAME:
ZGRID
PURPOSE:
Draw an angle/radius grid appropriate to an existing solar image on
the current output device. Useful for coalignments.
CALLING SEQUENCE:
ZGRID,hdr,[nr=n1,na=n2,/label,/nolabel]
INPUTS:
hdr: The fits header of the image to grid for.
OPTIONAL INPUT PARAMETERS:
(none)
KEYWORD PARAMETERS:
nr: the number of angular circles to draw per solar radius (default 10)
na: the number of radial lines to draw per full circle (default 36)
label: (default): draws textual labels near each grid intersection
nolabel: doesn't.
OUTPUTS:
none
CALLS: ***
ISVALID [1], ISVALID [2], ISVALID [3], ZDIST, ZHDRUNIT, safetag
CALLED BY:
ZPRINTSUN
RESTRICTIONS:
The image must have the MSSTA alignment tags in the image header.
MODIFICATION HISTORY:
Created by Craig DeForest, 1/30/1995
Fixed-up to do the right thing with reflected images, 3/2/1995
Added cliprect and offset capability, 5/24/1995 CED
Modified for proper CRPIXn usage, 13-Mar-98 CED
[Previous]
[Next]
NAME:
ZGUESS_LOCATION
PURPOSE
Guess the vantage point from which a picture was taken
USAGE:
location = zguess_location(hdr)
RETURNS:
A string with a vague indication of location (currently either "SOHO" or "EARTH").
HISTORY
Written 17-Feb-99, Craig DeForest
CALLS:
CALLED BY
zdeheliographinize, zheliographinize, zxy2helio
[Previous]
[Next]
NAME:
ZHDRUNIT
CALLS: ***
NLM [1], NLM [2], anytim [1], anytim [2], anytim [3], anytim [4], anytim [5], safetag
zpb0r [1], zpb0r [2], zprfits, zstructify, ztype, zunits
CALLED BY:
COORD [1], COORD [2], COORD [3], ZGRID, make_grid_sphere, zaspect
zdeheliographinize, zheliographinize, zmatch, zmontage, zradialize, zscale, zunwrap
zwrap
HISTORY:
Written in the dim past by Craig DeForest
Updated to accept/use structure-based fits headers, 11-Apr-97 CED
Switched to use zpb0r, which caches values, 15-Apr-97 CED
Added CRVAL tags, 9-Feb-98 CED
Added disparate units ("WANT" may be a 2-vector), 17-Apr-98 CED
Minor fixes to disparate-units cases... 26-Apr-98 CED
Another minor fix to the non-disparate-units case... 21-July-98 CED
PURPOSE:
To convert the given scaling factor in a solar image FITS header to
other units. The complication (which is not addressed in the
simpler routine "ZUNITS") is that some images give units in
subtended angle and others in distance at the Sun (eg "arcsec"
vs. "solar radii"). The conversion depends on vantage point and
on time.
CALLING SEQUENCE:
zunits,hdr,<whatyouwant>
(Converts the units in "hdr" to units of <whatyouwant>
KEYWORD PARAMETERS:
/soho - assume the instrument is on SoHO
/earth - assume the instrument is on or near Earth
/ground - synonym for /earth
NOTES:
If neither /soho nor /earth is specified, the INSTRUME field of
the fits header is checked. If it matches a recognized SoHO
instrument, then /soho is assumed; otherwise, /earth is assumed.
REQUIRED ROUTINES:
PB0R - ssw routine
AUTHOR:
Craig DeForest, 25-Feb-97
[Previous]
[Next]
NAME:
zhelio2xy
PURPOSE:
Convert heliographic co-ordinates
(relative to 0 = central meridian) to X and Y in a
given fits header's co-ordinate system
USAGE:
location = zhelio2xy(lat,lon,hdr)
RETURNS:
The pixel coordinates (starting from (0,0)) of the specified point(s).
INPUT PARAMETERS:
LAT - the latitude of the point(s) to convert
LON - the longitude of the points to convert (relative to
central meridian = 0)
HDR - the header to use for conversion to pixel coordinates
KEYWORD PARAMETERS:
FROMHDR - a fits header to use for interpreting the heliographic
co-ordinates (if the coordinates are pixel coordinates
in a heliographic map image, rather than ordinary
(degrees-lat, degrees-lon) coordinates).
B - the B angle, in degrees (tilt along the N/S - LOS plane,
N-pole-toward you = positive)
P - the P angle, in degrees (rotation in the image plane,
CCW = positive, 0 = (north up)
L - The longitude of the central meridian, in degrees
T0 - If specified, differentially rotate the image to "look" as if
it came from this time. (Only works if neither of
B or P are specified...)
INPLACE - If set, we do the transformation in-place, rather
than copying the arrays.
RLAT - If RIGID is set, then we use the differential rotation rate for this
latitude as a rigid-body rotation speed for thewhole locus (unless
CARRINGTON is set, see below)
CARRINGTON - Use the carrington rotation rate instead of a differential rate.
RIGID - Boolean variable indicating to use rigid-body rotation instead of differential rotation.
VISIBLE - returns a boolean array indicating whether the point(s) is/are visible.
METHOD:
If no "fromhdr" is specified, then (degrees Long, degrees Lat)
are assumed for the heliographic co-ordinates.
If B, L, and P aren't specified, then we check in the "fromhdr"
or assume that they are zero.
May be vectorized across (lat,lon) or across headers --
but strange results will come if you attempt both...
CALLS: ***
DELVARX [1], DELVARX [2], DELVARX [3], DELVARX [4], DIFF_ROT [1], DIFF_ROT [2], FUG
HEL2ARCMIN [1], HEL2ARCMIN [2], ISVALID [1], ISVALID [2], ISVALID [3], ZCOORD
delvarx [5], safetag, zstr2utc [1], zstr2utc [2], zstructify, ztype
CALLED BY:
zheliographinize, ztrack
HISTORY:
Written and crufted around in the mists of time by Craig DeForest
Switched diff_rot to synodic rates, 22-may-97 CED
Converted to CRPIX-counts-from-1 coordinates, 13-Mar-1998 CED
Regularized the conversion to pixel coordinates (uses "zcoord"), 18-Jul-98 CED
Added VISIBLE keyword, 16-Feb-99 CED
[Previous]
[Next]
ZHELIOGRAPHINIZE
PURPOSE - To remap an image from image to heliographic co-ordinates
USAGE
zheliographinize,in=in,ihdr=ihdr,out=out,ohdr=ohdr,soho=soho $
,date=date,t0=t0,[/howard],[/rigid]
REQUIRED KEYWORDS:
IN,IHDR - the input image and header to heliographinize
OUT,OHDR - outputs
OPTIONAL KEYWORDS:
soho - Boolean indicating SoHO (rather than Earth) view
date - A date specifier to override the header
t0 - If specified, causes the image(s) to be differentially derotated
to match the specified time.
lon - a range of longitudes to use
lat - a range of latitudes to use
lstep - The pixel size, in degrees of lon-/lat- itude, for the output
image at disk center. If not specified, pixels at disk
center are kept constant size in the transformation.
If this is a 2-array, the (lon,lat) size is specified.
quick - Causes all the images to be treated as happening at the same
time, for P0, B0, and R0 calculation purposes. Useful for
faster processing of batches of images.
howard - Use the Howard et al rotation rate for small magnetic
features (option to diff_rot) instead of the default Allen
numbers.
rigid - Use the differential rotation speedf or the center of the
rotated map, but treat the sun as a rigid body. Boolean.
rlat - Specify the latitude whose rotation rate is to be used
for rotation. Implies "rigid".
carrington - Boolean. Use the Carrington rotation speed. Implies
"rigid".
HISTORY - Written 30-Apr-97, Craig DeForest
Added `howard' keyword for pass-thru to zhelio2xy, 13-may-97 CED
Added "Derotated-to:" to comment of output header, 22-may-97 CED
Fixed default value of sine keyword, 3-Aug-97 CED
Modified for proper CRPIXn usage, 13-Mar-98 CED
Several minor replairs in vectorization etc., 15-Jun-98
(CED, Clare Parnell, and Daniel Brown)
Added /rigid, 19-July-1998 CED
Modified lstep to allow vector lstep specification, 16-Feb-99 CED
Added VISIBLE in call to ZHELIO2XY, 16-Feb-99 CED
Fixed auto-ranging of lat and lon, 17-Feb-99 CED
Added ZGUESS_LOCATION call, 17-Feb-99 CED
Miscellaneous fixes, plus missing-value setting is now allowed.
Backed out the IDL-5 square-bracket stuff (some international
colleagues are still using IDL-4)., 10-May-99, CED
Fixed some vectorization stuff for auto-ranging, 9-Jun-99, CED
Fixed $#(*@!! integer arithmetic in header calculation that was
causing half-pixel offsets in some maps. 27-Jul-99, CED
CALLS:
CALLED BY
MAKE_DIPOLES, MAKE_SYNOP, ZDEROTATE, ZHOVER, make_grid_sphere
[Previous]
[Next]
NAME:
ZHOVER
PURPOSE:
hack to track a particular location within the magnetograms.
Produces reprojected images with the desired point directly under
the viewpoint. The viewer appears to hover over the desired
(lat,lon) point. The "scale" parameter is in solar radii per pixel.
Named because the effect is as though you were hovering over the
point in question -- sort-of.
USAGE:
ZHOVER,in=in,ihdr=ihdr,out=out,ohdr=ohdr,latlon=latlon, $
scale=scale,naxis=naxis,t0=t0,missing=missing
METHOD:
Calls ZHELIOGRAPHINIZE and ZDEHELIOGRAPHINIZE to reproject to a
different location. Should be supplanted by a more efficient
algorithm. To avoid converting too many points, we estimate our
latitude/longitude range at the beginning by coarsely
heliographinizing the output image up into lat/lon coordinates.
INPUT PARAMETERS:
None -- everything's through keywords, as with many ztools.
INPUT KEYWORD PARAMETERS:
in,ihdr The input image and header
latlon The latitude and longitude of the point to track
t0 The time at which the point was observed
naxis The size of the output image (which is square)
scale The size of output image pixels, in solar radii
howard Flag to use the Howard, Harvey, Forgach diff-rot curve
for small magnetic features Allen curve is default)
rigid Flag to use rigid body rotation
rlat Latitude of the rigid body rotation
lerp If set, use interpolation rather than sampling
NOTES
This really should be implemented with a single step operation,
rather than going through ZHELIOGRAPHINIZE and ZDEHELIOGRAPHINIZE --
which is somethat wasteful of memory and cycles.
HISTORY
Crufted together by Craig DeForest, 19-Feb-1999
CALLS:
[Previous]
[Next]
Name:
ZINRANGE
Purpose:
Verify if a number or vector is within a range in N-space. May
be vectorized to a list of numbers (or vectors). Useful for
bounds checking, etc. Less cumbersome than big "if" statements.
USAGE:
ok = zinrange(value,range)
INPUTS:
VALUE - The number, vector, or list to compare. This should
take the form of an NxM array, where N is the number
of dimensions and M is the number of points. In
the special case of a 1-dimensional range, VALUE may
by a simple array of numbers.
RANGE - The range of values to check. This should be an Nx2 array,
where N is the number of dimensions. In the
1-dimensional case, it may be a simple array of 2
numbers.
KEYWORD INPUTS:
OPEN - don't include the boundaries in the range.
CLOSED - Include the boundaries in the range. (default)
CALLS: ***
NLM [1], NLM [2]
CALLED BY:
ZCONTAINS, zmovify
EXAMPLES:
ok = zinrange( 2, [1,4] )
returns 1, because 2 is inside the range [1,4]
ok = zinrange( [2,3], [[1,2],[1,2]] )
returns (0), because (2,3) is outside the square [[1,2],[1,2]].
ok = zinrange( [[1,2],[10,2]], [[1,4],[1,3]] )
returns (1,0) because (1,2) is inside [[1,4],[1,3]]; but
(10,2) is outside that square.
NOTES:
Works with huge arrays (>32767 elements).
HISTORY:
hacked together by Craig DeForest, 23-July-98
[Previous]
[Next]
ZINTERVALS
Given a header-structure array, attempt to generate intervals (in seconds)
of each frame's midpoint after the midpoint of the first frame.
CALLS: ***
ISVALID [1], ISVALID [2], ISVALID [3], STR2UTC [1], STR2UTC [2], STR2UTC [3]
data_chk [1], data_chk [2], safetag, zstr2utc [1], zstr2utc [2]
CALLED BY:
zmovify
HISTORY:
written 25-Jun-97 Craig DeForest
Fixed EXPTIME reference to use safe_tag, 10-Aug-98
CALLING SEQUENCE:
intervals = zintervals(hdrarr)
OPTIONAL KEYWORDS:
delta - if set, return the delay between adjacent frames, rather than
the overall delay.
RETURN VALUE:
Returns an array of the delay, in seconds, of each exposure's
midpoint after the midpoint of the first exposure.
[Previous]
[Next]
PROJECT: CHIANTI
CHIANTI is an Atomic Database Package for Spectroscopic Diagnostics of
Astrophysical Plasmas. It is a collaborative project involving the Naval
Research Laboratory (USA), the University of Florence (Italy), the
University of Cambridge and the Rutherford Appleton Laboratory (UK).
NAME:
ZION2FILENAME
PURPOSE:
help locate CHIANTI database files
CATEGORY:
database.
CALLING SEQUENCE:
ZION2FILENAME, Iz, Ion, Filename
INPUTS:
Iz: nuclear charge of ion of interest, i.e. 26 for Fe
Ion: charge state of ion of interest, i.e. 2 for Fe II
KEYWORDS:
diel: set if excitation of this ion is by dielectronic
recombination
OUTPUTS:
Filename: the complete filename and path specification for generic
CHIANTI database file, i.e. '.elvlc' suffix is not included
CALLS: ***
CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], concat_dir [4]
CALLED BY:
CH_SYNTHETIC, EMISS_CALC, FB_RAD_LOSS, POP_PROCESSES, RATE_COEFF
RATIO_PLOTTER [1], SHOW_POPS, WHICH_LINE [1], WHICH_LINE [2], ZETA_0
freebound_ion, get_contributions, ratio_plotter [2]
RESTRICTIONS:
!xuvtop must be set
EXAMPLE:
> zion2filename,26,2,filename
> print,filename
> /data1/xuv/fe/fe_2/fe_2 assuming !xuvtop = '/data1/xuv'
MODIFICATION HISTORY:
Written by: Ken Dere
March 1996: Version 2.0
Sept 1996: Modified for use with VMS
December 1998: Modified to diel keyword
V.5, 29-May-2002, Giulio Del Zanna (GDZ)
generalized directory concatenation to work for
Unix, Windows and VMS. Added keyword name to output just
the name of the file and changed the dielectronic keyword.
VERSION : 5, 29-May-2002
[Previous]
[Next]
PROJECT: CHIANTI
CHIANTI is an Atomic Database Package for Spectroscopic Diagnostics of
Astrophysical Plasmas. It is a collaborative project involving the Naval
Research Laboratory (USA), the University of Florence (Italy), the
University of Cambridge and the Rutherford Appleton Laboratory (UK).
NAME:
ZION2SPECTROSCOPIC
PURPOSE:
provide identification strings
CATEGORY:
database.
CALLING SEQUENCE:
ZION2SPECTROSCOPIC, Iz, Ion, Name
INPUTS:
Iz: nuclear charge of ion of interest, i.e. 26 for Fe
Ion: charge state of ion of interest, i.e. 2 for Fe II
OUTPUTS:
Name: the spectroscopic notation for the ion, i.e. 'Fe II'
CALLED BY:
CHIANTI_DEM, EMISS_CALC, G_OF_T, RATIO_PLOTTER [1], ratio_plotter [2]
EXAMPLE:
> zion2spectroscopic,26,2,name
> print,name
> Fe II
WRITTEN : Ken Dere
MODIFICATION HISTORY:
March 1996: Version 2.0
V.3, 25-May-2002, Giulio Del Zanna (GDZ)
added the DIELECTRONIC keyword.
VERSION : 3, 25-May-2002
[Previous]
[Next]
NAME:
ZLASCO_SUM
PURPOSE
Returns the summing factor on a LASCO image. You feed in the LASCO
header and get back a number indicating how many CCD pixels were summed
to make each image pixel. If you are asking for the purpose of image
normalization, both LEB and CCD summing are counted (default); if you
are asking for the purpose of ADC offset compensation, only the
LEB summing is counted (the CCD summing is done in analog space).
CALLING SEQUENCE
factor = ZLASCO_SUM(hdr)
factor = ZLASCO_SUM(hdr,/offset)
RETURNS
The summing factor (or, if hdr is an array, the summing factors) for
the image(s).
INPUT PARAMETER
HDR - the header or header array from the LASCO image(s)
OPTIONAL KEYWORD INPUT
OFFSET - if set, only the LEB summing is counted
NOTES
Because IDFL doesn't have the equivalent of "total" for products,
we use the hideously inefficient method of taking the logarithm, then
summing, then raising 10^output.
CALLS:
[Previous]
[Next]
zmagoverlay - Put a magnetogram overlay on a "regular" image.
The image to be overlaid is stuck into the upper few colors of
the 256-color table. (The original image is regarded as
a byte array; the user is responsible for reducing its
actual occupied colors to less than the number specified
for the magnetogram overlay...)
The rule: Things near zero in the magnetogram are left "transparent".
You pass in two arrays of threshholds: low and high. The top few
colors are taken for those threshholds. Magoverlay returns its result.
If you don't specify the threshholds, it guesses for you.
CALLS:
[Previous]
[Next]
NAME:
zmatch
PURPOSE:
Rotate & scale a solar image to match a given template
header. Uses the MSSTA fields, and zcoord.
CALLING SEQUENCE:
zmatch,in=in,ihdr=ihdr,out=out,ohdr=ohdr,tohdr=tohdr[,/lerp]
PARAMETERS:
[none -- all are keywords]
KEYWORDS:
in, out, ihdr, ohdr: the "usual" zlib fits parameters
lerp - Bilinear interpolation?
CALLS: ***
FUG, ISVALID [1], ISVALID [2], ISVALID [3], NLM [1], NLM [2], ZHDRUNIT, ZTWEAK_DATUM
zscale, zstructify, zunits
CALLED BY:
MAKE_DIPOLES
RESTRICTIONS:
The image must have the MSSTA alignment tags in the image header.
MODIFICATION HISTORY:
Created by Craig DeForest, 5/28/1996
18-Jan-97: If the scale, rotation, and reflect keywords are the
same in the source and destination images, we now use
a simpler (faster, less memory-intensive) algorithm.
14-Apr-97: Modified to use mreadfits-style structures as well as
string stuff, and to allow vectorization.
12-Feb-98: Modified to use CRVAL correctly.
13-Mar-98: Modified to use CRPIX correctly (off-by-1)
17-Apr-98: Modified to handle disparately-unitted images
12-Jun-98: Fixed vectorization problem with tohdr
16-Jun-98: Fixed yet another crval hassle.
[Previous]
[Next]
NAME:
zmatched
PURPOSE:
Determine if two images are co-aligned (at least, according
to their headers). The routine is "strict" in the sense that
the datum location, as well as the actual coordinate systems
must match between the headers.
CALLING SEQUENCE:
a = zmatched(hdr1,hdr2)
HISTORY:
Written 9-Nov-1998, CED
[Previous]
[Next]
NAME:
ZMKHDR
PURPOSE:
Make a minimal primary FITS image header with pointing information.
The header is returned in the first argument.
CALLING SEQUENCE:
zmkhdr,header,[im],[<keywords>]
CALLS:
[Previous]
[Next]
NAME:
zmontage
PURPOSE:
Combine two (comparably scaled) solar images into
a single one that has the same scale as the more detailed
of the two (or switchable scale) and sufficient room on the
image plane for both of the images in their entirety.
The routine may be called in such a way as to merely generate
the headers, or so as to do the actual combination.
Up to five images may be combined in this manner through
the use of the numbered "in=" and "ihdr=" keywords. The
images are overlain in reverse numerical order, so that
the lower numbers look like they're on top. Values may
be masked with the numbered "mask" keywords or the numbered
"radius" keywords.
If you fail to specify any of the IN<n>
keywords for which IHDR<n> keywords are named, then only
the output header is calculated.
CALLS: ***
FUG, ISVALID [1], ISVALID [2], ISVALID [3], NLM [1], NLM [2], ZHDRUNIT
zpointing_struct
EXAMPLE:
Generate the fits header for a montage image:
zmontage,ihdr1=foohdr,ihdr2=barhdr,ohdr=montagehdr
CALLING SEQUENCE:
zmontage,keywords
INPUT KEYWORDS:
IN<n> Specifies the actual data for the <nth> input image
IHDR<n> Specifies the FITS header for the <nth> input image
MASK<n> Specifies a binary data mask for the <nth> input image.
If this is specified, it is ANDed with the other masking
keywords.
R<n> Two-element array specifying the radius range (in solar
radii in the image plane) to use for the images. If this
is specified, it is ANDed with the other masking keywords.
MASTER Integer indicating which of the input images is to be used
to set the scale (default is the finest scale).
OUTPUT KEYWORDS:
OUT The output image
OHDR the output header
HISTORY:
Created by Craig DeForest, 4/16/98
[Previous]
[Next]
ZMOVIE - yet another movie tool for IDL
Takes a byte array cube to display; you can move forward and backward
through the movie with a little widget interface, and adjust speeds.
You can annotate movies by clicking in the movie pane -- a slider controls how
the annotated points are displayed; and another allows you to select between
10 different numerical/color labels for the annotations.
You can save your annotations by using the "POINTS" keyword -- you get back out
a list of annotation points. Passing the same (or a similar) list back in
imports the points back into zmovie.
USAGE:
zmovie,cube,[keywords]
INPUTS:
CUBE - the movie cube to display. The 1st coordinate is
X; the 2nd is Y; and the 3rd is time.
KEYWORDS:
DEBUG - turns on some debugging information
RGB - Specifies a 256x3 array to be used as a color table
BYTSCL - Specifies that a "BYTSCL" operation should be done
on CUBE before display. Different values have different meanings:
0 - don't bytscl
1 - Bytscl simply
r - Bytscl with maximum value 'r'
[r1,r2] - Bytscl with minimum value 'r1' and max 'r2'
If BYTSCLing is done, real image values are still used for
(future) analysis operations such as pixel-value retrieval.
ZBYTSCL - Same as BYTSCL keyword, except with ZBYTSCL (which
does percentage min/max bytscling)
MAG - Select a magnification factor for the movie to be displayed. If this
is other than 1, things slow down a lot -- we rebin each frame as it is displayed,
rather than trying to do the whole cube at once.
POINTS - I/O keyword. When you exit ZMOVIE with the "DONE" key (NOT with the window frame
"Quit" control), the pointlist is copied to this variable.
CALLS:
[Previous]
[Next]
ZMOVIFY
Generate a movie from some data, with linear interpolation.
USAGE:
movie = zmovify(cube,cubehdr,cadence)
OUTPUT:
A movie cube resampled to the desired cadence
INPUTS:
CUBE - a datacube containing a bunch of images
CUBEHDR - an array containing the fits headers of the images
CADENCE - The desired cadence, in seconds
OPTIONAL KEYWORD INPUTS:
OK - An array specifying which of the frames in CUBE are
ok to use. It should have the same size as CUBE's
3rd dimension, with 1 at each location indicating the
frame is OK, or 0 indicating the frame is bad.
(this can be, eg, output from ZCURS_OK()).
NOLERP - If specified, frames are sample not interpolated.
START - This is a timestamp of the time at which to start the
movie. If not specified, then the first time in
CUBEHDR is used.
DURATION - The duration of the movie, in seconds. If not specified,
then the movie will exactly cover all the images in CUBE.
OPTIONAL KEYWORD OUTPUTS:
times: returns the time at which each frame occurs
CAVEAT:
CUBE (and CUBEHDR) should be in time-sorted order.
CALLS: ***
FUG, ISVALID [1], ISVALID [2], ISVALID [3], NLM [1], NLM [2], ZINRANGE, anytim [1]
anytim [2], anytim [3], anytim [4], anytim [5], data_chk [1], data_chk [2]
zintervals, zmovinate
HISTORY:
Written in the dim past, CED
Fixed-up to use start and duration, CED/HN, 25-Aug-98
Fixed frame-time generation, CED, 22-Feb-99
[Previous]
[Next]
ZMOVINATE
Generate a list of (floating-point) indices into an array of times,
representing where in the array each frame of a movie should be sampled.
FORM
a = zmovinate(times,cadence,start,duration)
USAGE
mreadfits,files,ahdr,a
frame_indices = zmovinate(zintervals(ahdr),60)
INPUT PARAMETERS
times - an array of the frame times (relative to start of the movie)
cadence - (OPTIONAL) The number of seconds between frames
RETURN VALUE
Gives back a list of indices into an array of images/headers
corresponding to the cadence of times specified (in seconds) by
<interval>.
If <cadence> is not specified, zmovinate should guess -- but
doesn't.
CALLS:
CALLED BY
zmovify
[Previous]
[Next]
ZOVERLAY: Takes a pair of fits images, and overlays
one on top of the other, after scaling to match.
There is a flag that allows just drawing the border that
one window would make, on the other.
USAGE:
zoverlay, bg = bg, bhdr=bhdr, fg = fg, fhdr = fhdr,
out=out,ohdr=ohdr, [border=value], [/splitct],
[/mix]
If the border keyword is set, then just the border of the inset
window is drawn (with the specified value) on the output image.
If the /splitct flag is set, then the two images are bytscled, the
background image's values are compressed into the 0-127 range, and
the foreground image's values are compressed into the 128-256 range.
If the /mix flag is set, then pixels are remapped in a checkerboard
pattern to produce a "double exposure" effect inside the overlay.
CALLS: ***
SXADDPAR [1], SXADDPAR [2], SXADDPAR [3], SXPAR [1], SXPAR [2], SXPAR [3], ZCOORD
HISTORY:
Crufted together 3-Sep-96, Craig DeForest
Modified to support newer zcoord, 25-Feb-97
[Previous]
[Next]
ZOVERLAY: Takes a pair of fits images, and overlays
one on top of the other, after scaling to match.
There is a flag that allows just drawing the border that
one window would make, on the other.
USAGE:
zoverlay, bg = bg, bhdr=bhdr, fg = fg, fhdr = fhdr,
out=out,ohdr=ohdr, [border=value], [/splitct],
[/mix]
If the border keyword is set, then just the border of the inset
window is drawn (with the specified value) on the output image.
If the /splitct flag is set, then the two images are bytscled, the
background image's values are compressed into the 0-127 range, and
the foreground image's values are compressed into the 128-256 range.
If the /mix flag is set, then pixels are remapped in a checkerboard
pattern to produce a "double exposure" effect inside the overlay.
CALLS: ***
SXADDPAR [1], SXADDPAR [2], SXADDPAR [3], SXPAR [1], SXPAR [2], SXPAR [3], ZCOORD
HISTORY:
Crufted together 3-Sep-96, Craig DeForest
Modified to support newer zcoord, 25-Feb-97
[Previous]
[Next]
NAME:
ZPAD
PURPOSE:
Pads 1-,2-, or 3- dimensional array with partial reflections for
boundary handling in smoothing operations etc.
USAGE:
out = zunpad(function(zpad(a)))
INPUTS:
IN - the thing to pad
OPTIONAL INPUT KEYWORDS:
pad_dim - if set, determines the number of dimensions that are
actually padded (currently, only the initial indices may
be padded; later indices are looped over if pad_dim is smaller
than the dimension of out). Defaults to equal the dimension
of the input.
RETURNS:
A padded version of the input, padded in PAD_DIM dimensions.
Padding is accomplished by reflecting half of the original
array in each dimension about the boundary.
CALLS: ***
FUG, ISVALID [1], ISVALID [2], ISVALID [3], NLM [1], NLM [2], REVERSE
History:
Written
[Previous]
[Next]
PROGRAM: zpb0r
Caching wrapper for pb0r. Caches P, B, and R values by day;
doesn't call pb0r for days that are already "known".
USAGE: See pb0r
METHOD: Caches stuff in the common block "zpb0r_cache" so that,
once you've found the value for a particular day, you don't have to do
the compute-intensive pb0r call again. There are four different sets
of values cached, based on soho/not-soho and arcsec/arcmin. (The
Right Way to do the arcsec/arcmin distinction is to multiply, but
I was too lazy to implement it that way.)
HISTORY
Written in the distant past by Craig DeForest
Hacked for kludgey vectorization, 24-Oct-97
Added arcsec/arcmin split in the caching, Jul 1997 CED
CALLS:
CALLED BY
CALC_LOI_ROLL, SUNEARTHDIST, V4XS2SRS [2], V4XSC2HC [1], V4XSC2HC [2], V4XSC2HEC
ZHDRUNIT, zdeheliographinize
[Previous]
[Next]
NAME:
ZPICK
PURPOSE:
Pick a portion of a solar image to view, in radial coordinates,
and clip a relevant portion of the image around the selected
point. Do the correct transformations on the MSSTA coordinates
of the image.
; CALLING SEQUENCE:
ZPICK,r,theta,size,src.fits,dest.fits
INPUTS:
r,theta: coordinates, in solar radii and degrees, of the point of
interest
size: Size, in solar radii, of the region of interest
src.fits: name of source fits file
dest.fits: name of destination fits file
OPTIONAL INPUT PARAMETERS:
(none)
KEYWORD PARAMETERS:
(none)
OUTPUTS:
none
CALLS: ***
HEADFITS [1], HEADFITS [2], HEADFITS [3], READFITS [1], READFITS [2], READFITS [3]
SXADDPAR [1], SXADDPAR [2], SXADDPAR [3], SXDELPAR [1], SXDELPAR [2], SXDELPAR [3]
SXPAR [1], SXPAR [2], SXPAR [3], WRITEFITS [1], WRITEFITS [2], ZCOORD, zprfits, zunits
RESTRICTIONS:
The image must have the MSSTA alignment tags in the image header.
MODIFICATION HISTORY:
Swapped indexing of zcoord's return value CED 25-Feb-97
Fixed theta direction, added x & y variability 5-Feb-97 CED
Created by Craig DeForest, 1/31/1995
[Previous]
[Next]
ZPICK_ORIGIN
CALLS:
[Previous]
[Next]
ZPOINTING_STRUCT
Returns a structure containing the "standard" pointing tags used
by the ZTOOLS
CALLED BY:
zmontage
HISTORY:
Deep in the mists of time: Written by Craig DeForest
16-April-98: Added CRVAL<n>; brought other tags up to date.
[Previous]
[Next]
zprfits
Given a fits header, print out the pointing information from it.
Saves paging through the whole fits header to see stuff.
USAGE: zprfits,hdr
INPUT: hdr - a fits header to print the pointing information from.
(q&d hack Craig DeForest 17-Feb-97)
CALLS:
CALLED BY
COORD [1], ZHDRUNIT, ZPICK, zpick_origin, ztrack
[Previous]
[Next]
NAME:
ZPRINTSUN
PURPOSE:
Generate a PostScript version of an internal MSSTA image of the
Sun (or a portion thereof), and (unless told not to)
print it on Banneker's wlj-ps printer
CALLING SEQUENCE:
ZPRINTSUN,image,hdr,[plume], [keywords]
INPUTS:
image: the image to print
hdr: its header
OPTIONAL INPUTS:
plume: a plume-description array to draw on top of the solar image.
KEYWORD PARAMETERS:
nogrid: (binary value) If set, supporesses drawing of a coordinate
grid.
nr, na, nla, nlr, label, rmin, rmax, black: These keywords are passed
to ZGRID to aid in drawing a coordinate grid over the
image.
pswidth, psheight: The width and height of the final PostScript
image to send out on the postscript device.
square: (binary value) If set, causes a square 8x8 grid to be
drawn on top of the solar image. Useful for determining
a ROI to clip for better cleaning.
xoffset, yoffset: Offsets, in inches, of the region in which to
draw on the PostScript "page".
noprint: (binary) Suppresses closing and printing the output
postscript.
title: A title string to be printed underneath the image
OUTPUTS:
None (except on the PostScript output device)
CALLS: ***
ISVALID [1], ISVALID [2], ISVALID [3], SXPAR [1], SXPAR [2], SXPAR [3], ZDRAWPLUME
ZGRID
RESTRICTIONS:
Void where prohibited or taxed.
MODIFICATION HISTORY:
Created by Craig DeForest, 1/1995
Switched around 1-5/1995
Added PostScript offsets, 5/24//1995
[Previous]
[Next]
ZRADIALIZE
Given an MDI image, correct it for radial projection angle of the
line of sight. Mark the header so we don't do it again.
USAGE:
zradialize,im,ihdr
CALLS: ***
DELVARX [1], DELVARX [2], DELVARX [3], DELVARX [4], NLM [1], NLM [2], ZHDRUNIT
delvarx [5], fixinate_mdi, safetag
CALLED BY:
MAKE_SYNOP
HISTORY:
Written 12-May-97, Craig DeForest
13-Mar-1998: Corrected CRPIX usage (CED)
[Previous]
[Next]
ZREADFITS - Like READFITS, but with a little additional
translation for images with the "SOLAR_R" tags added (converts
CDELTs to milli-solar-radii).
Usage: Same as READFITS.
CALLS:
[Previous]
[Next]
ZREGISTER_EIT
You feed in the header of a full scale EIT image without any image-plane
headers (but with the EIT comments with "P1_X and "P1_Y" and the like),
and the header of a fully aligned EIT image with the same pointing,
and ZREGISTER loads the pointing information into the subfield's header
for you.
This is useful for non-limb-fitted subfields and the like.
Written by: Craig DeForest, 28-August-96
CALLING SEQUENCE:
newhdr = ZREGISTER_EIT(oldhdr,alignedhdr)
REQUIRED INPUTS:
oldhdr: the FITS header of the image you want registered
alignedhdr: the FITS header of the image that's already aligned
CALLS: ***
SXADDPAR [1], SXADDPAR [2], SXADDPAR [3], SXPAR [1], SXPAR [2], SXPAR [3]
RESTRICTIONS:
For now, oldhdr has to be for a non-binned image. (The pre-aligned header
can be for a binned image.)
HISTORY:
Written 28-Aug-96
Added default EIT centroid based on Barbara Thompson's study
(506.5,509.0)
oops, that's
(505.5,508.9)
Corrected CRPIX usage, CED 13-Mar-98
[Previous]
[Next]
NAME:
zscale
PURPOSE:
Scale a fits image up or down by a fixed factor and rotate
it by a given number of degrees, using the zcoord
transformation routine. Rotation takes place around the
solar center.
Alternatively scale it to give it a particular absolute
size, orientation and solar center.
Image size can be specified (w and h keywords), but
if it is not, then the default is to scale it
with the 'scale' keyword, or to leave the dimensions the
same.
Rotation and scaling is done around the image datum.
The image datum may also be shifted to particular
pixel coordinates by using the X0 and Y0 (or DX and DY) keywords.
CALLING SEQUENCE:
zscale,in=in,ihdr=ihdr,out=out,ohdr=ohdr, $
[delt=delt],[scale=scale],[rot=rot],[dx=dx],[dy=dy], $
[size=size],[angle=angle],[x0=x0],[y0=y0], $
[h=h],[w=w],[/fug]
CALLED BY:
zmatch
EXAMPLE:
'Blow up' an image by a factor of two around its internal datum:
zscale,in=in,ihdr=ihdr,out=out,ohdr=ohdr,scale=2.0
'Blow up' an image by a factor of two around the pixel datum:
zscale,in=in,ihdr=ihdr,out=out,ohdr=ohdr,scale=2.0,/fug
Rotate an image by 30 degrees CCW around its internal datum:
zscale,in=in,ihdr=ihdr,out=out,ohdr=ohdr,rot=30
Rotate an image by 30 degrees CCW around disk center:
zscale,in=in,ihdr=ihdr,out=out,ohdr=ohdr,rot=30
PARAMETERS:
[none -- all are keywords]
KEYWORDS:
in, out, ihdr, ohdr: the "usual" zlib fits parameters
lerp: Causes linear interpolation between gridpoints on the
source image, rather than direct substitution.
Scale, rot, dx, and dy: Relative parameters relating to
the transformation. Scale scales the image, rot rotates it,
and dx and dy offset it in pixels.
size, angle, x0, and y0: absolute parameters relating to
the transformation. Size sets the solar radius, angle sets
CROTA, and x0 and y0 set the location of the datum in the new
pixel coordinates. x1 and y1 set the location of the datum in
the new science coordinates: Once the crpix shifting has been
done, the science coordinates are moved until (x1,y1) matches
the (x0,y0) location.
fug: Shorthand that shifts the image datum to the pixel origin
before the transformation.
CALLS: ***
FUG, ISVALID [1], ISVALID [2], ISVALID [3], NLM [1], NLM [2], ZHDRUNIT, ZTWEAK_DATUM
ztype
SEE ALSO:
BUGS:, The lower and left hand boundaries of the image are treated
ZMATCH - a wrapper around zscale, in IDL's POLY_2D call.
oddly in the interpolated cases because of the braindamage
MODIFICATION HISTORY:
Created by Craig DeForest, 5/2/1995
Switched ordering of zcoord's return indices, 25-Feb-97
Added structure-based headers, 14-March-97
Added correct interpretation of CRVAL tags, 12-March-97
Modified for correct usage of CRPIX tags, 13-Mar-98
Hacked around more IDL uglitude with CRVAL presence checks, 2-April-98
Added ability to scale differnt amounts in different direcions
(accepts 2-element SCALE keyword), 17-April-98
Minor CRVAL bugfix, 10-Jun-98
Reworked to deal properly with the image datum, 17-Jul-98
Worked around IDL POLY_2D bug, 20-Aug-98
[Previous]
[Next]
FUNCTION: ZSEARCH
CALLED BY:
ZFIND_INDEX
HISTORY:
Written in the dim past (pre-1993) by Craig DeForest
(Probably duplicates the functionality of some newer
built-in piece of IDL)
PURPOSE:
Finds indices in a given array 'p', of the last value below or equal to the
given value. If all elements are larger than 'val', or if there is no
element larger than 'val', returns -1.
'val' may be an array, and the operation will be vectorized.
CALLING STRUCTURE:
foo = zsearch(p,val)
RESTRICTIONS:
p must be monotonically increasing.
EXAMPLE
p = [0.5,1.5,2.5,3.5]
print,zbsearch(p,[0.5,2.5,3,4])
-1 2 2 -1
[Previous]
[Next]
ZSI - Given a string, check if it starts with an SI prefix. If it does,
shorten the string by the amount of the SI prefix.
Return the value corresponding to the prefix, or 1.0
CALLS: ***
FUG, INIT_ZSI, ISVALID [1], ISVALID [2], ISVALID [3]
CALLED BY:
zunits
HISTORY:
Written in the dim past by Craig DeForst
Updated to vectorized strings 11-Apr-97
CALLING SEQUENCE:
multiplier = zsi(<unit_string>,[/fix])
KEYWORDS:
fix - if set, remove the prefix from the string. This is useful
for unit-interpretation stuff -- "attoseconds" changes to "seconds".
NOTES:
We store the SI table in a common block so we only have to
initialize it once.
AUTHOR:
Craig DeForest, 25-Feb-97
[Previous]
[Next]
ZSTR2UTC - wrapper around Bill Thompson's "STR2UTC" to fixify
TAI times...
CAVEAT: Only works properly with vectorized arrays if all the times
in the vectorized array are in the same format.
CALLS: ***
STR2UTC [1], STR2UTC [2], STR2UTC [3], data_chk [1], data_chk [2]
CALLED BY:
fixinate_eit, zcheck_hdr, zhelio2xy, zintervals, zstructify, ztrack, zxy2helio
NOTE: This routine is Wrong as it assumes TAI=UTC. Sloppy, but OK
for the moment...
HISTORY: Slapped together in the mists of time pre-1998, CED
[Previous]
[Next]
ZSTRUCTIFY
Entry parser for fits headers in the ZTOOLS routines...
You feed it a fits header or a fits header structure, and it
returns a fits header structure. This is really just a
glorified wrapper for "fitshead2struct"
USAGE:
ihs = zstructify(ihdr,imdim=size(in),/pointing)
INPUTS:
ihdr - the input string array or header structure to use
KEYWORD INPUTS (OPTIONAL):
imdim - If specified, gives the size of the image or cube
which the header is purported to describe. If you
specify imdim, some size checking is done.
pointing - A flag that indicates whether to check for
the "standard pointing tags" -- CRPIXn,
CDELTn, CTYPEn, REFLECT, CROT, CROTAn
If this is specified, then the input MUST
contain the [CRPIXn, CTYPEn, CDELTn] tags. The
output is guaranteed to contain REFLECT and CROT
tags, as well. If CROTA doesn't exist, and CROT
or CROTA1 does, then the CROT or CROTA1 tag is
copied to CROTA
CALLS:
CALLED BY
ZCLIP, ZHDRUNIT, zhelio2xy, zmatch, ztrack
[Previous]
[Next]
ZTRACK - Follow the sun's differential rotation.
You input an "origin" fits header and a set of pixel coordinates.
You get back a "destination" fits header, suitable for use with
zmatch, that you should warp the original image to in order for
the same piece of photosphere to be on the same single pixel.
You can specify whether or not the image should rotate in the image
plane. If you, the output header will be rotated such that
a radial line piercing the sun at the point of interest is vertical
in the new image.
Uses the "standard pointing tags" CRPIX?/CDELT?/CTYPE?/CROT/REFLECT
plus the SoHO time tags DATE_OBS (or MDI's equivalent T_REF).
Note that no new image is created - only a fits header.
At the moment, we only deal with the SoHO vantage point.
USAGE:
zmatch,in=i,ihdr=ihdr,out=o,ohdr=ohdr, $
tohdr=ztrack(x,y,ihdr=ihdr,t0hdr=t0hdr)
INPUTS:
x,y The coordinates (in image pixels in the t0 reference image)
of the point to track
REQUIRED KEYWORDS:
t0hdr The reference image header
ihdr The header of the image to be tracked
ohdr The output (mapped) image header
OPTIONAL KEYWORDS:
radial (Binary) If specified, then the output header is rotated
so that radial lines point directly *up* at the tracked point.
(May not be used with /meridional)
meridional (Float) Specifies the angle in the original image plane
of a linear feature. The feature is assumed to lie in the
plane of the meridian passing through the tracked point,
and the output image is rotated so as to keep it vertical.
You may specify either an angle in degrees CCW from (up=0),
or a pair of pixel coordinates in the original image, lying
along the feature.
date Allows you to specify the date manually (normally, the
DATE_OBS tag in the ihdr is used.)
soho Force soho view (default)
earth Force earth view
OUTPUTS
Returns the tracked fits header, suitable for zmatching.
REQUIRES:
isvalid
zxy2helio
zhelio2xy
arcmin2hel &c. (in SSW tree; by Liyun Wang)
hel2arcmin &c. (in SSW tree; by Liyun Wang)
anytim2utc &c. (in SSW tree; by Bill Thompson)
str2utc &c. (in SSW tree; by Bill Thompson)
PB0R (" " " " " " )
CALLS: ***
DIFF_ROT [1], DIFF_ROT [2], FUG, ISVALID [1], ISVALID [2], ISVALID [3], NLM [1]
NLM [2], PB0R, anytim [1], anytim [2], anytim [3], anytim [4], anytim [5], zhelio2xy
zprfits, zstr2utc [1], zstr2utc [2], zstructify, ztype, zxy2helio
HISTORY:
Craig DeForest, 14-Feb-97
UPDATED TO USE HEADER STRUCTURES: 11-Apr-97
Modified to use CRPIX correctly, 13-Mar-98 CED
7-Aug-98 Modified to work around IDL expression braindamage
(scalar vs. array-of-length-1), CED
[Previous]
[Next]
ztweak - Translate an image by a small amount. Lose information off the
edges.
Usage: out = ztweak(in,deltarr)
<in> is the image to be tweaked; <deltarr> is a 2-vector with the tweak
amount (in pixels).
CALLED BY
zcorralign
[Previous]
[Next]
ZTYPE - one-liner to return the type number of a variable as returned
by the SIZE call...
USAGE:
if ztype(foo) eq 7 then (foo is a string...)
CALLED BY
ZHDRUNIT, mdialign, safetag, zcheck_hdr, zhelio2xy, zscale, ztrack, zwritefits
[Previous]
[Next]
ZUNITS
Generate conversion factors between units.
CALLED BY:
SUNEARTHDIST, V4MCART, V4MSPH, V4OK, V4XCARR2HEL, V4XCART2SPH, V4XHEL2CARR
V4XS2SRS [2], V4XSC2S, V4XSPH2CART, ZGETPLUME, ZHDRUNIT, ZPICK, v4canon
zdeheliographinize, zmatch, zwrap
HISTORY:
Written in the dim past by Craig DeForest
Updated to vectorized WANT units 11-Apr-97 CED
CALLING SEQUENCE:
To convert AUNITS to BUNITS use:
B = ZUNITS(BUNIT,AUNIT) * A
CALLS: ***
FUG, INIT_ZUNITTAB, ISVALID [1], ISVALID [2], ISVALID [3], NLM [1], NLM [2]
ZUNITS_RESOLVER, zsi
RESTRICTIONS:
Only works on some specific units defined in the table at the
bottom of this file. For now, the engine is simple enough that
it only works on "simple units" -- I'm not willing to implement
units(1) in a broken evil language like IDL. (Someone else should
feel free to build a more general parser...)
If the units are not resolvable (eg "seconds" versus "arc seconds")
then ZUNITS returns 0.
NOTES:
We keep a master table for converting units to fundamental units.
Each unit gets converted to its fundamental unit. If they differ,
we issue an error. If they don't, we return the conversion factor.
Many variant spellings are detected -- in particular, cASe iS
iRREleVAnt; "-" and "_" are converted to spaces; trailing "s"'s
(the most common plural marker) are ignored; and SI units are
understood. (eg "miLLI-arc_seCONDS" works, as well as does "arcsec")
The CASe inSENSITIVITY yields some funny ambiguities -- for example,
we can't understand "mm", and tell you as much if you try to use it.
In general, you should use full SI prefixes.
REQUIRES:
ISVALID, FUG, ZSI
AUTHOR:
Craig DeForest, 25-Feb-97
HISTORY:
Written 25-Feb-97
Added crude 'want' vectorization, 18-Feb-99
Fixed definition of A.U., 1-Jul-99
[Previous]
[Next]
NAME:
ZUNPAD
PURPOSE:
Strip out the middle bit of an array previously padded with
ZPAD
USAGE:
out = zunpad(function(zpad(in)))
INPUTS:
IN - the thing to be unpadded
OPTIONAL KEYWORD INPUTS:
PAD_DIM - the number of dimensions to unpad (defaults to the
dimensionality of IN).
RETURNS:
An unpadded version of the input (the middle bit) -- this
undoes the padding that the indentical ZPAD call puts in.
CALLS: ***
ISVALID [1], ISVALID [2], ISVALID [3], NLM [1], NLM [2]
HISTORY:
Written: C DeForest, 15-Sep-1998
NOTES:
Could probably be written more cleanly; this hack only works for
the most common cases in 0-3 dimensions.
If you use the PAD_DIM keyword in ZPAD, you better use it in ZUNPAD
too.
[Previous]
[Next]
ZUNSPIKE:
Remove spikes (dust, cosmic rays, etc.) from an image. This is
Yet Another Such Beast, but is more parametrizable than many of the
others. Uses a basic unsharp-masking algorithm with two-tiered
neighbor-based replacement of spike values. The twist that makes
this algorithm cool is that there's an adjustable sensitivity
parameter for intermediate spatial frequencies, so you can turn up
the gain on the spikes and still not catch solar features (with
appropriate tweaking.)
CALLS: ***
FUG, ISVALID [1], ISVALID [2], ISVALID [3], NLM [1], NLM [2]
HISTORY:
Written 26-Jan-1999, Craig DeForest.
CALLING SEQUENCE:
To unspike an image:
out = zunspike(in,[keywords])
INPUT PARAMETERS:
IN - the image to unspike
KEYWORD INPUT PARAMETERS
R1 - Things smaller than this, and bright, are treated as spikes
(this is a pixel radius of the feature) (Default is 2)
R2 - Things larger than r1, and smaller than this, are likely to be
locally bright solar features and must be cancelled out a bit
(this is a pixel radius of the feature) (Default is 5)
ALPHA - Weighting factor for high spatial frequencies (default 0.5)
BETA - Weighting factor for overall sigma (default 1.0)
SENS - Sensitivity factor for spikes (default 0.5)
NEIGHBORHOOD - size of mask neighborhood for second pas (default 3)
COUNT - Number of neighborhood pixels that must be bad to make an otherwise
OK pixel bad. (default 2)
KEYWORD OUTPUT PARAMETERS:
MASK - gets the mask of bad pixels.
NOTES:
The defaults are set for not-so-aggressive despiking of pre-normalized,
background subtracted C3 images. More aggressive C3 despiking can
be accomplished with [SENS=1.0, COUNT=4].
TO DO:
* Test this on instruments other than C3
* Make convenience keywords for favorite instruments and levels of despiking:
eg "/TRACE, /AGGRESSIVE"
[Previous]
[Next]
ZUNWRAP
"Unwrap" a solar image, converting X to angle and Y to radius.
Use zra2xy to do the transformation.
Scanning is done widdershins (CCW) over a specified angular range
in the original image plane; the widdershins scan is converted
to a horizontal one in the resulting image plane (ie moving
in the +X direction on the final image plane moves in the CCW
direction on the original image plane). Radius is mapped to the
Y axis. This preserves angular sign conventions but mirror-reverses
the image that is being unwrapped.
;
CALLING SEQUENCE:
zunwrap,in=in,ihdr=ihdr,out=out,ohdr=ohdr,[optional keywords]
REQUIRED KEYWORDS
in, ihdr - the fits image and header to unwrap about the origin
out,ohdr - the destination image and header
OPTIONAL KEYWORDS
RMIN - the minimum radius, in solar radii, of the unwrapped image
RMAX - the maximum radius, in solar radii, of the unwrapped image
RSTEP - the radial step, in pixels(!) of the input image
ARANGE - A vector specifying the range (in degrees clockwise from North)
of the start and end of the scan. Default is [0,360].
ASTEPS - the number of steps around the specified 'arange'.
SMOOTH - binary keyword. If set, a slower algorithm is used that averages
pixel values where relevant. Doesn't work on conformal unwrapping
LERP - Binary keyword. If set, use bilinear interpolation on the original
image plane (rather than sampling) to get the destination pixel values.
CONFORMAL - Binary keyword. If set, make the transformation conformal
(by putting 'r' on a log scale).
RADIUS - floating point. Used with conformal keyword, specifies
(in output image plane pixel widths) the size of the smoothing kernel
being applied to the input image. (The smoothing kernel size is
constant in the output image plane, meaning that it is variable in the
input image plane). Specify 0.0 for sampling, 1.0 for quick-n-dirty
anti-moire averaging, and higher to smooth the output image more.
FAST - Binary keyword - Sets "radius" to zero.
MISSING - If set, contains the value which should signal missing datapoints.
GRID - Binary keyword. If set, the conformal unwrapper engine
adds a grid indicating 10s of degrees of azimuth and individual
solar radii on the output image. See also GRMASK. If this is
DEFINED, then a GRMASK is produces; if it is SET, then the grid is
superposed on the output image.
GRMASK - output keyword. A binary mask containing 255 wherever a gridpoint
goes.
CALLS: ***
FUG, ISVALID [1], ISVALID [2], ISVALID [3], NLM [1], NLM [2], ZHDRUNIT, ZRA2XY, cartdist
wmatch
EXAMPLE:
zunwrap,in=a,ihdr=ahdr,out=b,ohdr=bhdr,/conformal,rmin=1.0,rmax=6.0,$
asteps=600,arange=[-180,180]
HISTORY:
Written by Craig DeForest, early 1993.
29-Jan-97 - Fixed up the bilinear interpolation in the conformal
mapping code (Was fixing the zra2xy output *then* doing bilinear.
Bad. Definitely bad.)
12-Jan-97 - Added conformal mapping stuff; this is slow but very cool.
It really ought to be vectorized in the opposite direction.
Added "arange" option: you can specify a range of angles
to cover (eg "arange=[90,270]" to get the South pole).
Also added "rot" option; "rot" lets you specify the
location of the splice, in degrees. (Default is zero). This must be
in the arange.
20-Aug-97 - Upgraded to use structure, rather than string-array,
headers.
3-Jan-97 - Added differential smoothing option, rather than "mere"
sampling. If you set the /smooth flag, then pixels in the source
plane are averaged over regions roughly the size of the relevant
destination-plane pixels.
13-Mar-98 - Fixed up to use CRPIX correctly (off-by-1)
16-Jun-98 - Hacked on conformal headers; added 'missing' keyword.
26-Mar-99 - Removed references to deprecated "reflect" keyword.
20-Apr-99 - Improved header docs slightly; modified rmin default for linear
case.
[Previous]
[Next]
NAME:
zwhere
PURPOSE
Wrapper to mate RSI's WHERE and brain-damaged logic
CALLING SEQUENCE
same as where
METHOD
All bits but the LSB are masked out, so that the LSB logic
used by the logical operators won't conflict with the
NONZERO (OR) logic used by the where() built-in
HISTORY
Written 17-Nov-98, C. DeForest
[Previous]
[Next]
zwrap
"wrap up" an unwrapped image with std. pointing headers.
This is meant to be the inverse of "zunwrap" but doesn't yet
implement the conformal mapping -- only the linear one.
USAGE:
zwrap,in=i,ihdr=ihdr,out=o,ohdr=ohdr,tohdr=tohdr,[rmax=rmax]
KEYWORDS:
in,ihdr - The input unwrapped image
out,ohdr - the output cartesian-coordinate image
tohdr - if this is specified, the output image is mapped
into the coordinates of this header. (Otherwise,
we guess at a co-ordinate system for you.)
rmax - if specified, radii outside rmax are ignored.
CALLS: ***
ZHDRUNIT, zunits
HISTORY:
written by Craig DeForest, c. 1994; documented 18-Feb-97
13-Mar-1998: Modified to use CRPIX correctly; and to use
structure based headers.
8-Jun-1998: Upgraded drastically.
15-Jun-1998: Totally rewrote. (WARNING: COnformal case still doesn't work right)
10-May-99: Conformal case works OK, but doesn't do the cool smoothed-
sampling that zunwrap does.
[Previous]
[Next]
ZWRITEFITS
PURPOSE - Wrapper around writefits, to deal with structure
type headers. Also deals with scaling, in a rudimentary way.
If you feed ZWRITEFITS an integer or byte array, it will
preserve BZERO and BSCALE unchanged. If you feed it a floating-point
array, it will change BZERO and BSCALE to 0.000 and 1.000, respectively,
and stick any non-default previous value into the HISTORY field.
USAGE -
same as writefits:
zwritefits,filename,data,hdr
INPUTS -
filename - a name to write. May be vectorized: if 'data' is a
datacube, 'filename' may be either a scalar or a vector with
a list of individual image filenames.
data - The data to write as a fits file. These may be a single
image, or a cube of images.
hdr - The header. May be a string array or header structure.
OPTIONAL INPUT KEYWORDS:
NANVALUE - Value in the data array to be set to the IEEE NaN
condition. This is the FITS representation of undefined values.
APPEND - If this keyword is set then the supplied header and
data array are assumed to be an extension and are appended onto
the end of an existing FITS file. Note that the primary header in
the existing file must already have an EXTEND keyword to indicate
the presence of a FITS extension.
RESTRICTIONS -
Doesn't handle multiple images or vectorization (yet) -- you have to
save each image in a cube individually.
HISTORY -
Written 25-Apr-1997, Craig DeForest
Modified for scale removal, 4-August-97, Craig DeForest
Fixed bug in scale removal, 19-may-99, Craig DeForest
CALLS:
CALLED BY
unpack_trace
[Previous]
ZXY2HELIO - Convert x,y coordinates in a fits header to
heliographic coordinates, using the CDS routine arcmin2hel.
latlon = zxy2helio(x,y,hdr[,date])
INPUTS:
X,Y - The X and Y coordinates to convert
hdr - The fits header containing x,y co-ordinate information
RETURNS: The heliographic latitude and longitude, in degrees,
in the 0- and 1-columns of a 2xN array.
KEYWORDS:
date- Optional date (overrides date in header)
soho- flag to indicate SoHO vantage point (only works if none
of P0, L0, or B0 are specified; we just pass this on
to ARCMIN2HEL...)
CALLS: ***
ARCMIN2HEL, ISVALID [1], ISVALID [2], ISVALID [3], ZCOORD, ZGUESS_LOCATION, safetag
zstr2utc [1], zstr2utc [2]
CALLED BY:
ZDEROTATE, ztrack
HISTORY:
Craig DeForest, 13-Feb-97
Updated to structure headers, 14-Apr-97
Modified for CRPIX relative to (1,1) 13-Mar-98 CED
Futzed with matrix multiplication and transposition, 17-Nov-98 CED
Added understanding of B0,P0,R0 tags, 19-Feb-99 CED
Changed to use ZCOORD instead of local transform, 12-Aug-99 CED