astro.main.BDSM_Gaussian (version @(#)$Revision: 1.28 $)
index
/astro-wise/AWEHOME/AWBASE/astro/main/BDSM_Gaussian.py

classes for handling gaussians

 
Modules
       
common.database.Sequence
datetime
pyfits
string

 
Classes
       
common.database.DBMain.DBObject(__builtin__.object)
BDSM_Gaussian
BDSM_GaussianList
BDSM_GaussianParameters

 
class BDSM_Gaussian(common.database.DBMain.DBObject)
    Class for storing a gaussian. BDSM defines sources by gaussians, a source consists of
one or more guassians.
 
The residuals of
 
 
Method resolution order:
BDSM_Gaussian
common.database.DBMain.DBObject
__builtin__.object

Methods defined here:
check_preconditions(self)
check the pre conditions for the gaussian
get_gaussian_list(self)
return all gaussian as an array (list of lists)
get_gaussian_residual(self)
generate a residual image for the (current) gaussian
get_list_residual(self)
retrieve the residual image of the whole sourcelist
make(self)
make a gaussian
use_fits_rec(self, rec, columns, invalid_cols=None)
use a pyfits record (and columns) to set attributes

Data descriptors defined here:
GLID
The GaussianList IDentifier [None]
SID
The Source IDentifier [None]
SLID
The SourceList IDentifier [None]
bmaj_fw
FWHM of the major axis [arcsec]
bmin_fw
FWHM of the minor axis [arcsec]
bpa
Position angle [deg]
dec
Declination of the gaussian [deg]
deconv_bmaj_fw
Deconvolved FWHM of the major axis [arcsec]
deconv_bmin
Deconvolved FWHM of the minor axis [arcsec]
deconv_bpa
Deconvolved position angle [deg]
err_bmaj
Error in FWHM of the major axis [arcsec]
err_bmin
Error in FWHM of the minor axis [arcsec]
err_bpa
Error in position angle [deg]
err_dec
Error in the declination of the gaussian [deg]
err_decon_bmaj
Error in deconvolved FWHM of the major axis [arcsec]
err_decon_bmin
Error in deconvolved FWHM of the minor axis [arcsec]
err_decon_bpa
Error in deconvolved position angle [deg]
err_peak_flux
Error in the peak flux density [Jy / beam]
err_ra
Error in the right ascension of the gaussian [deg]
err_total_flux
Error in the total flux [Jy]
err_xpos
Error in the y position of the gaussian [pixels]
flag
Gaussian flag [None]
gaul_id
Gaussian ID from BDSM [None]
is_valid
Manual/external flag to disqualify bad data (SuperFlag) [None]
isl_av
Residual mean of the island [Jy / beam]
isl_rms
Residual rms of the island [Jy / beam]
island_id
Island ID from BDSM [None]
object_id
The object identifier
 
The object identifier is an attribute shared by all persistent
instances. It is the prime key, by which object identity is established
peak_flux
Peak flux density  [Jy / beam]
ra
Right ascension of the gaussian [deg]
src_av
Residual mean of the gaussian [Jy / beam]
src_rms
Residual rms of the gaussian [Jy / beam]
srcnum
Source number from BDSM [None]
total_flux
Total flux [Jy]
xpos
X position of the gaussian [pixels]
ypos
Y position of the gaussian [pixels]

Data and other attributes defined here:
HALF_HEIGHT = 50
HALF_WIDTH = 50

Methods inherited from common.database.DBMain.DBObject:
__del__(self)
Destructor for the DBObject
 
This destructor is called by the garbage collector for the transient
part of the DBObject. When it is called it calls the gc_transient()
method of the DBProxy implementation. The implementation of the
gc_transient() method can then decide what to do with the persistent
counterpart.
E.g. the database can be synchronized with its transient counterpart.
Another possibility is that the gc_transient() implementation checks
whether any attributes of a read-only object have changed since an
object was fetched from the database. If there are differences an
exception can be raised.
__reduce__(self)
Method necessary to create picklable objects
 
This mehod return a tuple containg a function object used for
unpickling and a picklable state tuple, to be used as argument
to the unpickle function. If necessary this object is registered
in the pickle cache
as_dict(self, seqnr=1, dependency_name='', dictionary={}, allow_lazy_typed_list=False)
Method much like the info method, but returns a dictionary.
 
Dictionary looks like:
  {'<classname>.<property1_name>.<property2_name>': value,
   '<classname>.<property2_name>.<property3_name>': value}
 
Problem: infinite loops for cold/flat dependencies. It seems a maximum
recursion depth limits the problem.
commit(self)
Commits object including objects that are referenced and have been changed.
 
If this object refers to other persistent object a commit() ensures that
 
1. ALL changes to the object and referred objects are made persistent.
2. NONE of the changed object and referred objects are made persistent.
Under normal circumstances only the first thing should ever happen.
If the second case occurs it is almost certainly because of some bug in
the routine that implements the DBProxy interface.
get_creator(self)
Returns the name of the user who created this object.
get_persistent(self)
get_project(self)
Returns the name of the project to which this object belongs.
info(self, level=0, doc=False, _indent=0, _printclass=True)
Print the values of all persistent properties of the object.
 
level       : level of introspection
doc         : display docstrings for attributes
_indent     : internal parameter used for formatting
_printclass : internal parameter used for formatting
inverse_objects(self, max_results=100)
Iterate through and return all objects that use the current object
max_results     The maximum number of objects returned per query
inverse_query(self)
go through all inverse properties to see if this object is used
persists(self)
Returns whether an object is already made persistent or transient.
recommit(self)
Commits changes to an object, without following links.

Class methods inherited from common.database.DBMain.DBObject:
get_inverse_properties(cls, props=None) from common.database.DBMeta.DBObjectMeta
return all inverse properties 
that are all the properties that point to this class

Data descriptors inherited from common.database.DBMain.DBObject:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from common.database.DBMain.DBObject:
__metaclass__ = <class 'common.database.DBMeta.DBObjectMeta'>
This is the metaclass for persistent classes
 
Provides:
  __new__ -- manages class construction
  __call__ -- manages object instantiation
database = <common.database.DBOracle.DBProxy instance at 0x12fb7e8>
pickle_id = None

 
class BDSM_GaussianList(common.database.DBMain.DBObject)
    ' class for storing a Gaussian List, the gaussians self are individually
stored in the class BDSM_Gaussian
 
 
Method resolution order:
BDSM_GaussianList
common.database.DBMain.DBObject
__builtin__.object

Methods defined here:
__init__(self)
check_preconditions(self)
check if the pre condisitons are met
commit(self)
commit the BDSM_GaussianList and the BDSM_Gaussians
get_new_GLID(self)
determine new GLID, GaussianList IDentifier
inspect(self)
inspect the gaussian list
plot the frame and overplot all gaussians
make(self, bdsm_result)
make the gaussian list
make_gaussians(self)
Read the gaussians from the binary FITS table produced by BDSM
- produce a BDSM_Gaussian for every row
- check for nan values in numerical columns
- set SLID/SID from SourceList
set_gaussians(self)
fill the gaussians list

Data descriptors defined here:
GLID
The GaussianList IDentifier [None]
SLID
The SourceList IDentifier [None]
creation_date
Date this object was created [None]
filename
The filename of the input file [None]
frame
A BaseFrame object [None]
image_filename
The filename of the gaussian generated image [None]
instrument
Information about the instrument [None]
is_valid
Manual/external flag to disqualify bad data (SuperFlag) [None]
number_of_gaussians
Number of gaussians [None]
object_id
The object identifier
 
The object identifier is an attribute shared by all persistent
instances. It is the prime key, by which object identity is established
process_params
Processing parameters [None]
residual_filename
The filename of the residuals [None]
sourcelist
The SourceList [None]
stat
Statistics of the frame[None]

Methods inherited from common.database.DBMain.DBObject:
__del__(self)
Destructor for the DBObject
 
This destructor is called by the garbage collector for the transient
part of the DBObject. When it is called it calls the gc_transient()
method of the DBProxy implementation. The implementation of the
gc_transient() method can then decide what to do with the persistent
counterpart.
E.g. the database can be synchronized with its transient counterpart.
Another possibility is that the gc_transient() implementation checks
whether any attributes of a read-only object have changed since an
object was fetched from the database. If there are differences an
exception can be raised.
__reduce__(self)
Method necessary to create picklable objects
 
This mehod return a tuple containg a function object used for
unpickling and a picklable state tuple, to be used as argument
to the unpickle function. If necessary this object is registered
in the pickle cache
as_dict(self, seqnr=1, dependency_name='', dictionary={}, allow_lazy_typed_list=False)
Method much like the info method, but returns a dictionary.
 
Dictionary looks like:
  {'<classname>.<property1_name>.<property2_name>': value,
   '<classname>.<property2_name>.<property3_name>': value}
 
Problem: infinite loops for cold/flat dependencies. It seems a maximum
recursion depth limits the problem.
get_creator(self)
Returns the name of the user who created this object.
get_persistent(self)
get_project(self)
Returns the name of the project to which this object belongs.
info(self, level=0, doc=False, _indent=0, _printclass=True)
Print the values of all persistent properties of the object.
 
level       : level of introspection
doc         : display docstrings for attributes
_indent     : internal parameter used for formatting
_printclass : internal parameter used for formatting
inverse_objects(self, max_results=100)
Iterate through and return all objects that use the current object
max_results     The maximum number of objects returned per query
inverse_query(self)
go through all inverse properties to see if this object is used
persists(self)
Returns whether an object is already made persistent or transient.
recommit(self)
Commits changes to an object, without following links.

Class methods inherited from common.database.DBMain.DBObject:
get_inverse_properties(cls, props=None) from common.database.DBMeta.DBObjectMeta
return all inverse properties 
that are all the properties that point to this class

Data descriptors inherited from common.database.DBMain.DBObject:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from common.database.DBMain.DBObject:
__metaclass__ = <class 'common.database.DBMeta.DBObjectMeta'>
This is the metaclass for persistent classes
 
Provides:
  __new__ -- manages class construction
  __call__ -- manages object instantiation
database = <common.database.DBOracle.DBProxy instance at 0x12fb7e8>
pickle_id = None

 
class BDSM_GaussianParameters(common.database.DBMain.DBObject)
    gaussians process parameters
 
 
Method resolution order:
BDSM_GaussianParameters
common.database.DBMain.DBObject
__builtin__.object

Methods defined here:
__init__(self, filename='')
initialize BDSM_GaussianParameters from filename if given

Data descriptors defined here:
bmpersrc_th
beams per source, 0 => calculate in prog [None]
boxsize_th
boxsize for rms image, 0 => calculate in prog [None]
fdr_alpha
alpha value for FDR; 0 => set to 0.05 inside prog [None]
maxsize_beam
maximum size of fitted gaussian in beam area, 0 => set to 10 inside prog [None]
minpix_isl
minimum num of pixels per island, 0 => set to 4 inside prog [None]
object_id
The object identifier
 
The object identifier is an attribute shared by all persistent
instances. It is the prime key, by which object identity is established
rms_map
take constant rms or rms map, default => calculate in prog [None]
stepsize_th
stepsize for rms image, 0 => calculate in prog [None]
takemeanclip
take calculated mean_clip or 0, not true/false => calculate in prog [None]
thresh
hard or fdr pixel threshold, default => calculate from prog [None]
thresh_isl
island threshold in sigma, 0 => set to 3 inside prog [None]
thresh_pix
pixel threshold in sigma, 0 => set to 5 inside prog [None]

Methods inherited from common.database.DBMain.DBObject:
__del__(self)
Destructor for the DBObject
 
This destructor is called by the garbage collector for the transient
part of the DBObject. When it is called it calls the gc_transient()
method of the DBProxy implementation. The implementation of the
gc_transient() method can then decide what to do with the persistent
counterpart.
E.g. the database can be synchronized with its transient counterpart.
Another possibility is that the gc_transient() implementation checks
whether any attributes of a read-only object have changed since an
object was fetched from the database. If there are differences an
exception can be raised.
__reduce__(self)
Method necessary to create picklable objects
 
This mehod return a tuple containg a function object used for
unpickling and a picklable state tuple, to be used as argument
to the unpickle function. If necessary this object is registered
in the pickle cache
as_dict(self, seqnr=1, dependency_name='', dictionary={}, allow_lazy_typed_list=False)
Method much like the info method, but returns a dictionary.
 
Dictionary looks like:
  {'<classname>.<property1_name>.<property2_name>': value,
   '<classname>.<property2_name>.<property3_name>': value}
 
Problem: infinite loops for cold/flat dependencies. It seems a maximum
recursion depth limits the problem.
commit(self)
Commits object including objects that are referenced and have been changed.
 
If this object refers to other persistent object a commit() ensures that
 
1. ALL changes to the object and referred objects are made persistent.
2. NONE of the changed object and referred objects are made persistent.
Under normal circumstances only the first thing should ever happen.
If the second case occurs it is almost certainly because of some bug in
the routine that implements the DBProxy interface.
get_creator(self)
Returns the name of the user who created this object.
get_persistent(self)
get_project(self)
Returns the name of the project to which this object belongs.
info(self, level=0, doc=False, _indent=0, _printclass=True)
Print the values of all persistent properties of the object.
 
level       : level of introspection
doc         : display docstrings for attributes
_indent     : internal parameter used for formatting
_printclass : internal parameter used for formatting
inverse_objects(self, max_results=100)
Iterate through and return all objects that use the current object
max_results     The maximum number of objects returned per query
inverse_query(self)
go through all inverse properties to see if this object is used
persists(self)
Returns whether an object is already made persistent or transient.
recommit(self)
Commits changes to an object, without following links.

Class methods inherited from common.database.DBMain.DBObject:
get_inverse_properties(cls, props=None) from common.database.DBMeta.DBObjectMeta
return all inverse properties 
that are all the properties that point to this class

Data descriptors inherited from common.database.DBMain.DBObject:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from common.database.DBMain.DBObject:
__metaclass__ = <class 'common.database.DBMeta.DBObjectMeta'>
This is the metaclass for persistent classes
 
Provides:
  __new__ -- manages class construction
  __call__ -- manages object instantiation
database = <common.database.DBOracle.DBProxy instance at 0x12fb7e8>
pickle_id = None

 
Functions
       
calculate_hash(filename)
calculate the hash value for the given file
dict_from_bdsm_file(filename)
create a dictionary from a output file of BDSM
generate_filename(base_name, filename, instrument, ext='fits')
generates filename for the guassian residual file

 
Data
        Env = {'astrometric_refcat': '/aw01/users/catalog/USNO-A2/', 'aw_usno_url': 'http://dbusno.astro-wise.org/', 'aweshell': 'awe', 'awvo_url': '', 'baseconf_dir': '/astro-wise/awehome/config', 'calts_server': 'calts.astro-wise.org', 'data_port': '8000', 'data_server': 'ds.astro.rug.astro-wise.org', 'database_api': 'cx_Oracle', 'database_engine': 'oracle_10g', ...}
FITS_GAUSSIAN_TABLE = 'BDSM_gaullist'
PROCESS_TIME = 180
__version__ = '@(#)$Revision: 1.28 $'