# pyfplo.common

- OptionSet
- Version
- Vlevel
- Constants

This module contains a collection of usefull objects related to FPLO band/bandweights routines. You can easily write these files and read them into `numpy.ndarray`s for further processing. Have a look at `..../FPLO18.00-53/DOC/pyfplo/Examples/bandplot/model.py` for better understanding.

## OptionSet

class `OptionSet`

  A collection of options for debugging output. This class cannot be instantiated directly. It only is returned from objects, which have an `OptionSet` member variable (see example) Example usage:

      s=sla.Slabify()
      op=s.options # a possible way to get an OptionSet object

      print op # print the option list including their values
      print op.names # print the available option names

      for n in op.names:  # python loop for option print
          print n,op[n]

      for n in op.names:  # python loop to set all options
          if n.startswith('prep'):
              op[n]=True

      # or let's suppose there is an option called prep_pairs

      op['prep_pairs']=True

## Version

class `Version`

  This class manages the version numbers of pyfplo. The easiest use is:

      import pyfplo.common as com
      ...
      print 'pyfplo version ',com.version
      # one can protect scripts in the following way:
      if com.version!='18.00': raise RuntimeError('pyfplo version is incorrect.')

  version is also bound as a module variable in `pyfplo`, `pyfplo.slabify` and `pyfplo.fploio` such that the example above could read:

      import pyfplo.slabify as sla
      ...
      print 'pyfplo version '+str(sla.version)
      # one can protect scripts in the following way:
      if sla.version!='18.00': raise RuntimeError('pyfplo version is incorrect.')

  `release`()

    Returns: | release number
    Return type: | str

  `mainVersion`()

    Returns: | main version number
    Return type: | str

  `__eq__`()

    Compare the main version (for code sanity purposes). Example:

        if com.version!='18.00': raise RuntimeError('pyfplo version is incorrect.')

  `__ne__`()

    Compare the main version (for code sanity purposes). Example:

        if com.version!='18.00': raise RuntimeError('pyfplo version is incorrect.')

  `__str__`()

    return printable representation. You do not need to call this explicitly. An object obj with this function provides usefull info when printed:

        print obj

## Vlevel

class `Vlevel`

  This class merely defines the verbosity level constants (Silent, Info,..., All). You can use any int where ever a vlevel is needed as an argument. For an arbitrary int N as argument the actual vlevel is set to the largest constant (defined below), which is <= N or to 0 (Silent) if int<0; One can use the constants:

      print com.Vlevel.All

  `Silent` = 0
  `Info` = 100
  `More` = 200
  `Many` = 300
  `All` = 1000

## Constants

A collection of physical constants.

`c_abtoang`

  Bohr radii / Angstroem

`c_hatoev`

  Hartree/eV

`c_speed_of_light_mpers`

  speed of light in m/s

`c_hbar_Js`

  Planck constant/2pi in Js

`c_me_kg`

  electron mass in Kg

`c_angstroem_m`

  angstroem in m

`c_echarge_C`

  electron charge in C

Predefined:

`version`

  instance of `Version`