Last modified: Tue Aug 7 08:53:42 2007.
NAME: CHA_VIDA PURPOSE: Scale a Vida Image from microns to millimeters. CATEGORY: VIDA CALLING SEQUENCE: CHA_VIDA, STR INPUTS: STR Structure or structure array number KEYWORD PARAMETERS: Any valid keyword to CHASTR may be used. OUTPUTS: Specified Structure will be scaled to millimeters PROCEDURE: CHASTR, STR, MADIM= 1.0e-3, XLABEL = 'X (mm)', YLABEL = 'Y (mm)', $ _EXTRA = extrastuff EXAMPLE: Scale structure 1 to mm. CHA_VIDA, 1 MODIFICATION HISTORY: Written by: L. P. Mix, January 25, 2003
(See ../pfidl/vida/cha_vida.pro)
NAME: RM_NL_SKEW PURPOSE: Proceedure for removing warp in an image Note: See RM_SKEW for a linear skew. Procedure uses linear interpolation or nearest neighbor or in the skew direction. The skew is adjusted to provide an average value of zero. CATEGORY: VIDA - Image manipulation CALLING SEQUENCE: RM_NL_SKEW, STRIN [, STROUT] [, FIDU_VALUES = wdf] $ [, COEFFICIENTS = coefficients] [, /XAXIS] [, CUBIC = cubic] [, SIGMA = sigma] [, POLYGON = polygon] [, DELTA_FRACTION = delta] [, INTERPOLATION = interpolation] [, _EXTRA = ExtraStuff] INPUTS: STRIN - Structure array with the image requiring the camera correction. OPTIONAL INPUT PARAMETERS: STROUT - Structure array with the corrected image DEFAULT: STRIN KEYWORD PARAMETERS: XAXIS - If set, the skew correction will be in the X-direction. Default: XAXIS = 0 ; skew correction in the Y-direction vs X. FIDU_VALUES- WDF array with the X and Y values of a fiducial expected to be straight in the corrected image. COEFFICIENTS - Coefficients of the least square fit for location of the fiducial. COEFFICIENTS is ignored if FIDU_VALUES is present. INTERPOLATION - 0 (DEFAULT) Nearest neighbor interpolation 1 Linear Interpolation The following keywords apply only if FIDU_VALUES is passed. CUBIC - If set, a cubic spline is used to interpolate fiducial values. SIGMA - The amount of tension that is applied to the curve. The default value is 1.0. If sigma is close to 0, (0.01, for example) then there is a cubic spline fit. If sigma is large, (greater than 10) then the fit will be a polynomial interpolation. POLYGON- If cubic is not set, then a polynomial filter will be used with a degree equal to polygon. If neither CUBIC nor POLYGON are set, then CUBIC = 1 QUIET - This will be passed to fit_data. DELTA_FRACTION- Filter length for the interpolated skew values as a fraction of the X or Y-axis length. The routine FILT is used. Keyword DELTA in FILT = DELTA_FRACTTION * RANGE where RANGE is the axis range of STRIN Default: Filter = 0.3 If FILTER le 0 then, no filter is applied. OUTPUTS: Image Skew Corrected Image OPTIONAL OUTPUT PARAMETERS: None COMMON BLOCKS: None SIDE EFFECTS: Completely rewrites the image RESTRICTIONS: Assumes the input image has rectangular pixels, single block, Type 1 structure, with slice in the 3 dimension. PROCEDURE: If CUBIC or POLYGON is used, the interpolation is made to determine the skew at each pixel. FIT_DATA is used to perform the interpolation If COEFFICIENTS is specified, the image skew is determined from those values. The image is then corrected according to the value of INTERPOLATION Example: Correct the skew in image stored in structure array 2 data in wdf array = 4 RM_NL_SKEW, 2, fidu=4 Correct the skew in image stored in structure array 1 from the calculated coefficients of a least square fit in COEF. RM_NL_SKEW, 1, coefficients = coef MODIFICATION HISTORY: Replaces a routine in VIDA written by W. E. Nelson, 6/1991 and modified by Alex Filuk, 7/1992 Rewritten: L. P. Mix, January 14, 2004
(See ../pfidl/vida/rm_nl_skew.pro)
NAME: RM_REFRAC PURPOSE: Proceedure for removing time dispersion due to index of refraction in the fiber optic cable This procedure uses the nearest point interpolation used in RM_REFRAC CATEGORY: VIDA - Image manipulation CALLING SEQUENCE: RM_REFRAC, STRIN [, STROUT] [, REFRACTION = refrac] [, CURRENT = current] [, LENGTH = length] [, WAVELENGTH = wavelength] [, POSITION = position] [, DISPERSION = dispersion] [, SWEEP = sweep] INPUTS: STRIN - Structure array with the image requiring the camera correction. CHA_VIDA should be used on raw data to convert the axis scale to MM. OPTIONAL INPUT PARAMETERS: STROUT - Structure array with the corrected image DEFAULT: STRIN KEYWORD PARAMETERS: REFRACTION - File name for the refraction correction REFRACTION may be a string or a number if it uniquely specifies the file File should be a wdfit3 data file. If file not found, then the data directory for VIDA is searched Units are Seconds vs nanometers. CURRENT - If set, "fidmark.mnu" will be written to current directory. Current directory will be searched for default parameters in the fidmark.mnu If fidmark.mnu does not exist, it will be read from the VIDA data directory Note: The following image parameters, if unspecified, must be provided in a widget. Initial value is from "fidmark.mnu" in data directory for the actual data or in the current directory, depending on the keyword CURRENT, or in the data directory for VIDA (*/pfidl/pfidl/vida/data) Format for this file is: "String data anything" Each line is parsed on spaces. The first string should be a string of characters beginning with: LENGTH, WAVELENGTH, POSITION, DISPERSION, or SWEEP in upper or lower case Any line which does not begin with one of these words is ignored The next word is converted to a float representing one of the following keywords. Additional data on a line is ignored. If all five keywords are present, no widget is shown. If any of these keywords are present, the data in "fidmark.nmu" is not used for those keywords. If multiple values exist, the last value read is used for the menu LENGTH - Lenght of the fiber optic in meters WAVELENGTH - Wavelength of the reference wavelength (Angstroms) POSITION - Position of the reference wavelength DISPERSION - Streak Camers dispersion (Angstroms/mm) SWEEP - Camera sweep rate (ns/mm) OUTPUTS: Streak camera image in units of Angstroms and ns corrected for wavelength dispersion in the fiber optic. If possible, the parameters for the analysis are written to the shot directory. If the file exists, it will be opened for append. OPTIONAL OUTPUT PARAMETERS: None COMMON BLOCKS: None SIDE EFFECTS: Completely rewrites the image RESTRICTIONS: Camera calibrations must be stored in the data directory or some other file. Streak camera dispersion and sweep must be known Current version assumes the input image has square pixels, single block Type 1 structure, single block, with slice in the 3 dimension. PROCEDURE: Read the file and calculate time shift for all values of wavelength Convert time shift to pixels with an average offset of zero. for j = 0, ny-1 do new_image[0, j] = image[*, j+yoffset] Example: Correct the skew in image stored in structure array 2 from camera 19 RM_REFRAC, 2, camera = 19 Correct the skew in image stored in structure array 1 RM_REFRAC, 1 MODIFICATION HISTORY: Replaces a routine in VIDA written by Kyle Cochran Calculational techinque has changed from Vida but all calibrations are from Kyle Cochran. Original Version of this implementation: L. P. Mix, Jr. February 5, 2003
(See ../pfidl/vida/rm_refrac.pro)
NAME: RM_SKEW PURPOSE: Proceedure for removing warp induced by each camera Problem is that the constant time slit is not perpendicular to the constant X (wavelength) position. Note: RM_NL_SKEW removes an arbitrary skew in an image. Uses POLY_2D for bilinear and cubic interpolations CATEGORY: VIDA - Image manipulation CALLING SEQUENCE: RM_SKEW, STRIN [, STROUT] [, CAMERA = CAMERA] [, SLOPE = slope] [, INTERPOLATION = interpolation] [, _EXTRA = ExtraStuff] INPUTS: STRIN - Structure array with the image requiring the camera correction. OPTIONAL INPUT PARAMETERS: STROUT - Structure array with the corrected image DEFAULT: STRIN KEYWORD PARAMETERS: CAMERA - Camera number to be used or a string specifying a correction Camera file has the number of elements for the slope followed by the values SLOPE - Slope of the constant time line in units of microns/micron Typically skew correction is linear, but slope may be a vector If slope is more than one element: correction = SLOPE[0]*X + SLOPE[1]*X*X + etc NOTE: A single value of slope depends on DX = DY Multiple values must be in units of PIXELS ie units of slope[1] = pixels/pixels^2 INTERPOLATION - 0 (DEFAULT) Nearest neighbor interpolation 1 Bilinear Interpolation 2 Cubic convolation interpolation (see POLY_2D) NOTE: INTERPOLATION is set to zero if slope is not scalar ExtraStuff - Valid keyword to POLY_2D Ignored unless interpolation > 0 OUTPUTS: Camera Skew Corrected Image OPTIONAL OUTPUT PARAMETERS: None COMMON BLOCKS: None SIDE EFFECTS: Completely rewrites the image RESTRICTIONS: Camera calibrations must be stored in the data directory or a slope specified Assumes the input image has square pixels, single block Type 1 structure, single block, with slice in the 3 dimension. PROCEDURE: The slope is of the skewed image is determined. For bilinear or cubic interpolation: The Arrays P and Q are defined as 2x2 arrays. Q[1, 0] = P[0, 1] = 1.0 Q[0, 1] = slope Corrected_image = POLY_2D(Distorted_image, P, Q, Interpolation, $ _EXTRA = extrastuff) For nearest neighbor: define yoffset = round(findgen(nx)*slope- nx/2*slope) for j = 0, ny-1 do image[0, j] = image[*, ((j+yoffset)>0)< ny-1] Note: Extension to higher order fit should be trivial. Example: Correct the skew in image stored in structure array 2 from camera 19 RM_SKEW, 2, camera = 19 Correct the skew in image stored in structure array 1 from camera with a measured slope of -0.0292792 RM_SKEW, 1, slope = -0.0292792 MODIFICATION HISTORY: Replaces a routine in VIDA written by Kyle Cochran Original Version: L. P. Mix, Jr. January 31, 2003
(See ../pfidl/vida/rm_skew.pro)