## Derived types

The TELCAL derived types are defined in the telcal-types.f90 files:

    !
    ! FIT derived type definitions
    !
    module fit_definitions
      !
      type :: simple_1d ! Data vector (simple precision, 1d)
         sequence
         integer :: n              ! Number of data
         real(8), pointer :: x(:)     ! Abcissae (in)
         real(8), pointer :: y(:)     ! Values   (in)
         real(8), pointer :: w(:)     ! Weights  (in)
         real(8), pointer :: d(:)     ! derivative of x with time, Not always allocated
      end type simple_1d
      !
      type :: fit_par ! Description of a fitted parameter
         sequence
         character(len=16) :: name ! Parameter name          (in)
         real(8) :: guess          ! Guess                   (in)
         real(8) :: value          ! Fit value               (out)
         real(8) :: error          ! Fit uncertainty         (out)
         real(8) :: mini           ! Minimum possible value  (in)
         real(8) :: maxi           ! Maximum possible value  (in)
         logical :: fixed          ! Is the parameter fixed? (in)
         logical :: padding        ! Padding for structure alignment
      end type fit_par
      !
      type :: fit_fun ! Description of a fitted function
         sequence
         character(len=16) :: name         ! Fitted function name (eg GAUSSIAN)
         character(len=16) :: method       ! Fitting library (eg SLATEC)
         real    :: rms                    ! Residual RMS
         integer :: flag                   ! Error/Quality code
         integer :: ncall                  ! Number of iterations
         integer :: npar                   ! Number of fitted parameters
         type (fit_par), pointer :: par(:) ! Array of parameter descriptions
      end type fit_fun
      !
      type :: fit_var ! Variable fitted parameters only
         sequence
         integer :: n               ! Number
         real(8), pointer :: x(:)   ! Values
         real(8), pointer :: d(:)   ! Errors
         integer, pointer :: idx(:) ! Position index inside full parameter vector
      end type fit_var
      !
    end module fit_definitions
    !
    ! POINTING derived type definitions
    !
    module point_definitions
      use fit_definitions
      !
      type :: point_cross
         sequence
         integer :: sys             ! Scanning coordinate system
         character(16)    :: dir(4) ! Scanning directions
         type (simple_1d) :: dat(4) ! Data vectors
         type (simple_1d) :: sol(4) ! Solution vectors
         type (fit_fun)   :: fun(4) ! Fit functions
      end type
      !
      type (point_cross), save :: pcross
      !
    end module point_definitions
    !