Summary This library of routines is based on fitfun; by partitioning the input, and allowing fow several sets of parameters, several sets of data can be read in and treated. Parameters can be set up as shared vaules or linked later fo simultaneous variation by the fitting routine. The principal routine is ftfuns which sets up and calls the other functions. To allow for easy extension almost all useful variables are held in COMMON in ftfuns which thus helps a pogrammer identify the variable and its use.
February 2008 - fourth column read in and treatmentPARAMETER (MAXDAT=21000) c***** maximum no of input data PARAMETER (MAXPAR=800) c***** maximum number of parameters for all sets PARAMETER (MAXPAN=40) c***** number of named parameters PARAMETER (MAXSET=20) c***** number of input data sets PARAMETER (MAXXTP=200*MAXSET) c***** number of extra points out of range to be plotted EXTERNAL READIN, CALSUB data read-in and calculation routines COMMON blocks likely to be used in READIN and CALSUB common/guiuse/ignum,insta,iosta,irsta Controls communications with clickfit common/comin/bufin character*150 with data from clickfit ftfuns,ftprld.fttcmd,ftvall common/reply/resout ftfuns,ftfffff,ftglnk,ftprld,ftdatn reply to clickfit - error message starts with ERR: COMMON/TITLES/INAMES(MAXPAN),NX,NY ftfuns,forfit,ftlist,ftprld,ftvall,ftvals contains the name of each parameter COMMON/REDINC/DFIND ftfuns,mread character*80 string for input routine to find data COMMON/SETSIN/INDSET(MAXDAT),INSET,LIMSET ftfuns,ftdatn,ftglnk,ftlimt,ftlist,ftplfl,ftplnm,ftplst,ftpval, ftvall,ftvals,ftxset contains start and end indexes of each set of data used for comparing with calculated values COMMON/REDIT4/OBS4IN(MAXDAT) ftdatn,mread Fourth data column stored here by READIN COMMON/SETSET/INPSET(MAXPAN) ftfuns,forfit,ftglnk,ftpval defines parameters shared amongst sets Internal fitfun COMMON blocks COMMON/LIMITF/ VERZHN,MAXIND,MAXPNM ftfuns COMMON/INFILE/SNAMES(MAXSET) ftfuns,ftlimt,ftplfl,ftplnm,ftplst,ftxset COMMON/TITLSS/SETNMS(MAXPAN) ftfuns,ftglnk,ftlist,ftprld,ftvall,ftvals COMMON/TITLEP/NPARAS ftfuns,forfit,ftgetp,ftglnk,ftlist,ftumap COMMON/FUNCTS/NAMSS ftfuns COMMON/MAPPING/IPMAP(MAXPAR),NSSIMP,NSSETS ftfuns,forfit,ftcalf,ftffff,ftgetp,ftglnk,ftlimt,ftpval,ftumap,ftvals COMMON/WORK/W ftfuns,ftlist workspace for fits, contains deviations after fits COMMON/CNSTRN/IINDEX(MAXPAR) ftfuns,ftcalf,ftffff,ftlist maps parameters to fitted variables COMMON/ACTSET/NUMSET ftfuns,ftglnk,ftprld,ftvall,ftvals COMMON/SETUSE/INDUSE(MAXDAT) associates raw input data and set number ftfuns COMMON/SETVIN/VRIN(20) ftfuns,ftttcmd,ftvall,ftvals COMMON/SETLIM/ISETS(MAXSET),ISETE(MAXSET) ftfuns,ftcalf,ftffff,ftlimt fit index limits for each set (start,end) COMMON/SETRIN/ISETRS(MAXSET),ISETRE(MAXSET) ftfuns,ftlimt,ftxset raw data index limits for each set COMMON/SETXIN/ISETXS(MAXSET),ISETXE(MAXSET) ftfuns,ftlimt,ftxset extra plot index limits COMMON/SETFIN/ISETFS(MAXSET),ISETFE(MAXSET) ftfuns,ftlimt output file limits COMMON/EXTPLT/XPL(MAXXTP),YPL(MAXXTP),WERR(MAXXTP), 1WRK(MAXXTP),WRK1(MAXXTP),INDPX(MAXXTP), 1INDTMP(MAXDAT),NEXTRA ftfuns,ftlimt,ftlist,ftxset COMMON/EXPLT4/XDVL(MAXXTP) ftfuns COMMON/RRDIT4/OBS4(MAXDAT) ftfuns,ftdatn,ftlimt,ftxset c***** for compatibility with ffn column-4 values are read in to /REDIT4/ c***** /RREDT4/ contains local concatenated values for subsequent multiple c***** treatment COMMON/OBSDA4/USE4(MAXDAT) ftfuns,ftlimt,ftlist contains fourth column input for calculation COMMON/FLAGS/ DATSET,PARSET,NEWDAT,PLTSET ftfuns,ftcalf,ftdatn,fteras,ftffff,ftlimt,ftlist,ftvall,ftvals,ftxset logical flags for status of read-in etc. COMMON/FLAGS4/INCOL4 ftfuns.ftlimt,ftxset set in READIN if fourth column is available COMMON/TIN/INTTY,IOTTY,NMO,IERT,VARIN(10) ftfuns,ftcalf,ftextp,ftffff,ftgech,ftglnk,ftlimt,ftlist, ftplfl,ftttcmd,ftvall,ftvals,ftxset,ftyset terminal input and free format results COMMON/TINC/PNAMM,RET(80) ftfuns,ftcalf,ftextp,ftffff,ftgech,ftglnk,ftlimt,ftlist, ftplfl,ftttcmd,ftvall,ftvals,ftxset,ftyset program name and stripped input buffer from terminal COMMON/FUNCTN/NPAR,PARM,STEP,SCALE,NUPAR ftfuns,forfit,ftcalf,ftlist internal parameters in fitting COMMON/FUNCTC/NAMES ftfuns,forfit,ftcalf,ftlist,ftprld,ftsave derived parameter names COMMON/REDITC/ XOBS,YOBS,YROBS,YER,NDIN ftfuns,ftxset contains the raw data read from the user routine READIN COMMON/OBSDAT/ NPNT,XUSE,YUSE,YUSR ftfuns,ftlist contains the data to be fitted in the user routine CALSUB COMMON/CALDAT/YCALC,F,IITER ftfuns,ftcalf,ftlist results from fitting COMMON/FITCON/H,DMAX,ACC,FUNMAX,VPRINT ftfuns,forfit,ftffff,ftlist,ftprld,ftsave,ftvall,ftvals fitting control parameters COMMON/FITLIM/XLIMS(6),NSET,MINF,MAXF,NFIT ftfuns,forfit,ftcalf,ftffff,ftlimt,ftlist,ftprld,ftsave,ftvall,ftvals,ftxset exclusion zones for fits COMMON/SPLTC/VARS(32) ftfuns,ftcalf,ftlist,rsplt,tdlmr graphical control COMMON/PLTLIM/XMIN,XMAX,YMIN,YMAX,XSCALE(2),YSCALE(2) ftfuns,ftdatn,ftlist,ftplfl,ftprld,ftsave,ftvall,ftvals,ftxset,ftyset plotting scale limits COMMON/PLTLIC/NTX,NTY,NTEX ftfuns,ftdatn,ftlimt,ftlist,ftplfl,ftvall,ftvals plot titles COMMON/PLTFLE/PLFILE ftfuns,ftplfl plot file name COMMON/PLTFILD/XFL(200),YFL(200) ftfuns plot file calculated values COMMON/ERRORC/SDEV(MAXPAR),SDEW(MAXPAR) 1,COVAR(MAXPAR*MAXPAR),COVAW(MAXPAR*MAXPAR),IPAR ftfuns,ftffff,ftlist,ftprld,ftvall,ftvals deviations after fitting COMMON/TEKENV/TEKTRO ftfuns,fteras,fthelp,ftlist,ftvall,ftvals controls scrolling COMMON/TITLEX/EXTRAT ftfuns,ftlist COMMON/TITLEI/IEXTRT ftfuns, additional title on graph COMMON/CHICHI/RF,RFOLD,CHI,CHIOLD,PROB,NFREE,NFITNO ftfuns,ftchsq,ftdatn,ftlist statistical test COMMON/FCLOSE/ICLOSE,ISTART ftfuns control re-entry without re-reading parameters etc. COMMON/STOPCY/IXV ftfuns variable is non-zero after control-c is given COMMON/FILIN/INDEX1,INDEX2,IFLAG1,IFLAG2 ftfuns COMMON/FILINC/FTXT ftfuns COMMON/QUIET/KQUIET ftfuns,ftffff COMMON/COMNAM/COMCMD,COMREP,COMINF ftfuns LOGICAL CHAR,TEKTRO,RETRUN LOGICAL DATSET,PARSET,NEWDAT,PLTSET,INCOL4 CHARACTER*1 COMM(21),ANS CHARACTER PNAMM*4,RET*1 CHARACTER*4 PNAME,PNAM,PARFR,UNSET,VERSHN,VPRINT CHARACTER PLFILE*10,LOGFIL*10,STR*30,PLFILX*10 CHARACTER PARFL*4 CHARACTER PARFLL*20 CHARACTER FTXT*120 COMMON/VERSION/VERP,VERS CHARACTER*8 INAMES,NAMES(MAXPAR) CHARACTER*1 SETNMS CHARACTER*20 NX,NY,NTX,NTY CHARACTER*20 SNAMES CHARACTER*50 NTEX,EXTRAT CHARACTER*8 FITNO CHARACTER*80 DFIND CHARACTER*11 COMCMD,COMREP,COMINF CHARACTER*80 RESOUT CHARACTER*20 TM C DIMENSION FITPAR(MAXPAR),DD(2) DIMENSION F(MAXDAT),W(200000) DIMENSION XOBS(MAXDAT),YOBS(MAXDAT),YROBS(MAXDAT),YCALC(MAXDAT) 1,XUSE(MAXDAT),YUSE(MAXDAT),YER(MAXDAT),YUSR(MAXDAT) DIMENSION PARM(MAXPAR),STEP(MAXPAR),SCALE(MAXPAR),OLD(MAXPAR) DIMENSION FITDIF(MAXDAT) DIMENSION ISSTMP(MAXSET),ISETMP(MAXSET) DIMENSION UUSE4(MAXDAT) Principal Routines forfit.for allows initial paramters to be setup if no ffm file is found ftcalf.for calls the calculation routine CALSUB ftchsq.for evaluates CHI-squared if errors are provided in data ftdatn.for calls the readin routine MYREAD fteras.for clears graphics and text ftextp.for external routine (dummy in library) ftfdcd.for free-format input routine ftffff.for sets up fitting ftfuns.for MAIN STEERING ROUTINE ftgech.for reads in terminal input ftgetp.for gets parameters for a specified data set fthelp.for help information ftlimt.for places data in arrays for fitting and plotting in limits ftlist.for outputs listing ftmb11.for matrix inversion for fitting ftplfl.for outputs data in file for subsequent plotting ftplnm.for plots sets of data ftplst.for plots sets of data ftprob.for calculates probability of fit at minimum ftpval.for mapping of parametrs to inputs sets ftsave.for saves current parameters ftserr.for extracts errors from workspace after fit fttcmd.for decodes command line ftumap.for remaps local copy of parameters, steps etc ftva05.for non-linear fitting routine ftvall.for displays current parameters, steps etc ftvals.for displays current paramteres, steps etc ftxhlp.for additional help information (dummy in library) ftyset.for shows or sets y scale limits ftxset.for shows or sets x scale limits ftprld.for sets up dialogue with external control program (clickfit) ftglnk.for sets up links between parameters ftsort.for sorts input data into increasing x-values utilities iniwin.for once used to control switching graphical/text modes lpendf.for closes printer output file lpout.for open printer output file poscur.for draws cursor on display pubess.for logo routine rsplt.for plotiing program userlog.for log generator erase.for clears graphics flusht.for empties terminal buffer tdlmr.for sets scale limits trimmd.for strips trailing blanks in string mtst.for test program mread.for test readin routine mgauss.for test calculation routine
If a fourth data common is read into the array in /REDIT4/ and the /FLAGS4/ variable INCOL4 is set to .TRUE. the program suite will propagate this through to the calculation routine which will find appropriate selected values in /OBSDA4/USE4 This maintains compatibility with previous three column data read-in.
February 2008 - data are re-sequenced in order of increasing x
This is performed by the heap-sort in ftsort.
March 2013 - data array increased to 21000
(Interrupts introduced into fitting; forfit improved)