#
# Template for generating aSub records which accumulate
# a history of the specified PV over the specified time period.
#
#	Macros:
#		PV			- Name of PV to track
#		PERIOD		- Time period over which to retain history, in seconds
#						If zero, each sample gets shifted into the buffer
#		PUBLISH		- Publish period for updating output array, in seconds
#						If zero, publish on each update
#		N_SAMPLES	- Number of samples to keep, Output waveform's NELEM
#						Defaults to 300
#		EGU			- EGU for sample data, defaults to ""
#		X_EGU		- Units to display on the time axis
#		S_PER_X_EGU	- Conversion between seconds and X_EGU, e.g. 3600 for hrs
#		NAME		- Name of this time period
#		DESC		- Description of Time Period, default "LAST_N Hist"
#		OUT			- Name of waveform PV where history is written
#						Defaults to $(PV)_LAST_N
#

# History asub
# Monitors an scalar value and records it's history
#	over the specified time period.
# The delay between samples is determined by the time
# period divided by the size of the output array.
#	Inputs:
#		A	- a single scalar value of type double
#		P	- double publish interval in seconds (Use 0 for update on change)
#		T	- double history interval in seconds (Use 0 for update on change)
#	Outputs:
#		A	- Array of double's containing samples of A
#				taken over the last T seconds.
#
record( aSub, "$(PV)_LAST_N_SUB" )
{
	field( DESC, "Keeps History of PV" )
	field( SCAN, ".1 second" )
	field( PINI, "NO" )
	field( INAM, "History_Init" )
	field( SNAM, "History_Process" )
	field( EFLG, "ON CHANGE" )

	field( FTA,  "DOUBLE" )
	field( NOA,  1 )
	field( INPA, "$(PV) CP NMS" )

	field( FTP, "DOUBLE" )
	field( NOP, 1 )
	field( INPP, "0.1" )

	field( FTT, "DOUBLE" )
	field( NOT, 1 )
	field( INPT, "0" )

	field( FTVA, "DOUBLE" )
	field( NOVA, $(N_SAMPLES=300) )
	field( OUTA, "$(PV)_LAST_N PP" )

}

record( waveform, "$(PV)_LAST_N" )
{
    field( DESC, "LAST_N Hist" )
	field( FTVL, "DOUBLE" )
	field( EGU,  "$(EGU=)" )
	field( NELM, $(N_SAMPLES=300) )
	field( TSEL, "$(PV).TIME" )
	info( autosaveFields, "EGU" )
}

# Create an array of time coordinates in the specified units
record( acalcout, "$(PV)_LAST_N:CALCX" ) 
{
	field( DESC, "x-axis times" )
	field( CALC, "(B>0)?(IX+1-A)*C/(A*B):(IX+1-A)" )
	field( INPA, "$(N_SAMPLES=300)" )
	field( INPB, "0" )
	field( INPC, "0" )
	field( NELM, "$(N_SAMPLES=300)" )
	field( PINI, "YES" )
	field( SCAN, "Passive" )
	field( EGU,  "N" )
	field( PREC, "3" )
	field( OUT,  "$(PV)_LAST_N:X-AXIS PP" )
}

record( waveform, "$(PV)_LAST_N:X-AXIS" ) 
{
	field( DESC, "x-axis times" )
	field( SCAN, "Passive" )
	field( DTYP, "Soft Channel" )
	field( FTVL, "FLOAT" )
	field( NELM, "$(N_SAMPLES=300)" )
	field( EGU,  "N" )
	field( PREC,  "3" )
}

#
# Template for generating aSub records which accumulate
# a history of the specified PV over the specified time period.
#
#	Macros:
#		PV			- Name of PV to track
#		PERIOD		- Time period over which to retain history, in seconds
#						If zero, each sample gets shifted into the buffer
#		PUBLISH		- Publish period for updating output array, in seconds
#						If zero, publish on each update
#		N_SAMPLES	- Number of samples to keep, Output waveform's NELEM
#						Defaults to 300
#		EGU			- EGU for sample data, defaults to ""
#		X_EGU		- Units to display on the time axis
#		S_PER_X_EGU	- Conversion between seconds and X_EGU, e.g. 3600 for hrs
#		NAME		- Name of this time period
#		DESC		- Description of Time Period, default "3HR Hist"
#		OUT			- Name of waveform PV where history is written
#						Defaults to $(PV)_3HR
#

# History asub
# Monitors an scalar value and records it's history
#	over the specified time period.
# The delay between samples is determined by the time
# period divided by the size of the output array.
#	Inputs:
#		A	- a single scalar value of type double
#		P	- double publish interval in seconds (Use 0 for update on change)
#		T	- double history interval in seconds (Use 0 for update on change)
#	Outputs:
#		A	- Array of double's containing samples of A
#				taken over the last T seconds.
#
record( aSub, "$(PV)_3HR_SUB" )
{
	field( DESC, "Keeps History of PV" )
	field( SCAN, ".1 second" )
	field( PINI, "NO" )
	field( INAM, "History_Init" )
	field( SNAM, "History_Process" )
	field( EFLG, "ON CHANGE" )

	field( FTA,  "DOUBLE" )
	field( NOA,  1 )
	field( INPA, "$(PV) CP NMS" )

	field( FTP, "DOUBLE" )
	field( NOP, 1 )
	field( INPP, "0.1" )

	field( FTT, "DOUBLE" )
	field( NOT, 1 )
	field( INPT, "10800" )

	field( FTVA, "DOUBLE" )
	field( NOVA, $(N_SAMPLES=18) )
	field( OUTA, "$(PV)_3HR PP" )

}

record( waveform, "$(PV)_3HR" )
{
    field( DESC, "3HR Hist" )
	field( FTVL, "DOUBLE" )
	field( EGU,  "$(EGU=)" )
	field( NELM, $(N_SAMPLES=18) )
	field( TSEL, "$(PV).TIME" )
	info( autosaveFields, "EGU" )
}

# Create an array of time coordinates in the specified units
record( acalcout, "$(PV)_3HR:CALCX" ) 
{
	field( DESC, "x-axis times" )
	field( CALC, "(B>0)?(IX+1-A)*C/(A*B):(IX+1-A)" )
	field( INPA, "$(N_SAMPLES=18)" )
	field( INPB, "3600" )
	field( INPC, "10800" )
	field( NELM, "$(N_SAMPLES=18)" )
	field( PINI, "YES" )
	field( SCAN, "Passive" )
	field( EGU,  "hr" )
	field( PREC, "3" )
	field( OUT,  "$(PV)_3HR:X-AXIS PP" )
}

record( waveform, "$(PV)_3HR:X-AXIS" ) 
{
	field( DESC, "x-axis times" )
	field( SCAN, "Passive" )
	field( DTYP, "Soft Channel" )
	field( FTVL, "FLOAT" )
	field( NELM, "$(N_SAMPLES=18)" )
	field( EGU,  "hr" )
	field( PREC,  "3" )
}

#
# Template for generating aSub records which accumulate
# a history of the specified PV over the specified time period.
#
#	Macros:
#		PV			- Name of PV to track
#		PERIOD		- Time period over which to retain history, in seconds
#						If zero, each sample gets shifted into the buffer
#		PUBLISH		- Publish period for updating output array, in seconds
#						If zero, publish on each update
#		N_SAMPLES	- Number of samples to keep, Output waveform's NELEM
#						Defaults to 300
#		EGU			- EGU for sample data, defaults to ""
#		X_EGU		- Units to display on the time axis
#		S_PER_X_EGU	- Conversion between seconds and X_EGU, e.g. 3600 for hrs
#		NAME		- Name of this time period
#		DESC		- Description of Time Period, default "8HR Hist"
#		OUT			- Name of waveform PV where history is written
#						Defaults to $(PV)_8HR
#

# History asub
# Monitors an scalar value and records it's history
#	over the specified time period.
# The delay between samples is determined by the time
# period divided by the size of the output array.
#	Inputs:
#		A	- a single scalar value of type double
#		P	- double publish interval in seconds (Use 0 for update on change)
#		T	- double history interval in seconds (Use 0 for update on change)
#	Outputs:
#		A	- Array of double's containing samples of A
#				taken over the last T seconds.
#
record( aSub, "$(PV)_8HR_SUB" )
{
	field( DESC, "Keeps History of PV" )
	field( SCAN, ".1 second" )
	field( PINI, "NO" )
	field( INAM, "History_Init" )
	field( SNAM, "History_Process" )
	field( EFLG, "ON CHANGE" )

	field( FTA,  "DOUBLE" )
	field( NOA,  1 )
	field( INPA, "$(PV) CP NMS" )

	field( FTP, "DOUBLE" )
	field( NOP, 1 )
	field( INPP, "0.1" )

	field( FTT, "DOUBLE" )
	field( NOT, 1 )
	field( INPT, "28800" )

	field( FTVA, "DOUBLE" )
	field( NOVA, $(N_SAMPLES=48) )
	field( OUTA, "$(PV)_8HR PP" )

}

record( waveform, "$(PV)_8HR" )
{
    field( DESC, "8HR Hist" )
	field( FTVL, "DOUBLE" )
	field( EGU,  "$(EGU=)" )
	field( NELM, $(N_SAMPLES=48) )
	field( TSEL, "$(PV).TIME" )
	info( autosaveFields, "EGU" )
}

# Create an array of time coordinates in the specified units
record( acalcout, "$(PV)_8HR:CALCX" ) 
{
	field( DESC, "x-axis times" )
	field( CALC, "(B>0)?(IX+1-A)*C/(A*B):(IX+1-A)" )
	field( INPA, "$(N_SAMPLES=48)" )
	field( INPB, "3600" )
	field( INPC, "28800" )
	field( NELM, "$(N_SAMPLES=48)" )
	field( PINI, "YES" )
	field( SCAN, "Passive" )
	field( EGU,  "hr" )
	field( PREC, "3" )
	field( OUT,  "$(PV)_8HR:X-AXIS PP" )
}

record( waveform, "$(PV)_8HR:X-AXIS" ) 
{
	field( DESC, "x-axis times" )
	field( SCAN, "Passive" )
	field( DTYP, "Soft Channel" )
	field( FTVL, "FLOAT" )
	field( NELM, "$(N_SAMPLES=48)" )
	field( EGU,  "hr" )
	field( PREC,  "3" )
}

#
# Template for generating aSub records which accumulate
# a history of the specified PV over the specified time period.
#
#	Macros:
#		PV			- Name of PV to track
#		PERIOD		- Time period over which to retain history, in seconds
#						If zero, each sample gets shifted into the buffer
#		PUBLISH		- Publish period for updating output array, in seconds
#						If zero, publish on each update
#		N_SAMPLES	- Number of samples to keep, Output waveform's NELEM
#						Defaults to 300
#		EGU			- EGU for sample data, defaults to ""
#		X_EGU		- Units to display on the time axis
#		S_PER_X_EGU	- Conversion between seconds and X_EGU, e.g. 3600 for hrs
#		NAME		- Name of this time period
#		DESC		- Description of Time Period, default "24HR Hist"
#		OUT			- Name of waveform PV where history is written
#						Defaults to $(PV)_24HR
#

# History asub
# Monitors an scalar value and records it's history
#	over the specified time period.
# The delay between samples is determined by the time
# period divided by the size of the output array.
#	Inputs:
#		A	- a single scalar value of type double
#		P	- double publish interval in seconds (Use 0 for update on change)
#		T	- double history interval in seconds (Use 0 for update on change)
#	Outputs:
#		A	- Array of double's containing samples of A
#				taken over the last T seconds.
#
record( aSub, "$(PV)_24HR_SUB" )
{
	field( DESC, "Keeps History of PV" )
	field( SCAN, ".1 second" )
	field( PINI, "NO" )
	field( INAM, "History_Init" )
	field( SNAM, "History_Process" )
	field( EFLG, "ON CHANGE" )

	field( FTA,  "DOUBLE" )
	field( NOA,  1 )
	field( INPA, "$(PV) CP NMS" )

	field( FTP, "DOUBLE" )
	field( NOP, 1 )
	field( INPP, "0.1" )

	field( FTT, "DOUBLE" )
	field( NOT, 1 )
	field( INPT, "86400" )

	field( FTVA, "DOUBLE" )
	field( NOVA, $(N_SAMPLES=144) )
	field( OUTA, "$(PV)_24HR PP" )

}

record( waveform, "$(PV)_24HR" )
{
    field( DESC, "24HR Hist" )
	field( FTVL, "DOUBLE" )
	field( EGU,  "$(EGU=)" )
	field( NELM, $(N_SAMPLES=144) )
	field( TSEL, "$(PV).TIME" )
	info( autosaveFields, "EGU" )
}

# Create an array of time coordinates in the specified units
record( acalcout, "$(PV)_24HR:CALCX" ) 
{
	field( DESC, "x-axis times" )
	field( CALC, "(B>0)?(IX+1-A)*C/(A*B):(IX+1-A)" )
	field( INPA, "$(N_SAMPLES=144)" )
	field( INPB, "3600" )
	field( INPC, "86400" )
	field( NELM, "$(N_SAMPLES=144)" )
	field( PINI, "YES" )
	field( SCAN, "Passive" )
	field( EGU,  "hr" )
	field( PREC, "3" )
	field( OUT,  "$(PV)_24HR:X-AXIS PP" )
}

record( waveform, "$(PV)_24HR:X-AXIS" ) 
{
	field( DESC, "x-axis times" )
	field( SCAN, "Passive" )
	field( DTYP, "Soft Channel" )
	field( FTVL, "FLOAT" )
	field( NELM, "$(N_SAMPLES=144)" )
	field( EGU,  "hr" )
	field( PREC,  "3" )
}

#
# Template for generating aSub records which accumulate
# a history of the specified PV over the specified time period.
#
#	Macros:
#		PV			- Name of PV to track
#		PERIOD		- Time period over which to retain history, in seconds
#						If zero, each sample gets shifted into the buffer
#		PUBLISH		- Publish period for updating output array, in seconds
#						If zero, publish on each update
#		N_SAMPLES	- Number of samples to keep, Output waveform's NELEM
#						Defaults to 300
#		EGU			- EGU for sample data, defaults to ""
#		X_EGU		- Units to display on the time axis
#		S_PER_X_EGU	- Conversion between seconds and X_EGU, e.g. 3600 for hrs
#		NAME		- Name of this time period
#		DESC		- Description of Time Period, default "3DAY Hist"
#		OUT			- Name of waveform PV where history is written
#						Defaults to $(PV)_3DAY
#

# History asub
# Monitors an scalar value and records it's history
#	over the specified time period.
# The delay between samples is determined by the time
# period divided by the size of the output array.
#	Inputs:
#		A	- a single scalar value of type double
#		P	- double publish interval in seconds (Use 0 for update on change)
#		T	- double history interval in seconds (Use 0 for update on change)
#	Outputs:
#		A	- Array of double's containing samples of A
#				taken over the last T seconds.
#
record( aSub, "$(PV)_3DAY_SUB" )
{
	field( DESC, "Keeps History of PV" )
	field( SCAN, ".1 second" )
	field( PINI, "NO" )
	field( INAM, "History_Init" )
	field( SNAM, "History_Process" )
	field( EFLG, "ON CHANGE" )

	field( FTA,  "DOUBLE" )
	field( NOA,  1 )
	field( INPA, "$(PV) CP NMS" )

	field( FTP, "DOUBLE" )
	field( NOP, 1 )
	field( INPP, "0.1" )

	field( FTT, "DOUBLE" )
	field( NOT, 1 )
	field( INPT, "259200" )

	field( FTVA, "DOUBLE" )
	field( NOVA, $(N_SAMPLES=300) )
	field( OUTA, "$(PV)_3DAY PP" )

}

record( waveform, "$(PV)_3DAY" )
{
    field( DESC, "3DAY Hist" )
	field( FTVL, "DOUBLE" )
	field( EGU,  "$(EGU=)" )
	field( NELM, $(N_SAMPLES=300) )
	field( TSEL, "$(PV).TIME" )
	info( autosaveFields, "EGU" )
}

# Create an array of time coordinates in the specified units
record( acalcout, "$(PV)_3DAY:CALCX" ) 
{
	field( DESC, "x-axis times" )
	field( CALC, "(B>0)?(IX+1-A)*C/(A*B):(IX+1-A)" )
	field( INPA, "$(N_SAMPLES=300)" )
	field( INPB, "3600" )
	field( INPC, "259200" )
	field( NELM, "$(N_SAMPLES=300)" )
	field( PINI, "YES" )
	field( SCAN, "Passive" )
	field( EGU,  "hr" )
	field( PREC, "3" )
	field( OUT,  "$(PV)_3DAY:X-AXIS PP" )
}

record( waveform, "$(PV)_3DAY:X-AXIS" ) 
{
	field( DESC, "x-axis times" )
	field( SCAN, "Passive" )
	field( DTYP, "Soft Channel" )
	field( FTVL, "FLOAT" )
	field( NELM, "$(N_SAMPLES=300)" )
	field( EGU,  "hr" )
	field( PREC,  "3" )
}

#
# Template for generating aSub records which accumulate
# a history of the specified PV over the specified time period.
#
#	Macros:
#		PV			- Name of PV to track
#		PERIOD		- Time period over which to retain history, in seconds
#						If zero, each sample gets shifted into the buffer
#		PUBLISH		- Publish period for updating output array, in seconds
#						If zero, publish on each update
#		N_SAMPLES	- Number of samples to keep, Output waveform's NELEM
#						Defaults to 300
#		EGU			- EGU for sample data, defaults to ""
#		X_EGU		- Units to display on the time axis
#		S_PER_X_EGU	- Conversion between seconds and X_EGU, e.g. 3600 for hrs
#		NAME		- Name of this time period
#		DESC		- Description of Time Period, default "WEEK Hist"
#		OUT			- Name of waveform PV where history is written
#						Defaults to $(PV)_WEEK
#

# History asub
# Monitors an scalar value and records it's history
#	over the specified time period.
# The delay between samples is determined by the time
# period divided by the size of the output array.
#	Inputs:
#		A	- a single scalar value of type double
#		P	- double publish interval in seconds (Use 0 for update on change)
#		T	- double history interval in seconds (Use 0 for update on change)
#	Outputs:
#		A	- Array of double's containing samples of A
#				taken over the last T seconds.
#
record( aSub, "$(PV)_WEEK_SUB" )
{
	field( DESC, "Keeps History of PV" )
	field( SCAN, ".1 second" )
	field( PINI, "NO" )
	field( INAM, "History_Init" )
	field( SNAM, "History_Process" )
	field( EFLG, "ON CHANGE" )

	field( FTA,  "DOUBLE" )
	field( NOA,  1 )
	field( INPA, "$(PV) CP NMS" )

	field( FTP, "DOUBLE" )
	field( NOP, 1 )
	field( INPP, "0.1" )

	field( FTT, "DOUBLE" )
	field( NOT, 1 )
	field( INPT, "604800" )

	field( FTVA, "DOUBLE" )
	field( NOVA, $(N_SAMPLES=300) )
	field( OUTA, "$(PV)_WEEK PP" )

}

record( waveform, "$(PV)_WEEK" )
{
    field( DESC, "WEEK Hist" )
	field( FTVL, "DOUBLE" )
	field( EGU,  "$(EGU=)" )
	field( NELM, $(N_SAMPLES=300) )
	field( TSEL, "$(PV).TIME" )
	info( autosaveFields, "EGU" )
}

# Create an array of time coordinates in the specified units
record( acalcout, "$(PV)_WEEK:CALCX" ) 
{
	field( DESC, "x-axis times" )
	field( CALC, "(B>0)?(IX+1-A)*C/(A*B):(IX+1-A)" )
	field( INPA, "$(N_SAMPLES=300)" )
	field( INPB, "86400" )
	field( INPC, "604800" )
	field( NELM, "$(N_SAMPLES=300)" )
	field( PINI, "YES" )
	field( SCAN, "Passive" )
	field( EGU,  "days" )
	field( PREC, "3" )
	field( OUT,  "$(PV)_WEEK:X-AXIS PP" )
}

record( waveform, "$(PV)_WEEK:X-AXIS" ) 
{
	field( DESC, "x-axis times" )
	field( SCAN, "Passive" )
	field( DTYP, "Soft Channel" )
	field( FTVL, "FLOAT" )
	field( NELM, "$(N_SAMPLES=300)" )
	field( EGU,  "days" )
	field( PREC,  "3" )
}

# EPICS Template for waveform processing
#
# This template is used to process waveform records
# and write the results as new waveforms and scalar PV's
#
# Required Macro Definitions
# WAVE			- Waveform name, for example AMO_KB1_WAV_01
#
# Optional macros
# NELM          - Number of elements per history array (default 300)
# EGU			- Engineering units: fs, C, mm, etc. (default "")
# RMS_LOLO		- Low, low, limit (default "0")
# RMS_LOW		- Low limit (default "0")
# RMS_HIGH		- High limit (default "0")
# RMS_HIHI		- High, high, limit (default "0")

# RMS asub
# Processing this PV computes the RMS value for the input array
# generating FitTime and Charge PV's for each cavity
#
# Inputs
# INPA:	Waveform PV, Type DOUBLE, any length
#
# Outputs
# OUTA:	RMS    - ai PV - RMS over all samples
# OUTB:	MIN    - ai PV - Min of all samples
# OUTC:	MAX    - ai PV - Max of all samples
# OUTD:	AVG    - ai PV - Average sample value
# OUTE: STD    - ai PV - Std deviation 
# OUTF: SLOPE  - ai PV - Slope of linear least squares fit
# OUTG: OFFSET - ai PV - Offset of linear least squares fit
record( aSub, "$(PV)_LAST_N_RMS_SUB" )
{
	field( DESC, "Calculate RMS for array" )
	field( SCAN, "Passive" )
	field( PINI, "NO" )
	field( INAM, "RMS_Init" )
	field( SNAM, "RMS_Process" )

	field( FTA,  "DOUBLE" )
	field( NOA,  "$(N_SAMPLES=300)" )
	field( INPA, "$(PV)_LAST_N CPP NMS" )

	field( FTVA, "DOUBLE" )
	field( NOVA, 1 )
	field( OUTA, "$(PV)_LAST_N_RMS PP" )

	field( FTVB, "DOUBLE" )
	field( NOVB, 1 )
	field( OUTB, "$(PV)_LAST_N_MAX PP" )

	field( FTVC, "DOUBLE" )
	field( NOVC, 1 )
	field( OUTC, "$(PV)_LAST_N_MIN PP" )

	field( FTVD, "DOUBLE" )
	field( NOVD, 1 )
	field( OUTD, "$(PV)_LAST_N_AVG PP" )

	field( FTVE, "DOUBLE" )
	field( NOVE, 1 )
	field( OUTE, "$(PV)_LAST_N_STD PP" )

	field( FTVF, "DOUBLE" )
	field( NOVF, 1 )
	field( OUTF, "$(PV)_LAST_N_SLOPE PP" )

	field( FTVG, "DOUBLE" )
	field( NOVG, 1 )
	field( OUTG, "$(PV)_LAST_N_OFFSET PP" )
}

record( ai, "$(PV)_LAST_N_MAX" )
{
	field( DESC, "MAX for waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_LAST_N_AVG" )
{
	field( DESC, "AVG of waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_LAST_N_MIN" )
{
	field( DESC, "MIN for waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_LAST_N_RMS" )
{
	field( DESC, "RMS for waveform" )
	field( LOLO, "0" )
	field( LOW,  "0"  )
	field( HIGH, "0" )
	field( HIHI, "0" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	field( LLSV,  "MAJOR" )
	field( LSV,   "MINOR" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_LAST_N_STD" )
{
	field( DESC, "StdDev for waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_LAST_N_SLOPE" )
{
	field( DESC, "Best fit linear slope" )
	field( EGU,  "$(EGU=)/s" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_LAST_N_OFFSET" )
{
	field( DESC, "Offset of least squares fit" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

# EPICS Template for waveform processing
#
# This template is used to process waveform records
# and write the results as new waveforms and scalar PV's
#
# Required Macro Definitions
# WAVE			- Waveform name, for example AMO_KB1_WAV_01
#
# Optional macros
# NELM          - Number of elements per history array (default 300)
# EGU			- Engineering units: fs, C, mm, etc. (default "")
# RMS_LOLO		- Low, low, limit (default "0")
# RMS_LOW		- Low limit (default "0")
# RMS_HIGH		- High limit (default "0")
# RMS_HIHI		- High, high, limit (default "0")

# RMS asub
# Processing this PV computes the RMS value for the input array
# generating FitTime and Charge PV's for each cavity
#
# Inputs
# INPA:	Waveform PV, Type DOUBLE, any length
#
# Outputs
# OUTA:	RMS    - ai PV - RMS over all samples
# OUTB:	MIN    - ai PV - Min of all samples
# OUTC:	MAX    - ai PV - Max of all samples
# OUTD:	AVG    - ai PV - Average sample value
# OUTE: STD    - ai PV - Std deviation 
# OUTF: SLOPE  - ai PV - Slope of linear least squares fit
# OUTG: OFFSET - ai PV - Offset of linear least squares fit
record( aSub, "$(PV)_3HR_RMS_SUB" )
{
	field( DESC, "Calculate RMS for array" )
	field( SCAN, "Passive" )
	field( PINI, "NO" )
	field( INAM, "RMS_Init" )
	field( SNAM, "RMS_Process" )

	field( FTA,  "DOUBLE" )
	field( NOA,  "$(N_SAMPLES=18)" )
	field( INPA, "$(PV)_3HR CPP NMS" )

	field( FTVA, "DOUBLE" )
	field( NOVA, 1 )
	field( OUTA, "$(PV)_3HR_RMS PP" )

	field( FTVB, "DOUBLE" )
	field( NOVB, 1 )
	field( OUTB, "$(PV)_3HR_MAX PP" )

	field( FTVC, "DOUBLE" )
	field( NOVC, 1 )
	field( OUTC, "$(PV)_3HR_MIN PP" )

	field( FTVD, "DOUBLE" )
	field( NOVD, 1 )
	field( OUTD, "$(PV)_3HR_AVG PP" )

	field( FTVE, "DOUBLE" )
	field( NOVE, 1 )
	field( OUTE, "$(PV)_3HR_STD PP" )

	field( FTVF, "DOUBLE" )
	field( NOVF, 1 )
	field( OUTF, "$(PV)_3HR_SLOPE PP" )

	field( FTVG, "DOUBLE" )
	field( NOVG, 1 )
	field( OUTG, "$(PV)_3HR_OFFSET PP" )
}

record( ai, "$(PV)_3HR_MAX" )
{
	field( DESC, "MAX for waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_3HR_AVG" )
{
	field( DESC, "AVG of waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_3HR_MIN" )
{
	field( DESC, "MIN for waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_3HR_RMS" )
{
	field( DESC, "RMS for waveform" )
	field( LOLO, "0" )
	field( LOW,  "0"  )
	field( HIGH, "0" )
	field( HIHI, "0" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	field( LLSV,  "MAJOR" )
	field( LSV,   "MINOR" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_3HR_STD" )
{
	field( DESC, "StdDev for waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_3HR_SLOPE" )
{
	field( DESC, "Best fit linear slope" )
	field( EGU,  "$(EGU=)/s" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_3HR_OFFSET" )
{
	field( DESC, "Offset of least squares fit" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

# EPICS Template for waveform processing
#
# This template is used to process waveform records
# and write the results as new waveforms and scalar PV's
#
# Required Macro Definitions
# WAVE			- Waveform name, for example AMO_KB1_WAV_01
#
# Optional macros
# NELM          - Number of elements per history array (default 300)
# EGU			- Engineering units: fs, C, mm, etc. (default "")
# RMS_LOLO		- Low, low, limit (default "0")
# RMS_LOW		- Low limit (default "0")
# RMS_HIGH		- High limit (default "0")
# RMS_HIHI		- High, high, limit (default "0")

# RMS asub
# Processing this PV computes the RMS value for the input array
# generating FitTime and Charge PV's for each cavity
#
# Inputs
# INPA:	Waveform PV, Type DOUBLE, any length
#
# Outputs
# OUTA:	RMS    - ai PV - RMS over all samples
# OUTB:	MIN    - ai PV - Min of all samples
# OUTC:	MAX    - ai PV - Max of all samples
# OUTD:	AVG    - ai PV - Average sample value
# OUTE: STD    - ai PV - Std deviation 
# OUTF: SLOPE  - ai PV - Slope of linear least squares fit
# OUTG: OFFSET - ai PV - Offset of linear least squares fit
record( aSub, "$(PV)_8HR_RMS_SUB" )
{
	field( DESC, "Calculate RMS for array" )
	field( SCAN, "Passive" )
	field( PINI, "NO" )
	field( INAM, "RMS_Init" )
	field( SNAM, "RMS_Process" )

	field( FTA,  "DOUBLE" )
	field( NOA,  "$(N_SAMPLES=48)" )
	field( INPA, "$(PV)_8HR CPP NMS" )

	field( FTVA, "DOUBLE" )
	field( NOVA, 1 )
	field( OUTA, "$(PV)_8HR_RMS PP" )

	field( FTVB, "DOUBLE" )
	field( NOVB, 1 )
	field( OUTB, "$(PV)_8HR_MAX PP" )

	field( FTVC, "DOUBLE" )
	field( NOVC, 1 )
	field( OUTC, "$(PV)_8HR_MIN PP" )

	field( FTVD, "DOUBLE" )
	field( NOVD, 1 )
	field( OUTD, "$(PV)_8HR_AVG PP" )

	field( FTVE, "DOUBLE" )
	field( NOVE, 1 )
	field( OUTE, "$(PV)_8HR_STD PP" )

	field( FTVF, "DOUBLE" )
	field( NOVF, 1 )
	field( OUTF, "$(PV)_8HR_SLOPE PP" )

	field( FTVG, "DOUBLE" )
	field( NOVG, 1 )
	field( OUTG, "$(PV)_8HR_OFFSET PP" )
}

record( ai, "$(PV)_8HR_MAX" )
{
	field( DESC, "MAX for waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_8HR_AVG" )
{
	field( DESC, "AVG of waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_8HR_MIN" )
{
	field( DESC, "MIN for waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_8HR_RMS" )
{
	field( DESC, "RMS for waveform" )
	field( LOLO, "0" )
	field( LOW,  "0"  )
	field( HIGH, "0" )
	field( HIHI, "0" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	field( LLSV,  "MAJOR" )
	field( LSV,   "MINOR" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_8HR_STD" )
{
	field( DESC, "StdDev for waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_8HR_SLOPE" )
{
	field( DESC, "Best fit linear slope" )
	field( EGU,  "$(EGU=)/s" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_8HR_OFFSET" )
{
	field( DESC, "Offset of least squares fit" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

# EPICS Template for waveform processing
#
# This template is used to process waveform records
# and write the results as new waveforms and scalar PV's
#
# Required Macro Definitions
# WAVE			- Waveform name, for example AMO_KB1_WAV_01
#
# Optional macros
# NELM          - Number of elements per history array (default 300)
# EGU			- Engineering units: fs, C, mm, etc. (default "")
# RMS_LOLO		- Low, low, limit (default "0")
# RMS_LOW		- Low limit (default "0")
# RMS_HIGH		- High limit (default "0")
# RMS_HIHI		- High, high, limit (default "0")

# RMS asub
# Processing this PV computes the RMS value for the input array
# generating FitTime and Charge PV's for each cavity
#
# Inputs
# INPA:	Waveform PV, Type DOUBLE, any length
#
# Outputs
# OUTA:	RMS    - ai PV - RMS over all samples
# OUTB:	MIN    - ai PV - Min of all samples
# OUTC:	MAX    - ai PV - Max of all samples
# OUTD:	AVG    - ai PV - Average sample value
# OUTE: STD    - ai PV - Std deviation 
# OUTF: SLOPE  - ai PV - Slope of linear least squares fit
# OUTG: OFFSET - ai PV - Offset of linear least squares fit
record( aSub, "$(PV)_24HR_RMS_SUB" )
{
	field( DESC, "Calculate RMS for array" )
	field( SCAN, "Passive" )
	field( PINI, "NO" )
	field( INAM, "RMS_Init" )
	field( SNAM, "RMS_Process" )

	field( FTA,  "DOUBLE" )
	field( NOA,  "$(N_SAMPLES=144)" )
	field( INPA, "$(PV)_24HR CPP NMS" )

	field( FTVA, "DOUBLE" )
	field( NOVA, 1 )
	field( OUTA, "$(PV)_24HR_RMS PP" )

	field( FTVB, "DOUBLE" )
	field( NOVB, 1 )
	field( OUTB, "$(PV)_24HR_MAX PP" )

	field( FTVC, "DOUBLE" )
	field( NOVC, 1 )
	field( OUTC, "$(PV)_24HR_MIN PP" )

	field( FTVD, "DOUBLE" )
	field( NOVD, 1 )
	field( OUTD, "$(PV)_24HR_AVG PP" )

	field( FTVE, "DOUBLE" )
	field( NOVE, 1 )
	field( OUTE, "$(PV)_24HR_STD PP" )

	field( FTVF, "DOUBLE" )
	field( NOVF, 1 )
	field( OUTF, "$(PV)_24HR_SLOPE PP" )

	field( FTVG, "DOUBLE" )
	field( NOVG, 1 )
	field( OUTG, "$(PV)_24HR_OFFSET PP" )
}

record( ai, "$(PV)_24HR_MAX" )
{
	field( DESC, "MAX for waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_24HR_AVG" )
{
	field( DESC, "AVG of waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_24HR_MIN" )
{
	field( DESC, "MIN for waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_24HR_RMS" )
{
	field( DESC, "RMS for waveform" )
	field( LOLO, "0" )
	field( LOW,  "0"  )
	field( HIGH, "0" )
	field( HIHI, "0" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	field( LLSV,  "MAJOR" )
	field( LSV,   "MINOR" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_24HR_STD" )
{
	field( DESC, "StdDev for waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_24HR_SLOPE" )
{
	field( DESC, "Best fit linear slope" )
	field( EGU,  "$(EGU=)/s" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_24HR_OFFSET" )
{
	field( DESC, "Offset of least squares fit" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

# EPICS Template for waveform processing
#
# This template is used to process waveform records
# and write the results as new waveforms and scalar PV's
#
# Required Macro Definitions
# WAVE			- Waveform name, for example AMO_KB1_WAV_01
#
# Optional macros
# NELM          - Number of elements per history array (default 300)
# EGU			- Engineering units: fs, C, mm, etc. (default "")
# RMS_LOLO		- Low, low, limit (default "0")
# RMS_LOW		- Low limit (default "0")
# RMS_HIGH		- High limit (default "0")
# RMS_HIHI		- High, high, limit (default "0")

# RMS asub
# Processing this PV computes the RMS value for the input array
# generating FitTime and Charge PV's for each cavity
#
# Inputs
# INPA:	Waveform PV, Type DOUBLE, any length
#
# Outputs
# OUTA:	RMS    - ai PV - RMS over all samples
# OUTB:	MIN    - ai PV - Min of all samples
# OUTC:	MAX    - ai PV - Max of all samples
# OUTD:	AVG    - ai PV - Average sample value
# OUTE: STD    - ai PV - Std deviation 
# OUTF: SLOPE  - ai PV - Slope of linear least squares fit
# OUTG: OFFSET - ai PV - Offset of linear least squares fit
record( aSub, "$(PV)_3DAY_RMS_SUB" )
{
	field( DESC, "Calculate RMS for array" )
	field( SCAN, "Passive" )
	field( PINI, "NO" )
	field( INAM, "RMS_Init" )
	field( SNAM, "RMS_Process" )

	field( FTA,  "DOUBLE" )
	field( NOA,  "$(N_SAMPLES=300)" )
	field( INPA, "$(PV)_3DAY CPP NMS" )

	field( FTVA, "DOUBLE" )
	field( NOVA, 1 )
	field( OUTA, "$(PV)_3DAY_RMS PP" )

	field( FTVB, "DOUBLE" )
	field( NOVB, 1 )
	field( OUTB, "$(PV)_3DAY_MAX PP" )

	field( FTVC, "DOUBLE" )
	field( NOVC, 1 )
	field( OUTC, "$(PV)_3DAY_MIN PP" )

	field( FTVD, "DOUBLE" )
	field( NOVD, 1 )
	field( OUTD, "$(PV)_3DAY_AVG PP" )

	field( FTVE, "DOUBLE" )
	field( NOVE, 1 )
	field( OUTE, "$(PV)_3DAY_STD PP" )

	field( FTVF, "DOUBLE" )
	field( NOVF, 1 )
	field( OUTF, "$(PV)_3DAY_SLOPE PP" )

	field( FTVG, "DOUBLE" )
	field( NOVG, 1 )
	field( OUTG, "$(PV)_3DAY_OFFSET PP" )
}

record( ai, "$(PV)_3DAY_MAX" )
{
	field( DESC, "MAX for waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_3DAY_AVG" )
{
	field( DESC, "AVG of waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_3DAY_MIN" )
{
	field( DESC, "MIN for waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_3DAY_RMS" )
{
	field( DESC, "RMS for waveform" )
	field( LOLO, "0" )
	field( LOW,  "0"  )
	field( HIGH, "0" )
	field( HIHI, "0" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	field( LLSV,  "MAJOR" )
	field( LSV,   "MINOR" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_3DAY_STD" )
{
	field( DESC, "StdDev for waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_3DAY_SLOPE" )
{
	field( DESC, "Best fit linear slope" )
	field( EGU,  "$(EGU=)/s" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_3DAY_OFFSET" )
{
	field( DESC, "Offset of least squares fit" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

# EPICS Template for waveform processing
#
# This template is used to process waveform records
# and write the results as new waveforms and scalar PV's
#
# Required Macro Definitions
# WAVE			- Waveform name, for example AMO_KB1_WAV_01
#
# Optional macros
# NELM          - Number of elements per history array (default 300)
# EGU			- Engineering units: fs, C, mm, etc. (default "")
# RMS_LOLO		- Low, low, limit (default "0")
# RMS_LOW		- Low limit (default "0")
# RMS_HIGH		- High limit (default "0")
# RMS_HIHI		- High, high, limit (default "0")

# RMS asub
# Processing this PV computes the RMS value for the input array
# generating FitTime and Charge PV's for each cavity
#
# Inputs
# INPA:	Waveform PV, Type DOUBLE, any length
#
# Outputs
# OUTA:	RMS    - ai PV - RMS over all samples
# OUTB:	MIN    - ai PV - Min of all samples
# OUTC:	MAX    - ai PV - Max of all samples
# OUTD:	AVG    - ai PV - Average sample value
# OUTE: STD    - ai PV - Std deviation 
# OUTF: SLOPE  - ai PV - Slope of linear least squares fit
# OUTG: OFFSET - ai PV - Offset of linear least squares fit
record( aSub, "$(PV)_WEEK_RMS_SUB" )
{
	field( DESC, "Calculate RMS for array" )
	field( SCAN, "Passive" )
	field( PINI, "NO" )
	field( INAM, "RMS_Init" )
	field( SNAM, "RMS_Process" )

	field( FTA,  "DOUBLE" )
	field( NOA,  "$(N_SAMPLES=300)" )
	field( INPA, "$(PV)_WEEK CPP NMS" )

	field( FTVA, "DOUBLE" )
	field( NOVA, 1 )
	field( OUTA, "$(PV)_WEEK_RMS PP" )

	field( FTVB, "DOUBLE" )
	field( NOVB, 1 )
	field( OUTB, "$(PV)_WEEK_MAX PP" )

	field( FTVC, "DOUBLE" )
	field( NOVC, 1 )
	field( OUTC, "$(PV)_WEEK_MIN PP" )

	field( FTVD, "DOUBLE" )
	field( NOVD, 1 )
	field( OUTD, "$(PV)_WEEK_AVG PP" )

	field( FTVE, "DOUBLE" )
	field( NOVE, 1 )
	field( OUTE, "$(PV)_WEEK_STD PP" )

	field( FTVF, "DOUBLE" )
	field( NOVF, 1 )
	field( OUTF, "$(PV)_WEEK_SLOPE PP" )

	field( FTVG, "DOUBLE" )
	field( NOVG, 1 )
	field( OUTG, "$(PV)_WEEK_OFFSET PP" )
}

record( ai, "$(PV)_WEEK_MAX" )
{
	field( DESC, "MAX for waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_WEEK_AVG" )
{
	field( DESC, "AVG of waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_WEEK_MIN" )
{
	field( DESC, "MIN for waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_WEEK_RMS" )
{
	field( DESC, "RMS for waveform" )
	field( LOLO, "0" )
	field( LOW,  "0"  )
	field( HIGH, "0" )
	field( HIHI, "0" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	field( LLSV,  "MAJOR" )
	field( LSV,   "MINOR" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_WEEK_STD" )
{
	field( DESC, "StdDev for waveform" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_WEEK_SLOPE" )
{
	field( DESC, "Best fit linear slope" )
	field( EGU,  "$(EGU=)/s" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

record( ai, "$(PV)_WEEK_OFFSET" )
{
	field( DESC, "Offset of least squares fit" )
	field( EGU,  "$(EGU=)" )
	field( PREC, "4" )
	info(autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC")
}

# In some screens, you want to say "display statistic X" without being too
# particular about the data set. Use these aliases to hide that part of the PV

alias( "$(PV)_LAST_N_AVG",    "$(PV)_AVG" )
alias( "$(PV)_LAST_N_MAX",    "$(PV)_MAX" )
alias( "$(PV)_LAST_N_MIN",    "$(PV)_MIN" )
alias( "$(PV)_LAST_N_RMS",    "$(PV)_RMS" )
alias( "$(PV)_LAST_N_STD",    "$(PV)_STD" )
alias( "$(PV)_LAST_N_SLOPE",  "$(PV)_SLOPE" )
alias( "$(PV)_LAST_N_OFFSET", "$(PV)_OFFSET" )
