#pragma rtGlobals=3 // Use modern global access method and strict wave access. #include //--------------------------------------------------------------------------------------------- FUNCTION /WAVE TSCal_HistogramLayers(WaveIn, [Disp, OutName]) Wave WaveIn Variable Disp String OutName //NAME: TSCal_HistogramLayers // //PURPOSE: // Calculate histograms for each pixel given a multilayer flat-field // calibration image. // Will output a 4D wave where rows & columns correspond to pixel location, // and layer data corresponds to the histogram data for that pixel // //AUTHOR: // Dave Schlossberg // Univ. of Wisconsin - Madison // 1500 Engineering Drive // Madison, WI 53706 // //CATEGORY: // Thomson scattering calibration analyses // //INPUTS: // WaveIn 4D wave containing flat-field calibration data to be anlayzed // //OPTIONAL INPUTS: // Disp Set nonzero to display histogram results // OutName String containing desired name for output wave // //OUTPUTS: // HistoLayers 4D wave containing histograms along layer dimension. // Rows & columns correspond to original row & column locations in original wave // //EXAMPLE CALLING SEQUENCES: // //DEPENDENCIES: // None. // //MODIFICATION HISTORY: // Created 6/19/16 by Dave Schlossberg // // // IF( ParamIsDefault(OutName) ) OutName = UniqueName("HistoLayers", 1, 0) ENDIF // Make output wave in which to store histogram results Duplicate /O WaveIn $OutName Wave OutWave = $OutName // Insert a new "chunk" to hold the histogram scale information InsertPoints /M=3 1, 1, OutWave OutWave = 0 // Make temporary waves for histogram of single beams (i.e. p0, q0, all layers) Make /O/N=(dimsize(WaveIn, 2))/FREE BeamVals, BeamHisto // Step through input wave assembling histograms and corresponding scales. Variable indy_row, indy_col FOR( indy_col=0; indy_col