This page was created by the IDL library routine
mk_html_help
. For more information on
this routine, refer to the IDL Online Help Navigator
or type:
? mk_html_help
at the IDL command line prompt.
Last modified: Tue Mar 16 23:59:03 1999.
NAME: add_to_regarr PURPOSE: This function adds a new element to the regarr list when a new slice widget is opened. CATEGORY: hydra_fitf CALLING SEQUENCE: result=add_to_regarr(regarr) INPUTS: regarr: regarr is an array of structures which contain the widget id of a hydra_fitf base widget and the widget id of the draw window which owns that slice window. This array facilitate multiple slice widgets being open at the same time. With out this registry one would not be able to know which slice widget a given draw window click event should be sent to. OUTPUTS: regarr: The updated widget rigistration list is returned. result: The index to the new entry in regarr. EXAMPLE: index = add_to_regarr(regarr) Written by: Eric E. Dors, 1 March 1998. MODIFICATION HISTORY:
(See ./hydra_fitf.pro)
NAME: confidence PURPOSE: This function returns the chi-square level for level% confidence given nu_in degrees of freedom CATEGORY: hydra_fitf CALLING SEQUENCE: result = confidence(level,nu_in) INPUTS: level: The desired confidence level in percent. nu_in: The number of degrees of freedom in the chi-square distribution. OUTPUTS: result: The value of the chi-square level surface corresponding to a nu_in degree of freedom chi-square distribution at level percent confidence PROCEDURE: Use bisection rootfinding to get the appropriate level from the known partial integral of the chi-square distribution. That is igamma(deg of freedom/2, level in percent/100/2) where igamma is the imcomplete gamma function. EXAMPLE: dchisq_lim = confidence(68.3, m) ;one sigma error level on ;m degrees of freedom Written by: Eric E. Dors, 1 March 1998. MODIFICATION HISTORY:
(See ./confidence.pro)
NAME: CURVEFIT PURPOSE: Non-linear least squares fit to a function of an arbitrary number of parameters. The function may be any non-linear function. If available, partial derivatives can be calculated by the user function, else this routine will estimate partial derivatives with a forward difference approximation. CATEGORY: E2 - Curve and Surface Fitting. CALLING SEQUENCE: Result = CURVEFIT(X, Y, W, A, SIGMAA, FUNCTION_NAME = name, $ ITMAX=ITMAX, ITER=ITER, TOL=TOL, /NODERIVATIVE) INPUTS: X: A row vector of independent variables. This routine does not manipulate or use values in X, it simply passes X to the user-written function. Y: A row vector containing the dependent variable. W: A row vector of weights, the same length as Y. For no weighting, w(i) = 1.0. For instrumental weighting, w(i) = 1.0/y(i), etc. A: A vector, with as many elements as the number of terms, that contains the initial estimate for each parameter. If A is double- precision, calculations are performed in double precision, otherwise they are performed in single precision. KEYWORDS: FUNCTION_NAME: The name of the function to fit. If omitted, "FUNCT" is used. The function must be written as described under RESTRICTIONS, below. YFIT: Returns a vector of calculated values. (y values of the fit.) ITMAX: Maximum number of iterations. Default = 20. ITER: The actual number of iterations which were performed TOL: The convergence tolerance. The routine returns when the relative decrease in chi-squared is less than TOL in an interation. Default = 1.e-3. CHI2: The value of chi-squared on exit NODERIVATIVE: If this keyword is set then the user procedure will not be requested to provide partial derivatives. The partial derivatives will be estimated in CURVEFIT using forward differences. If analytical derivatives are available they should always be used. CURVATURE: Return the curvature matrix. OUTPUTS: Returns 0 for routine falue, 1 for success. A: A vector of parameters containing fit. OPTIONAL OUTPUT PARAMETERS: Sigmaa: A vector of standard deviations for the parameters in A. COMMON BLOCKS: NONE. SIDE EFFECTS: None. RESTRICTIONS: The function to be fit must be defined and called FUNCT, unless the FUNCTION_NAME keyword is supplied. This function, must accept values of X (the independent variable), and A (the fitted function's parameter values), and return F (the function's value at X), and PDER (a 2D array of partial derivatives). A call to FUNCT is entered as: retval=FUNCT(X, A, F, PDER) This function should return 1 if the the function is successfully calculated, and 0 if unsucessful. where: X = Variable passed into CURVEFIT. It is the job of the user-written function to interpret this variable. A = Vector of NTERMS function parameters, input. F = Vector of NPOINT values of function, y(i) = funct(x), output. PDER = Array, (NPOINT, NTERMS), of partial derivatives of funct. PDER(I,J) = DErivative of function at ith point with respect to jth parameter. Optional output parameter. PDER should not be calculated if the parameter is not supplied in call. If the /NODERIVATIVE keyword is set in the call to CURVEFIT then the user routine will never need to calculate PDER. PROCEDURE: Copied from "CURFIT", least squares fit to a non-linear function, pages 237-239, Bevington, Data Reduction and Error Analysis for the Physical Sciences. "This method is the Gradient-expansion algorithm which combines the best features of the gradient search with the method of linearizing the fitting function." Iterations are performed until the chi square changes by only TOL or until ITMAX iterations have been performed. The initial guess of the parameter values should be as close to the actual values as possible or the solution may not converge. EXAMPLE: Fit a function of the form f(x) = a * exp(b*x) + c to sample pairs contained in x and y. In this example, a=a(0), b=a(1) and c=a(2). The partials are easily computed symbolicaly: df/da = exp(b*x), df/db = a * x * exp(b*x), and df/dc = 1.0 Here is the user-written procedure to return F(x) and the partials, given x: function gfunct, x, a, f, pder ; Function + partials bx = exp(a(1) * x) f= a(0) * bx + a(2) ;Evaluate the function dumb = where(finite(f) eq 0, num_bad) IF ( num_bad GT 0 ) THEN BEGIN print, 'FitPassBimax function evaluation went wacky!' return, 0 ENDIF if N_PARAMS() ge 4 then $ ;Return partials? pder= [[bx], [a(0) * x * bx], [replicate(1.0, N_ELEMENTS(y))]] return,1 end x=findgen(10) ;Define indep & dep variables. y=[12.0, 11.0,10.2,9.4,8.7,8.1,7.5,6.9,6.5,6.1] w=1.0/y ;Weights a=[10.0,-0.1,2.0] ;Initial guess yfit=curvefit(x,y,w,a,sigmaa,function_name='gfunct') print, 'Function parameters: ', a print, yfit end MODIFICATION HISTORY: Written, DMS, RSI, September, 1982. Does not iterate if the first guess is good. DMS, Oct, 1990. Added CALL_PROCEDURE to make the function's name a parameter. (Nov 1990) 12/14/92 - modified to reflect the changes in the 1991 edition of Bevington (eq. II-27) (jiy-suggested by CreaSo) Mark Rivers, U of Chicago, Feb. 12, 1995 - Added following keywords: ITMAX, ITER, TOL, CHI2, NODERIVATIVE These make the routine much more generally useful. - Removed Oct. 1990 modification so the routine does one iteration even if first guess is good. Required to get meaningful output for errors. - Added forward difference derivative calculations required for NODERIVATIVE keyword. - Fixed a bug: PDER was passed to user's procedure on first call, but was not defined. Thus, user's procedure might not calculate it, but the result was then used.
(See ./spcurvefit.pro)
NAME: expand_all_vars PURPOSE: This function takes a list of variable definitions and returns the expanded list. That is its expands references of variables on the right hand side to their definitions CATEGORY: General Utility CALLING SEQUENCE: Result = expand_all_vars(varlist, expanded) INPUTS: varlist: A 2xn dimensional array of variable and definitions [[name1,def1],[name2,def2],...,[namen,defn]] KEYWORD PARAMETERS: top_widget: the id of the parent widget base if it exists OUTPUTS: result: 0 for failure, 1 for sucess. expanded: The two dimsnesional variable list with variable references in the definitions expanded using other variables in the list. PROCEDURE: The variable list is looped through up to max_iter times. Each time through it looks at each variable definition one by one. It then looks for the first occurance of a variable reference in the definition, and then replaces it with the appropriate definition. Then it moves on to the next variable and keeps looping until all the variables references in the defintions have been replaced, an undefined variable is found, or the max_iter has been hit. EXAMPLE: result = expand_all_vars(varlist,expanded) Written by: Eric E. Dors, 9 September 1997. MODIFICATION HISTORY: Fri Jan 23 19:42:12 1998, Eric E. DorsAdded top_widget parameter for use with widget_message.
(See ./print_window.pro)
NAME: fitf_control PURPOSE: This procedure creates the hydra_fitf control widget. CATEGORY: hydra_fitf CALLING SEQUENCE: fitf_control, handler, window = window, group = group INPUTS: handler: The base id of the hydra_fitf window this control window is associated with. KEYWORD PARAMETERS: window: The papco window number that the hydra_fitf slice window is associated with (if papco is running). group: The base id of the group leader of this widget. If the group leader is destroyed so will this widget. RESTRICTIONS: This widget should be called from hydra_fitf_event only. (though the control event). See the help button inside this widget for more help on the meaning of each sub-widget, and how it effects the hydra_fitf state. SIDE EFFECTS: A control window is placed next to the hydra_fitf window. Setting the values in tis window changes the plotting parameters of hydra_fitf, through the state vector. Written by: Eric E. Dors, 1 March 1998. MODIFICATION HISTORY:
(See ./fitf_control.pro)
NAME: fitf_control_event PURPOSE: This procedure handles events from the fitf_control widget. CATEGORY: hydra_fitf CALLING SEQUENCE: fitf_control_event, event INPUTS: event: The event structure xmanager created for the user click event. SIDE EFFECTS: Possible side effects: The slice state structure may be modified if the particular event requires it. RESTRICTIONS: This function is intended to be called by widget events read by the xmanager. PROCEDURE: The hydra_fitf state vector (structure) is read from the uvalue of the first child in the widget. Then the calling event is serviced by searching for that events uvalue in a large case statement which contains the code to handle that event. The state vector (possibly modified) is written back to the child widget's uvalue for future use. Written by: Eric E. Dors, 1 March 1998. MODIFICATION HISTORY: Tue Mar 16 22:17:19 1999, Eric E. DorsThe function module_helpfile nolonger exists so I created fitf_which_help.pro to take its place and find the location of the appropriate helpfile. Tue Apr 7 00:03:32 1998, Eric Dors Fixed reference to ofile_bnames. This variable was moved to the state.cw_ids structure. Thu Apr 2 17:00:37 1998, Eric Dors In 'button-help' fixed argument to xdisplay file to add the proper path to the helpfilename.
(See ./fitf_control.pro)
NAME: fitf_kill PURPOSE: This procedure cleans up after the hydra_fitf widget when it is killed. This is accomplished by removing the element of the regarr list correspoinding to the killed widget. *This procedure should only be called by xmanager.pro! CATEGORY: hydra_fitf CALLING SEQUENCE: fitf_kill, id INPUTS: id: The widget id of the widget being killed. COMMON BLOCKS: myregister: This common block exists to make the the variable myreg global. The purpose of this variable is to register hydra_fitf widgets. Specifically, myreg is an array of structures which contain the widget id of a hydra_fitf base widget and the widget id of the draw window which owns that slice window. This array facilitate multiple slice widgets being open at the same time. With out this registry one would not be able to know which slice widget a given draw window click event should be sent to. SIDE EFFECTS: The element of the regarr associated with the killed window is erased. Written by: Eric E. Dors, 1 March 1998. MODIFICATION HISTORY:
(See ./hydra_fitf.pro)
NAME: fitf_plot PURPOSE: This function facilitates plotting to the draw window of the hydra_fitf widget. CATEGORY: hydra_fitf CALLING SEQUENCE: result=fitf_plot(state, datatime = datatime) INPUTS: state: The state vector of the widget from which plotting parameters are to be taken. KEYWORD PARAMETERS: state.mode(state.select).diag: A switch to turn off informaitonal x-windows messages about getting data and plotting. datatime: Return the time range plotted. OUTPUTS: result: 0 for failure, 1 for success. SIDE EFFECTS: A new plot is put in the slice window draw widget. EXAMPLE: child = widget_info(hydra_fitf.top, /child) widget_control, child, get_uvalue = state result=fitf_plot(state, datatime = datatime) if (state.papco ne 0) then begin ; move papco cursor striketime = strmid(state.args.path, 4, 2)+'/'+$ strmid(state.args.path, 6, 2)+'/'+$ strmid(state.args.path, 0, 4)+' '+strmid(datatime(0), 0, 8) hydra_strike, striketime endif ; move papco cursor See the documentation in init_fitf for a description of state. See the documentation of hydra_fitf.pro for a description of where state is generally stored. Written by: Eric E. Dors, 1 March 1998. MODIFICATION HISTORY: Tue Mar 16 21:31:56 1999, Eric E. DorsMade the energy error propigation conditional on enough data points to compute it. Added error message for when fitf_read fails. Sun Feb 21 15:34:46 1999, Eric E. Dors Commented out patch code which wrote PostScript characters instead of vector characters. Sun Feb 21 15:13:48 1999, Eric E. Dors Updated example to be consistent with change in state.args.path. It now uses four character years instead of two character years. Thu Aug 27 16:52:50 1998, Eric E. Dors nodiagnostics keyword removed and the state vector is checked for state.mode(state.select).diag to decide weather to plot informational messages or not. Fri Apr 10 13:56:00 1998, Eric Dors Fixed error in reporting angular range. Range was specifield from amin to amin. Now it correctly specifies amin to amax. Mon Mar 16 14:01:11 1998, Eric Dors Previous fix for foregound color didn't work. White background in widget window couldn't see anything in the !p.color color because, !p.color isn't updated by PAPCO when a different background color is selected. A hack was added to get around this problem, now we check to see if the device is X, if so: use papco's color table entry 1 for the foreground, if not: use black for the foreground. Another problem to be fixed in the future is to reset the color table so that the full 255 color table is available to this routine when printing, not the small subset table declaired by PAPCO. Mon Mar 9 19:32:15 1998, Eric Dors Changed the color fg to be !p.color instead of the papco forground index (1). Now the forground color is appropriately changed when output is switched from screen to printer or printer to screen.
(See ./fitf_plot.pro)
NAME: fitf_read PURPOSE: This function calculates a cut of Hydra-DDEIS data as a function of energy in a specified pitch-angle range. CATEGORY: ddeis level 1 library CALLING SEQUENCE: result = fitf_read(state.args.path,state.args.t0, state.select, $ state.mode(state.select).den, $ state.mode(state.select).dalph,$ state.mode(state.select).asel, $ state.mode(state.select).hres, $ state.mode(state.select).seg_idx, $ energy,f,sigmaf, nbenergy, datatime, $ next = state.mode(state.select).next, $ prev = state.mode(state.select).prev, $ nocorrect = (state.mode(state.select).correct EQ 0), $ nopotential = (state.mode(state.select).potential EQ 0), $ parent = state.base_id, error = error) INPUTS: date (INTEGER): year, month and date in the format yyyymmdd (e.g., 19960529 is May 29, 1996) time (STRING): hours, minutes and seconds in the format 'hh:mm:ss' (e.g., '04:30:00') species (INTEGER): 0 for electrons 1 for ions de (FLOAT): energy bin size (delta_E/E) da (FLOAT): pitch-angle bin size (degrees) index (INTEGER): bin index to be used in the cut nseg (integer): number of segments to split up one 13.8 second block into nindex (integer): the index of the block desired (see nseg above) KEYWORD PARAMETERS: nocorrect: set this keyword to disable count correction nopotential: set this keyword to disable s/c potential subtraction parent: the base address of a parent widget if it exhists. error: return the error array from ddeis_block_process next: get the next block of data previous: get the previous block of data OUTPUTS: result (integer): 0 for failure, 1 for success. energy (FLOAT): 1-D array of energies (eV) f (DOUBLE): 1-D array of distribution function data (CGS units) sigmaf (double): 1-D array of standard deviations of the f points nbenergy (integer): The number of samples averaged together at each energy. readtime (strarr(2)): The min and max time of the data read in. SIDE EFFECTS: A new level1 file is open if necessary. PROCEDURE: Read one block of data, perform appropriate averaging, return cut of the data for the specified parameter range. EXAMPLE: See fitf_plot.pro for a good example of using this function. Written by: Eric E. Dors, 1 March 1998. MODIFICATION HISTORY: Mon Mar 16 11:44:47 1998, Eric DorsProblem in reform statement for sigmaf, if out.sigz_prop(index-1, idx) has onlye one element, it is recast to a scalar double instead of a dblarr(1). To fix this put the argument to reform in "[]".
(See ./fitf_read.pro)
NAME: fitf_set_widget PURPOSE: This procedure updates the fitf_hydra control widget to reflect the current state vector. CATEGORY: hydra_fitf CALLING SEQUENCE: fitf_set_widget, base, state, noupdate = noupdate INPUTS: base: The base id of the hydra_fitf control widget. state: The state vector of the widget from which plotting parameters are to be taken. KEYWORD PARAMETERS: noupdate: A switch which requests that the the widget is left out of screen update mode after the state is updated in memory. SIDE EFFECTS: The widgets in the hydra_fitf control widget are updated to reflect the state vector. RESTRICTIONS: The state vector should be define specified in init_fitf. The current state vector is stored in the user value of the first child widget in the hydra_fitf window. EXAMPLE: IDL> child = widget_info(hydra_fitf.top, /child) IDL> widget_control, child, get_uvalue = state IDL> fitf_set_widget, main_base, state Written by: Eric E. Dors, 1 March 1998. MODIFICATION HISTORY:
(See ./fitf_control.pro)
NAME: fitf_xyouts PURPOSE: This procedure facilitates multiple lines of output through the xyouts procedure. CATEGORY: hydra_fitf CALLING SEQUENCE: fitf_xyouts, xpos, ypos, string, color=fg, bangCcnt=bangCcnt, INPUTS: xpos: The x position to plot to. ypos: The y position to plot to. string: The string to print. KEYWORD PARAMETERS: compress: Switch to set if strcompress should be run before printing string. remove_all: Switch to remove all spaces with strcompress. bangCcnt: A counter which keeps track of the line number to be printed to. This counter should be set to zero by the user the first time fitf_xyouts is called. It will be incremented by fitf_xyouts as more lines are written to the screen. _extra: Any other keywords which xyouts accepts. EXAMPLE: IDL> bangCcnt = 0 ;reset the line counter IDL> fitf_xyouts, 0.65, 0.93, line1, /normal, bangCcnt=bangCcnt, $ color=fg IDL> fitf_xyouts, 0.65, 0.93, line2, /normal, bangCcnt=bangCcnt, $ color=fg Written by: Eric E. Dors, 1 March 1998. MODIFICATION HISTORY:
(See ./fitf_xyouts.pro)
NAME: FitTempKappa PURPOSE: This function fits the given data to a Kappa distribution function and estimate the errors in the parameters. CATEGORY: hydra_fitf CALLING SEQUENCE: retval = FitTempKappa(energy, f, 0., $ weight = w, iguess=iguess, kappa = kappa, $ density = denk, temperature = tempk, $ sigma = sigk, line = fit2, xline = xfit, $ chi2 = chi2k, /maxw_guess, probability = probk, $ errors = errormode) INPUTS: energy: The energy of the data point. f: The value of the distribution function for the data point. e: The value of the centroid for the Maxwellian fit function. KEYWORD PARAMETERS: chi2: The return value for chi squared by the fitting procedure. density: The density result found by the fit. temperature: The temperature result found by the fit. kappa: The kappa parameter result found by the fit. weight: An array of sigmas for the distribution function. The array should have the same number of elements as f and energy. iguess: An initial guess of the temperature and density. The input is a two dimensional array [igden,igtemp] maxw_guess: A switch to notify routine that the guess in iguess came from a maxwellian fitting routine (perhaps fittempmaxw. This helps interpretation of the initial guess. line: The returned values of the distribution function for each energy for the fit function. xline: The returned values of the energy used by the fit. sigma: The extimated errors in the parameters. A two dimensional array. [sigdensity, sigtemp, sigkappa]. probability: The probability that random fluctuations would produce a value of chi-squared larger than chi2. errors: The method to use in calculating the errors. 0: Use the hessian returned by spcurvefit to estimate the curvature near the fit values. 1: Search chi-squared space for the appropriate 68% level contour. If this keyword is not passed, the errors are not calculated OUTPUTS: result: 0 for failure, 1 for sucess COMMON BLOCKS: accel_p: The value of the centroid of the fit. This is in a common block so its value can be shared with TempFunctMaxwML with out making it a fit parameter. PROCEDURE: The non-linear marquardt-levenburg fit of a Maxwellian is perfomed through use of the function spcurvefit. EXAMPLE: IDL> Result = FitTempKappa(energy, f, 0., chi2 = chi2, den = den, $ IDL> weight=(1d0/sigmaf^2), temp = temp, $ IDL> line = fit1, xline = xfit, sigma = sig, prob = prob, $ IDL> errors = 0) IDL> plot, energy,f,/xlog,/ylog,psym=1 ;plot the data IDL> oplot, xfig,fit1,/xlog,/ylog ;plot the fit result Written by: Eric E. Dors, 1 March 1998. MODIFICATION HISTORY:
(See ./fittempkappa.pro)
NAME: FitTempMaxw PURPOSE: This function fits the given data to a Maxwellian distribution function and estimate the errors in the parameters. CATEGORY: hydra_fitf CALLING SEQUENCE: result = FitTempMaxw(energy, f, emax, chi2 = chi2, density = den, $ weight=w, temperature = temp, $ line = fit1, xline = xfit, sigma = sig, $ probability = prob, errors = errormode) INPUTS: energy: The energy of the data point. f: The value of the distribution function for the data point. e: The value of the centroid for the Maxwellian fit function. KEYWORD PARAMETERS: chi2: The return value for chi squared by the fitting procedure. density: The density result found by the fit. temperature: The temperature result found by the fit. weight: An array of sigmas for the distribution function. The array should have the same number of elements as f and energy. iguess: An initial guess of the temperature and density. The input is a two dimensional array [igden,igtemp] line: The returned values of the distribution function for each energy for the fit function. xline: The returned values of the energy used by the fit. sigma: The extimated errors in the parameters. A two dimensional array. [sigdensity, sigtemp]. probability: The probability that random fluctuations would produce a value of chi-squared larger than chi2. errors: The method to use in calculating the errors. 0: Use the hessian returned by spcurvefit to estimate the curvature near the fit values. 1: Search chi-squared space for the appropriate 68% level contour. If this keyword is not passed, the errors are not calculated OUTPUTS: result: 0 for failure, 1 for sucess COMMON BLOCKS: accel_p: The value of the centroid of the fit. This is in a common block so its value can be shared with TempFunctMaxwML with out making it a fit parameter. PROCEDURE: The non-linear marquardt-levenburg fit of a Maxwellian is perfomed through use of the function spcurvefit. EXAMPLE: IDL> Result = FitTempMaxw(energy, f, 0., chi2 = chi2, den = den, $ IDL> weight=(1d0/sigmaf^2), temp = temp, $ IDL> line = fit1, xline = xfit, sigma = sig, prob = prob, $ IDL> errors = 0) IDL> plot, energy,f,/xlog,/ylog,psym=1 ;plot the data IDL> oplot, xfig,fit1,/xlog,/ylog ;plot the fit result Written by: Eric E. Dors, 1 March 1998. MODIFICATION HISTORY:
(See ./fittempmaxw.pro)
NAME: form_print_cmd PURPOSE: The purpose of this function is to create a string which contains the operating system command to print a file of a given type to the correct printer. CATEGORY: General Utility CALLING SEQUENCE: Result = form_print_cmd(print_file, printer_type, $ print_color, lpr_switches, ptype_btns, $ color_btns, print_command) INPUTS: print_file: The name of the file to be printed. printer_type: A value from the list of printer types in ptype_btns describing the type of printer. print_color: A value from the list of printer color support in color_btns describing the color printing options selected. lpr_switches: A string of user printer switches to be used in addition to the switches set in print_window.cfg. ptype_btns: A list of printer types. color_btns: A list of printer color options. KEYWORD PARAMETERS: top_widget: the id of the parent widget base if it exists OUTPUTS: print_command: A string which contains the system command necessary to print the desired file. result: 0 for failure of this routine, 1 for success. PROCEDURE: Replace the reserved variable queue with the print queue appropriate to the current print job. Replace the reserved variable file with the file name appropriate for this print job. Expand all other variables. Return the print_command requested. EXAMPLE: ret_val=form_print_cmd(print_file, printer_type, $ print_color, lpr_switches, ptype_btns, $ color_btns, print_command) if (ret_val eq 1) then begin spawn,print_command endif Written by: Eric E. Dors, 9 September 1997. MODIFICATION HISTORY: Fri Jan 23 19:42:25 1998, Eric E. DorsAdded top_widget parameter for use with widget_message. Fri Sep 12 15:36:07 1997, Eric E. Dors Add recognition of new variable to configuration file called 'file' this shows the position of the file name in the pring command.
(See ./print_window.pro)
NAME: get_cfg_line PURPOSE: The purpose of this function is to return one variable expression line configuration file. CATEGORY: General Utility CALLING SEQUENCE: retval = get_cfg_line(unit,oneline) INPUTS: unit: The file unit number of the opened configuration file. OUTPUTS: oneline: One variable expression is returned from the configuration file. Comment lines are skipped. retval: 1 is returned on success, 0 is returned if eof is found before a variable definition is found. PROCEDURE: The configuration file is read in line by line until a non commented line is found and then that line of text is returned to the caller in oneline and 1 is returned in retval. If eof is hit then the value of oneline is not guarenteed to be anything useful, and retval is set to 0. EXAMPLE: retval = get_cfg_line(unit, oneline) Written by: Eric E. Dors, 9 September 1997. MODIFICATION HISTORY:
(See ./print_window.pro)
NAME: get_config_filename PURPOSE: This function locates the fully qualified filename of the configuration file required for the operation of print_window.pro. CATEGORY: General Untility CALLING SEQUENCE: Result = get_config_filename(filenameout) KEYWORD PARAMETERS: top_widget: the id of the parent widget base if it exists OUTPUTS: result: result is set to 1 for sucess and to 0 for failure of this subroutine to find the configuration filename. filenameout: The fully qualified filename of the configuration file print_window.cfg. PROCEDURE: First an optional environment variable called PRINT_WINDOW_CFG is searched for. This environment variable is supposed to contain the path to the configuration file "print_window.cfg". If the environment variable is not found then directory in which print_window.pro resides is searched for the system default configuration file also called print_window.cfg. If the file is found the configuration information is read in, otherwise the programs writes an error message and exits. EXAMPLE: F = get_config_filename(cfgfilename) Written by: Eric E. Dors, 9 September 1997. MODIFICATION HISTORY: Fri Jan 23 19:41:41 1998, Eric E. DorsAdded top_widget parameter for use with widget_message.
(See ./print_window.pro)
NAME: hydra_fitf PURPOSE: This procedure creates a widget which can read level 1 distribution function data, display it, print it, and fit a Maxwellian or kappa function to it. Click on the help button for a detailed descripton. CATEGORY: hydra_fitf CALLING SEQUENCE: hydra_fitf, path, t0, papco=papco, group = group, window = window INPUTS: path: The date to display data for in the form 'yymmdd'. t0: The time to display data for in the form 'hh:mm:ss'. KEYWORD PARAMETERS: papco: A switch to tell the widget that papco is the caller. group: A variable containing the group id of the caller. Thus, if the calling widget is destroyed, this widget and all its children will be destroyed too. window: The number of the papco draw window which called this program. COMMON BLOCKS: myregister: This common block exists to make the the variable myreg global. The purpose of this variable is to register hydra_fitf widgets. Specifically, myreg is an array of structures which contain the widget id of a hydra_fitf base widget and the widget id of the draw window which owns that slice window. This array facilitate multiple slice widgets being open at the same time. With out this registry one would not be able to know which slice widget a given draw window click event should be sent to. SIDE EFFECTS: A new widget window may be created. An element may be added to regarr in the myregister common block. PROCEDURE: The hydra_fitf registration list is searched to see if the caller already has a slice widget open. If not, a new element in the hydra_fitf_slice registration list is created and a new widget window is opened. Then the plot window is updated with a plot of the time requested by path and t0. EXAMPLE: See user_hydra_fitf_hydra_spec.pro for the papco calling sequence. From IDL, with out papco running: IDL> @papco_startup IDL> hydra_fitf, '19960529', '21:00:00' This opens a window with a plot of the data from 05/19/1996 at 21:00 hours. There are many options which can be set regarding plotting style and processing. See the help widget help button for help on these options. Written by: Eric E. Dors, 1 March 1998. MODIFICATION HISTORY: Sun Feb 21 15:17:03 1999, Eric E. DorsUpdate use of state.args.path for new four character year string instead of old two character year string. Mon Mar 16 10:46:27 1998, Eric Dors Some how the initialization of state.slice_draw to slice_draw was erased during the editing fo this code for the version 1.00 release. The initialization has been fixed in the section labeled "store base variables needed in event manager".
(See ./hydra_fitf.pro)
NAME: hydra_fitf_event PURPOSE: This procedure handles events for the hydra_fitf slice widget. CATEGORY: hydra_fitf CALLING SEQUENCE: hydra_fitf_event, event INPUTS: event: The event structure xmanager created for the user click event. SIDE EFFECTS: Possible side effects: 1. The slice state structure may be modified if the particular event requires it. 2. A new plot may be written to the screen or the printer. RESTRICTIONS: This procedure is intended to be called by widget events read by the xmanager. PROCEDURE: The hydra_fitf state vector (structure) is read from the uvalue of the first child in the widget. Then the calling event is serviced by searching for that events uvalue in a large case statement which contains the code to handle that event. The state vector (possibly modified) is written back to the child widget's uvalue for future use. Written by: Eric E. Dors, 1 March 1998. MODIFICATION HISTORY: Tue Mar 16 23:53:19 1999, Eric E. DorsThe code from the 'button_draw' case was moved to subroutine hydra_fitf_redraw to facilitate calling it from both 'button_draw' and 'base_id'. Tue Mar 16 22:28:56 1999, Eric E. Dors The function module_helpfile no longer exists so I created the function fitf_which_help.pro to take its place. Sun Feb 21 15:12:25 1999, Eric E. Dors Update the use of state.args.path for its new use of four digit years instead of the old two digit year. Thu Apr 2 16:58:54 1998, Eric Dors In 'button-help' fixed argument to xdisplay file to add the proper path to the helpfilename.
(See ./hydra_fitf.pro)
NAME: hydra_fitf_redraw PURPOSE: The purpose of this procedure is to redraw the output in the draw widget of hydra_fitf.pro. CATEGORY: hydra_fitf CALLING SEQUENCE: hydra_fitf_redraw, state, child INPUTS: state: The state vector of the widget. child: The widget where the state vector is stored. SIDE EFFECTS: The hydra_fitf draw widget is updated. PROCEDURE: fitf_plot is called to update the draw widget after appropriately setting the motion parameters to 0 in the state vector. After the slice draw widget is refreshed, the hydra_strike is called to move the strike in the panel plot. EXAMPLE: hydra_fitf_redraw, state, child Written by: Eric E. Dors, 16 March 1999. MODIFICATION HISTORY:
(See ./hydra_fitf.pro)
NAME: init_fitf PURPOSE: This procedure creates and initializes the state vector for a hydra_fitf slice widget. CATEGORY: hydra_fitf CALLING SEQUENCE: init_fitf, path, t0, state, group = group, papco = papco, window = window INPUTS: path: The date to display data for in the form 'yyyymmdd'. t0: The time to display data for in the form 'hh:mm:ss'. KEYWORD PARAMETERS: papco: A switch to tell the widget that papco is the caller. group: A variable containing the group id of the caller. Thus, if the calling widget is destroyed, this widget and all its children will be destroyed too. window: The number of the papco draw window which called this program. OUTPUTS: state: Return the initialized state vector. OPTIONAL OUTPUTS: Describe optional outputs here. If the routine doesn't have any, just delete this section. EXAMPLE: IDL> init_fitf, '960529', '19:00:00', state, group=group_leader Written by: Eric E. Dors, 1 March 1998. MODIFICATION HISTORY: Tue Mar 16 21:42:07 1999, Eric E. DorsCast version 1.10. Sun Feb 21 15:35:56 1999, Eric E. Dors Cast version 1.09. Sun Feb 21 15:18:28 1999, Eric E. Dors Update comment block to be consistent with new use of four character year string instead of old two character year string. Fri Sep 11 12:17:19 1998, Eric E. Dors Fixed printing bug in print_window.pro relating to the use of the obsolete parameter group. Cast "version 1.08". Wed Sep 9 08:44:08 1998, Eric E. Dors Fixed bug in user_hydra_fitf_hydra_spec.pro. Cast "version 1.07". Thu Aug 27 16:32:18 1998, Eric E. Dors Added missing file time_stamp.pro to distribution. Default diagnostic popup windows now disabled by default. Cast "version 1.06". Fri Apr 10 13:56:38 1998, Eric Dors Fixed bug in fitf_plot.pro. Cast "version 1.05". Tue Apr 7 00:05:12 1998, Eric Dors Fixed bug in fitf_control.pro. Cast "version 1.04". Thu Apr 2 17:01:10 1998, Eric Dors Fixed bug in generating helpfile name for hydra_fitf.pro and fitf_control.pro. Cast "version 1.03". Mon Mar 16 14:46:14 1998, Eric Dors Bug in fitf_plot fixed having to do with foreground and background colors. Cast "version 1.02". Mon Mar 16 11:08:16 1998, Eric Dors Bug fix in hydra_fif and fitf_read, cast "version 1.01". Mon Mar 9 19:36:39 1998, Eric Dors Changed the structure names to make them more unique.
(See ./init_fitf.pro)
NAME: polygamma PURPOSE: This function calcuates the polygamma function (the derivative of the natural log of the gamma function). CATEGORY: hydra_fitf CALLING SEQUENCE: result = polygamma(x,dx=dx) INPUTS: x: The location to calculate the polygamma function at. KEYWORD PARAMETERS: dx: The grid size to differentiate lngamma on. If dx is not explicitly specified then dx defaults to x/10. OUTPUTS: result: the value of d(lngamma(x))/dx|x=x PROCEDURE: Use the IDL deriv function to calculate the derivative of lngamma. Return the result. EXAMPLE: result = polygamma(x,dx=dx) Written by: Eric E. Dors, 1998. Modified from John Dorrelli MODIFICATION HISTORY:
(See ./polygamma.pro)
NAME: PRINT_FINISH PURPOSE: This procedure completes the actions initiated by PRINT_WINDOW. CATEGORY: General Utility CALLING SEQUENCE: PRINT_FINISH, handle KEYWORD PARAMETERS parent_id: The widget handle to the controling base widget. This is used so that informational dialog can be centered on that widget. noconfirm: if 0 then ask before deleting print file, otherwise delete without confirmation. COMMON BLOCKS: print_event: A common block to pass information between the event handler and the widget creation routine. print_finish: A common block to hold the selections made during the PRINT_WINDOW dialogue with the user. SIDE EFFECTS: The current plot device is changed. If it was requested either a file is created, printed or both. EXAMPLE: result=print_window(xsize=draw_x, ysize=draw_y) ... if (result) then begin data plotting routines go here time_stamp ... print_finish, parent_id=parent_id endif ... Written by: Eric E. Dors, 15 November 1995. MODIFICATION HISTORY: HISTORY: Fri Jan 23 19:16:46 1998, Eric E. DorsRemoved top_widget input and created the parent_id ; keyword parameter to contain the base id of the calling widget if it exists. Also added the noconfirm parameter to prevent the poping of the confirmation dialog for deleting of the print file.
(See ./print_window.pro)
NAME: PRINT_WINDOW PURPOSE: This function creates a dialogue box for printing information, the generated events can put IDL into a state to make files or send plots to a printer. CATEGORY: General Utility CALLING SEQUENCE: Result = PRINT_INFO_WINDOW Result: 1 unless print operation was canceled in which case 0 is returned. KEYWORD PARAMETERS: xsize: Optional keyword to allow removing of device dependent parameters for operations such as tv. ysize: Optional keyword to allow removing of device dependent parameters for operations such as tv. color_t: Color table to use for color printing. (39 default) color_g: The gamma factor to use for color printing. (1.0 default) bw_t: Color table to use for black and white printing. (0 default) bw_g: The gamma factor to use for black and white printing. (1.0 default) group: Obsolete parameter. parent_id: The widget handle to the controling base widget. This is used so that informational dialog can be centered on that widget. filename: default filename COMMON BLOCKS: print_event: A common block to pass information between the event handler and the widget creation routine. SIDE EFFECTS: The current plot device is changed. NOTE By calling print_finish, a device,/close and a set_plot, 'x' will be done to restore to the normal state. EXAMPLE: result=print_window(xsize=draw_x, ysize=draw_y) ... if (result) then begin data plotting routines go here time_stamp ... print_finish, parent_id=parent_id endif ... Written by: Eric E. Dors, 15 November 1995. MODIFICATION HISTORY: Fri Sep 11 11:32:40 1998, Eric E. DorsUpdated the documentation on the "group" keyword parameter (obsolete keyword), made an error statement to flag use of "group" keyword, and moved the initialization of the retval variable from print_handler to print_window. Wed Feb 4 05:30:28 1998, Eric E. Dors added support for a default filename from the commandline Fri Jan 23 18:46:48 1998, Eric E. Dors Simplified the creation of the main base widget. Changed print_window to a function instead of a procedure. Returns 0 if canceled, 1 otherwise. Also added a parent_id parameter to contain the base id of the calling widget if it exists. This facilitates the centering of widget_message events.
(See ./print_window.pro)
NAME: read_print_config PURPOSE: The purpose of this subroutine is to read in the printing configuration file called print_window.cfg. And return a list of variables set in the configuration file to the caller. CATEGORY: General Utility CALLING SEQUENCE: Result = reat_print_config(varlist) KEYWORD PARAMETERS: top_widget: the id of the parent widget base if it exists OUTPUTS: varlist: A 2xn array holding variable [name, definition] of each of the n variables defined in the configuration file. result: Return 1 on successful configuration file read, and 0 on failure. PROCEDURE: get_config_filename is used to find the configuration file, then it is opened and read line by line with get_cfg_line. Since the configuration file is perscribed to have comment lines beginning with ';' and variable setting lines which look like 'name=definition' we separate the names from the definitions and return the result as a 2xn dimensional array of [[name1,def1],[name2,def2],...,[namen,defn]]. EXAMPLE: result = read_print_config(varlist) Written by: Eric E. Dors, 9 September 1997. MODIFICATION HISTORY: Fri Jan 23 19:42:06 1998, Eric E. DorsAdded top_widget parameter for use with widget_message.
(See ./print_window.pro)
NAME: spOPLOTERR PURPOSE: Overplot data points with accompanying error bars. CATEGORY: Plotting, 2-dimensional. CALLING SEQUENCE: OPLOTERR, [ X ,] Y , Err [, Psym ] INPUTS: Y: The array of Y values. Err: The array of error bar values. OPTIONAL INPUT PARAMETERS: X: An optional array of X values. The procedure checks whether or not the third parameter passed is a vector to decide if X was passed. If X is not passed, then INDGEN(Y) is assumed for the X values. KEYWORD PARAMETERS: PSYM: The plotting symbol to use (default = +7). COLOR: The color of the plot. COMMON BLOCKS: None. SIDE EFFECTS: None. RESTRICTIONS: Arrays cannot be of type string. There must be enough points to plot. PROCEDURE: A plot of X versus Y with error bars drawn from Y - ERR to Y + ERR is written to the output device over any plot already there. MODIFICATION HISTORY: William Thompson Applied Research Corporation July, 1986 8201 Corporate Drive Landover, MD 20785
(See ./spoploterr.pro)
NAME: SVDFIT PURPOSE: Perform a general least squares fit with optional error estimates. This version uses SVD. A user-supplied function or a built-in polynomial is fit to the data. CATEGORY: Curve fitting. CALLING SEQUENCE: Result = SVDFIT(X, Y, M) INPUTS: X: A vector representing the independent variable. Y: Dependent variable vector. This vector should be same length as X. M: The number of coefficients in the fitting function. For polynomials, M is equal to the degree of the polynomial + 1. OPTIONAL INPUTS: Weight: A vector of weights for Y(i). This vector should be the same length as X and Y. If this parameter is ommitted, 1 is assumed. The error for each term is weighted by Weight(i) when computing the fit. Frequently, Weight(i) = 1./Sigma(i) where Sigma is the measurement error or standard deviation of Y(i). Funct: A string that contains the name of an optional user-supplied basis function with M coefficients. If omitted, polynomials are used. The function is called: R = FUNCT(X,M) where X is an N element vector, and the function value is an (N, M) array of the N inputs, evaluated with the M basis functions. M is analogous to the degree of the polynomial +1 if the basis function is polynomials. For example, see the function COSINES, in the IDL User Library, which returns a basis function of: R(i,j) = cos(j*x(i)). For more examples, see Numerical Recipes, page 519. The basis function for polynomials, is R(i,j) = x(i)^j. OUTPUTS: SVDFIT returns a vector of M coefficients. OPTIONAL OUTPUT PARAMETERS: NOTE: In order for an optional keyword output parameter to be returned, it must be defined before calling SVDFIT. The value or structure doesn't matter. For example: YF = 1 ;Define output variable yf. C = SVDFIT(X, Y, M, YFIT = YF) ;Do SVD, fitted Y vector is now ;returned in variable YF. YFIT: Vector of calculated Y's. CHISQ: Sum of squared errors multiplied by weights if weights are specified. COVAR: Covariance matrix of the coefficients. VARIANCE: Sigma squared in estimate of each coeff(M). SINGULAR: The number of singular values returned. This value should be 0. If not, the basis functions do not accurately characterize the data. COMMON BLOCKS: None. SIDE EFFECTS: None. MODIFICATION HISTORY: Adapted from SVDFIT, from the book Numerical Recipes, Press, et. al., Page 518. minor error corrected April, 1992 (J.Murthy)
(See ./spsvdfit.pro)
NAME: time_stamp PURPOSE: This function marks the date and time of a plot creation and optionally a string associated with the plot on the middle right side of the output. CATEGORY: utility funcitons CALLING SEQUENCE: time_stamp, OPT_string OPTIONAL INPUTS: OPTstring: An optional string to appear after the date and time. SIDE EFFECTS: The time and date of the are written to the current output device. EXAMPLE: plot, findgen(100) time_stamp, 'generated by command: plot,findgen(100)' Written by: Bill Peria, Date ?. MODIFICATION HISTORY: Thu Aug 27 16:26:57 1998, Eric E. DorsRemoved special handeling for VT330's.
(See ./time_stamp.pro)
NAME: user_hydra_fitf_hydra_spec PURPOSE: This function serves as the interface between the hydra_spec panel plot and the hydra_fitf slice widget. CATEGORY: hydra_fitf CALLING SEQUENCE: user_hydra_fitf_hydra_spec, panel, seconds, yvalue INPUTS: panel: seconds: yvalue: COMMON BLOCKS: time: xut1, xut2 plot_composer: SIDE EFFECTS: A new window is placed on the screen containing a slice plot from the location of the mouse event. RESTRICTIONS: This slicer is only meant for use with hydra_spec.pro PROCEDURE: The correct time, date, and parent widget id are calculated and hydra_fitf.pro is called to create the slice widget. EXAMPLE: user_hydra_fitf_hydra_spec, panel, seconds, yvalue Written by: Eric E. Dors, 1 March 1998. MODIFICATION HISTORY: Sun Feb 21 14:03:00 1999, Eric E. DorsChanged year parsing code to return four character year instead of two character year. Wed Sep 9 08:42:30 1998, Eric E. Dors The result of convert_T90_to_date is often wildly wrong because the input argument (1st argument) was being sent as a float instead of a long value. "seconds" is now converted to long before adding it to xut1.
(See ./user_hydra_fitf_hydra_spec.pro)
NAME: which_help PURPOSE: The purpose of this function is to find the path of a help file. CATEGORY: hydra_fitf CALLING SEQUENCE: helppath=which_help('helpfilename') INPUTS: helpfilename: Name of the help file which is being searched for. KEYWORD PARAMETERS: all: Not fully supported yet, keyword to look for multiple instnace of a helpfile. OUTPUTS: This function returns the full path to the helpfile. COMMON BLOCKS: module_paths: Papco common block containing the path to all registered modules. PROCEDURE: The 'paths' variable in module_paths is searched for the helpfile if it exists, otherwise the !path variable is searched. EXAMPLE: F = fitf_which_help('fitf_control.help') Written by: Eric E. Dors, 16 March 1999. MODIFICATION HISTORY:
(See ./fitf_which_help.pro)