pyfplo.common

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.ndarrays for further processing. Have a look at ..../FPLO18.00-53/DOC/pyfplo/Examples/bandplot/model.py for better understanding.

OptionSet

class OptionSet(*args, **kwargs)

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
__getitem__(self, n)

Return the value of the option n (string):

op=s.options # just an example
print op['some_option_name']
__setitem__(self, n, value)

Set the value of the option n (string):

op=s.options # just an example
op['some_option_name']=True
names

Return a list of available options:

s=sla.Slabify()
op=s.options # just an example
print op.names
__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

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.')

Return a default Version object, which contains the version information of the package.

__eq__(mainversion)

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

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

Compare the main version (for code sanity purposes).

mainVersion()

Return the main version number as string.

release()

Return the release number as string.

__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(*args, **kwargs)

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

float(x) -> floating point number

Convert a string or number to a floating point number, if possible.

c_hatoev

float(x) -> floating point number

Convert a string or number to a floating point number, if possible.

c_speed_of_light_mpers

float(x) -> floating point number

Convert a string or number to a floating point number, if possible.

c_hbar_Js

float(x) -> floating point number

Convert a string or number to a floating point number, if possible.

c_me_kg

float(x) -> floating point number

Convert a string or number to a floating point number, if possible.

c_angstroem_m

float(x) -> floating point number

Convert a string or number to a floating point number, if possible.

c_echarge_C

float(x) -> floating point number

Convert a string or number to a floating point number, if possible.

Predefined:

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.')