include include "../lib/cf_obj.h" include "centerflux.h" # Memory management. define Output_par Memc[output_par] #--------------------------------------------------------------------------- .help t_centerflux Apr94 source .ih NAME t_centerflux -- Compute mean over a range of diodes. .endhelp #--------------------------------------------------------------------------- procedure t_centerflux() # Input files pointer input # Coordinated Input File (CIF) object. # Output table pointer cf_alloc() # Open the CenterFlux output table object. pointer output # The Output table object. pointer output_par # Value of the "output" parameter. # Pixel parameters. int center, size # Center/size of pixel limits. int start_pixel, end_pixel # Low/high pixel limits. double low_reject, high_reject # Iteration parameters. int niter # Iteration parameters. # Graphics parameters. pointer gopen() # Open the graphics device. pointer gp # Graphics descriptor. # Coordinated Input File object. pointer cif_alloc() # Create the CIF object. # Generic. bool clgetb() # Get boolean-valued parameter. pointer clgeti() # Get integer-valued parameter. double clgetd() # Get double-valued parameter. pointer sp # Stack pointer. pointer sx # Temporary string. begin call smark (sp) call salloc (sx, CF_SZ_TMPSTRING, TY_CHAR) call salloc (output_par, SZ_PATHNAME, TY_CHAR) # Allocated the coordinate input file object. input = cif_alloc (CF_N_INPUTS, 0) # Create the centerflux output object. output = cf_alloc() CF_EXIST(output,CF_CARPOS) = YES CF_EXIST(output,CF_ORDER) = YES CF_EXIST(output,CF_WLOW) = YES CF_EXIST(output,CF_WHIGH) = YES CF_EXIST(output,CF_FLUX) = YES CF_EXIST(output,CF_ERR) = YES CF_EXIST(output,CF_NPTS) = YES # Get interactive parameters. call clgstr ("input", CIF_p_file_list(input), CIF_SZ_FNAME) call clgstr ("output", Output_par, SZ_PATHNAME) # Get auxiliary input files names. call clgstr ("wave", CIF_in_file_list(input,CF_WAVE), CIF_SZ_FNAME) call clgstr ("mask", CIF_in_file_list(input,CF_MASK), CIF_SZ_FNAME) # Setup the default extensions call clgstr ("input_ext", CIF_p_ext(input), CIF_SZ_FNAME) call clgstr ("wave_ext", CIF_in_ext(input,CF_WAVE), CIF_SZ_FNAME) call clgstr ("mask_ext", CIF_in_ext(input,CF_MASK), CIF_SZ_FNAME) # Get pixel range parameters. start_pixel = clgeti ("start_pixel") end_pixel = clgeti ("end_pixel") center = clgeti ("center") size = clgeti ("size") if (IS_INDEFI(start_pixel) && IS_INDEFI(end_pixel) && IS_INDEFI(center) && IS_INDEFI(size)) call error (1, "centerflux: No pixel range defined. Check start_pixel, end_pixel, center, and size parameters") # If interactive, open the graphics device. if (clgetb ("interactive")) { call clgstr ("device", Sx, CF_SZ_TMPSTRING) gp = gopen (Sx, NEW_FILE, STDGRAPH) } else gp = NULL # Find the centerfluxes. low_reject = clgetd ("low_reject") high_reject = clgetd ("high_reject") niter = clgeti ("iterations") call centerflux (input, output, gp, start_pixel, end_pixel, center, size, low_reject, high_reject, niter) # Write the results to a table. if (clgetb ("newtable")) call cf_write_table (output, Output_par, NEW_FILE, NULL) else call cf_write_table (output, Output_par, READ_WRITE, NULL) # Write back the parameters. call clputi ("start_pixel", start_pixel) call clputi ("end_pixel", end_pixel) call clputi ("center", center) call clputi ("size", size) call clputd ("low_reject", low_reject) call clputd ("high_reject", high_reject) call clputi ("iterations", niter) # That's all folks. if (gp != NULL) call gclose (gp) call cf_free (output) call cif_free (input) call sfree (sp) end #--------------------------------------------------------------------------- # End of t_centerflux #---------------------------------------------------------------------------