SYNTAX: [flux_err,nerrors] = ...
bld_flux_err(algorithm,isonms,iso_refs,ref_num,Xpt_cntl,units,bias)
PURPOSE: Build the flux_err matrix needed to convert from absolute flux
at the segment control points to relative flux (abs. flux - flux at
the X point)
INPUT:
algorithm = one of 'isodnull', 'isosnull', or 'isousnull'
isonms = names of isoflux segments
iso_refs = isoflux reference signals
ref_num = index of reference signal used by each segment in isonms
Xpt_cntl = define type of control to use on Xpt(s), in pairs of [R,Z], e.g.
['S','X'] indicates R should be controlled by strike point, while
Z should be controlled at the X point. For LSN or USN, use one pair
while for DND, use two consecutive pairs, i.e. [R1,Z1,R2,Z2].
(optional, default = ['X','X'] for LSN, USN, ['X','X','X','X'] for DND)
units = either 'Wb' or 'Wb/rad' (as in PCS), defining units for flux errors
(optional, default = 'Wb')
bias = used only if algorithm = 'isodnull'; one of:
1 = upper-bias shape (DRSEP>0)
0 = balanced shape (DRSEP=0)
-1 = lower-bias shape (DRSEP<0)
OUTPUT:
flux_err = matrix to compute errors from flux values on isoflux segments.
Columns are:
isodnull: seg.flux,psi_grid1,BrBz_grid1,psi_grid2,BrBz_grid2,Fcoils
others: seg.flux, psi_grid1, BrBz_grid1, Fcoils
Rows are:
isodnull: seg.flux_errs,BrBz_grid1,BrBz_grid2,symmetry_err,Fcoils
others: seg.flux_errs, BrBz_grid1, Fcoils
nerrors = number of rows corresponding to isoflux errors
RESTRICTIONS:
NOTE that this code assumes errors are in units of Wb, while in the
PCS, they actually come in as Wb/rad. (Units conversion must be done.)