BayesicFitting

Model Fitting and Evidence Calculation

View project on GitHub



Module Formatter Source

  module contains methods to format numbers, especially in arrays.

formatter_init( indent=None, linelength=None, max=-1 )

Initialize the formatter with new default values.

Parameters

  • format : dict {namestring : formatstring }
         name : "float64" or "int64"
         fmt : " %fmt"
  • indent : None or int
         number of spaces to indent after the first line
         Default is 0
  • linelength : None or int
         length of the lines produced
         Default is 120
  • max : None or int
         maximum number of items displayed followed by ... if there are more
         None displays all
         Default is 5

fma( **kwargs )
Syntactic sugar for
     formatter( ..., max=None, ... )

formatter( format=None, indent=None, linelength=None, max=-1, tail=0 )
Format a number or an array nicely into a string

Parameters override defaults given earlier with init().

Parameters

  • array : array_like or number
         number or list of numbers or n-dim array of numbers
  • format : None or string
         format applying to one item of array
         Default is "8.3f" for float and "8d" for int
  • indent : None or int
         number of spaces to indent after the first line
         Default is 0
  • linelength : None or int
         length of the lines produced
         Default is 120
  • max : None or int
         maximum number of items displayed followed by ... if there are more
         None displays all
         Default is 5
  • tail : int
         print the last items in the array, preceeded by ...
         Only if the number of items is larger than max.
         Default is 0

Returns

  • string : containing the formatted array

recursive_format( array, format=None, indent=0, tail=0 )

spaces( )
Return ksp spaces.