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

 
Modules
       
numpy
astro.external.LDAC
common.database.Sequence
astro.external.Sextractor
datetime
getpass
glob
htm
inspect
math
os
pyfits
common.math.statistics
string
struct
sys
time
traceback

 
Classes
       
astro.main.OnTheFly.OnTheFly
SourceList(common.database.DataObject.DataObject, astro.main.OnTheFly.OnTheFly)
common.database.DBMain.DBObject(__builtin__.object)
SourceListParameters
common.database.DataObject.DataObject(common.database.DBMain.DBObject)
SourceList(common.database.DataObject.DataObject, astro.main.OnTheFly.OnTheFly)
exceptions.Exception(exceptions.BaseException)
SourceListError

 
class SourceList(common.database.DataObject.DataObject, astro.main.OnTheFly.OnTheFly)
    
Method resolution order:
SourceList
common.database.DataObject.DataObject
common.database.DBMain.DBObject
__builtin__.object
astro.main.OnTheFly.OnTheFly

Methods defined here:
__init__(self, debug=0, attributes=None, extractor=None)
__str__(self)
after_do_make(self, switches=None)
This method is run after making the object (OnTheFly) and stores the checkimage,
this is without OnTheFly processing done in the Recipe
append_from_catalog_on_sources(self, catalog, synonyms)
append_on_sources(self, attr_names, fd=None, sep=' ', funcdict={}, nulldict={})
area_search_on_sources(self, self_search=True, htm_depth=20, Area=None, attr_dict=None)
area_search searches the specified area for sources within a given distance
from a position {i.e. Area=(RA,DEC,Distance)} or within an area delimited
by three or four positions {i.e. Area=[(RA0,DEC0),(RA1,DEC1),(RA2,DEC2)]}.
All positions and distances are in degrees.
For the search, htm trixel ranges are searched at a htm depth of 20.
 
If self_search = True, only the current SourceList is examined, if
self_search = False, all SourceLists will be examined.
 
attr_dict is a dictionary where the keys represent the attributes returned and their
subsequent values should be on input None or an empty list. If self_search is
False this keyword is ignored.
 
Return value is a dictionary with keys the SLID's (SourceList IDentifiers) and
values lists of SID's (Source IDentifiers).
check_preconditions(self)
commit(self)
copy_attributes(self)
copy_file(self, length=16384)
delete(self)
Deletes a SourceList with all its sources (after commit)!
THIS IS OBSOLETE, PLEASE USE THE CONTEXT.DELETE METHOD !!!
derive_timestamp(self)
get_attributes_on_sources(self)
get_attributes returns a dictionary with the existing attributes as
keys and the corresponding types as values.
get_boundingbox_from_sources(self)
determine the bounding from the coordniates of teh sources
get_data_dict_from_area_search_on_sources(self, self_search=True, htm_depth=20, Area=None, attr_list=[])
get_data_dict_from_area_search returns a dictionary of the specified attributes of the
sources found in the specified area.
 
self_search     True, only the current SourceList is examined, False, all available
                SourceLists will be examined.
htm_depth       The htm_depth [default 20].
Area            search the specified area for sources within a given distance from a
                position {i.e. Area=(RA,DEC,Distance)} or within an area delimited
                by three or four positions {i.e. Area=[(RA0,DEC0),(RA1,DEC1),(RA2,DEC2)]}.
                All positions and distances are in degrees.
attr_list       list of attribute to be returned in the dictionary.
get_data_dict_from_sql_query_on_sources(self, attr_list=[], query_string=None, area=None)
get_data_dict_from_sql_query returns the data associated with given
attributes via an sql query in a dictionary.
 
query_string may contain only valid SQL query syntax and the names of the attributes
between double quotes (").
attr_list is a list with the wanted attributes.
area denotes the area of the sky [whole sky].
 
The function returns a dictionary with attribute names as keys and column
data as values (NOTE that in the dictionary the SID data is always returned).
get_data_dict_on_sources(self, attr_list=[], area=None)
get_data_dict returns the data associated with given attributes in a
dictionary.
 
attr_list is a list with the wanted attributes.
area denotes the area of the sky [whole sky].
 
The function returns a dictionary with attribute names as keys and columns
data as values (NOTE that in the dictionary the SID data is always returned).
get_data_from_sql_query_on_sources(self, attr_dict={}, query_string=None, area=None)
Performs an SQL query on source attributes and returns a list of
Source IDentifiers (SID's) and populates the supplied dictionary
with data associated with given attributes (dictionary keys) in the
form of a lists linked to the SID list.
 
   attr_dict: a dictionary where the keys represent the attributes
              to be retrieved (see NOTE)
query_string: may contain only valid SQL query syntax (suitable as
              a WHERE clause) and the names of the attributes
              between double quotes (")
        area: denotes the area of the sky (None indicates as much
              of the sky as covered by the SourceList)
 
NOTE: The values of each dictionary key should be on input None or
      an empty list.  On output the actual values of the attributes
      are stored as key values.
get_data_on_sources(self, attr_dict, area=None)
Returns a list of Source IDentifiers (SID's) and populates the
supplied dictionary with data associated with given attributes
(dictionary keys) in the form of a lists linked to the SID list.
 
attr_dict: a dictionary where the keys represent the attributes
           to be retrieved (see NOTE)
     area: denotes the area of the sky (None indicates as much of
           the sky as covered by the SourceList)
 
NOTE: The values of each dictionary key should be on input None or
      an empty list.  On output the actual values of the attributes
      are stored as key values.
 
This method calls get_data_from_sql_query_on_sources without a
custom query_string.
get_fixed_config(self)
return the fixed sextractor parameters
get_htm_ranges_on_sources(self, htm_depth=9, Area=None)
get_htm_ranges returns the set of htm ranges which cover all the sources
in the sourcelist.
 
htm_depth       The wanted htm level.
Area            Area for which to return the htm_ranges. Area can be a tuple
                to specify a cone {i.e. Area = (RA,DEC,Distance)} or an area
                delimited by three or four positions {i.e.
                Area=[(RA0,DEC0),(RA1,DEC1),(RA2,DEC2)]}.
                Default is bounding box of SourceList.
 
return values are three ranges, the first range the ranges covering the area, the
second range covering the sources which are inside the specified area and the third
range the outersection of the prevous two ranges. A range is a list of tuples,
each tuple containing the start and end htm value.
get_lock(self)
Lock the SourceList and return the number of sources.
get_mag_id(self)
get_number_of_sources(self)
get_number_of_sources returns the number of sources in the SourceList.
get_table_description(self, filename=None, extname=None)
getattr_on_sources(self, attr)
getitem_on_sources(self, index)
ingest_sources_from_catalog(self)
Insert sources from a binary fits file into the db.
insert sources directly into SourceList using a flat-like insert statement.
ingest_sources_from_usno_catalog(self, path)
len_on_sources(self)
make(self)
make_bdsm_catalog(self)
use BDSM to extract to the source list from the frame
make_checkimage(self)
make_gaap_catalog_on_sources(self)
Simple Python based method to make the ascii catalog compatible with
GaaP code. This catalog has the following entries:
1 X_IMAGE (or Xpos)
2 Y_IMAGE (or Ypos)
3 FLUX_AUTO (or FLUX_ISO, or FLUX_APER)
4 FLUXERR_AUTO (or FLUXERR_ISO or FLUXERR_APER)
5 FWHM_IMAGE
6 A_IMAGE (or A)
7 B_IMAGE (or B)
8 THETA_IMAGE (or POSANG)
9 NUMBER (or SID, or SeqNr)
10 FLAGS (or FLAG)
make_image_dict_on_sources(self, sids, mode='sky')
make_image_dict creates an image dict which can be input to
the image server software.
 
sids    An SID (or a list of SIDs) for which the input is generated.
mode    Produce sky (default) or grid coordinates.
make_ldac_catalog_on_sources(self, name=None, htm_depth=20, Area=None, attr_list=None, attr_type={}, rename_dict={}, projection=None)
make_ldac_catalog creates an LDAC catalog (binary FITS table) from
SourceList.
 
       name: name of output file [SourceList.name + '.fits']
  htm_depth: htm level on which the sources are selected according to
             Area keyword [20]
       Area: the specified area for sources within a given distance
             from a position {i.e. Area=(RA,DEC,Distance)} or within
             an area
             delimited by three or four positions
             {i.e. Area=[(RA0,DEC0),(RA1,DEC1),(RA2,DEC2)]}.
             All positions and distances are in degrees.
             [all sources in SourceList]
  attr_list: list of attributes which will be stored in the binary
             FITS file.
             [all attributes]
  attr_type: dictonary where key is table attribute and value the
             FITS type to store in ldac catalogue i.e. '1D', '1E',
             '1K', '1I' or '10A'.
             [python type of table attribute]
rename_dict: dictonary where key is table attribute and value is
             FITS column name.
             [no attribute translation]
make_sextractor_catalog(self)
make_skycat_on_sources(self, Area=None, htm_depth=20, sid_list=None, filename=None, magname=None)
make_skycat creates a "dump" of the SourceList object that can be used to
overplot a frame in ESO skycat.
 
Area            search the specified area for sources within a given distance from a
                position {i.e. Area=(RA,DEC,Distance)} or within an area delimited
                by three or four positions {i.e. Area=[(RA0,DEC0),(RA1,DEC1),(RA2,DEC2)]}.
                All positions and distances are in degrees.
htm_depth       The htm_depth [default 20].
sid_list        a list of wanted SID's (Source IDentifiers) which will be output to the
                skycat output file.
filename        name of file where to store the objects. The default filename is the name
                of the SourceList with extension .scat.
magname         Name of attribute to use for magnitudes in output file.
make_sourcelist_from_catalog(self)
make_sourcelist_from_catalog creates a SourceList from a catalog created
by sextractor.
make_sourcelist_from_sourcelist(self, inlist=None, sidlist=[])
make_sourcelist_from_usno_catalog(self, path)
make_sourcelist_from_usno_catalog creates a Sourcelist from the USNO catalogs.
path denotes the directory where the zone*.cat files are to be found.
make_votable(self, filename=None)
votable returns a VOTable or put the content of SourceList in a user defined file
 
filename        The name of the output file, optional
rollback(self)
set_attributes(self, attributes)
set_coordinate_ranges(self)
set the bounding box of the sourcelist
set_made(self)
set_sourcelist_identifier(self)
set SLID, name and call set_sourcelist_identifier
sql_query_on_sources(self, attr_dict={}, query_string=None, area=None)
THIS FUNCTION IS DEPRECATED: use get_data_from_sql_query_on_sources
 
   Performs an SQL query on source attributes and returns a list of
   Source IDentifiers (SID's) and populates the supplied dictionary
   with data associated with given attributes (dictionary keys) in the
   form of a lists linked to the SID list.
 
      attr_dict: a dictionary where the keys represent the attributes
                 to be retrieved (see NOTE)
   query_string: may contain only valid SQL query syntax (suitable as
                 a WHERE clause) and the names of the attributes
                 between double quotes (")
           area: denotes the area of the sky (None indicates as much
                 of the sky as covered by the SourceList)
 
   NOTE: The values of each dictionary key should be on input None or
         an empty list.  On output the actual values of the attributes
         are stored as key values.
 
   This method simply calls get_data_from_sql_query_on_sources.
update_number_of_sources(self)
update_source_definition(self, attributes=None)

Data descriptors defined here:
COMBINE_METHOD
Method that was used to create this CombinedList [None]
OBJECT
Object name [None]
SLID
SourceList identifier [None]
associatelist
ALID (AssociateList identifier) that was used to create this CombinedList [None]
astrom_params
Information about the derived astrometry [None]
chip
Information about the chip [None]
creation_date
Date this object was created [None]
detection_frame
Optional second frame used in Sextractor double image mode [None]
filename
The name of the associated file [None]
filter
Information about the filter [None]
filters
Filters for which columns are present in this CombinedList [None]
frame
A BaseFrame object (source of the catalog) [None]
globalname
The name used to store and retrieve file to and from Storage [None]
instrument
Information about the instrument [None]
is_valid
Manual/external flag to disqualify bad data (SuperFlag) [None]
llDEC
Declination of lower left containing box [deg]
llRA
Right Ascension of lower left containing box [deg]
lrDEC
Declination of lower right containing box [deg]
lrRA
Right Ascension of lower right containing box [deg]
name
Name of the sourcelist [None]
number_of_sources
Number of sources [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]
sexconf
Sextractor configuration parameters [None]
sexparam
Additional extraction parameters [None]
sources
SourceList documentation [None]
ulDEC
Declination of upperer left containing box [deg]
ulRA
Right Ascension of upper left containing box [deg]
urDEC
Declination of upper right containing box [deg]
urRA
Right Ascension of upper right containing box [deg]

Data and other attributes defined here:
PROCESS_TIME = 50
bdsm_params = {}

Methods inherited from common.database.DataObject.DataObject:
FileName(self)
Return the pathame of the object
Name(self)
Return the name of the object
check_mandatory_dependencies(self)
check if all the mandatory dependencies are set
derive_hash(self)
Apply hashing function to the contents of the file that is part of
this object.
 
The SHA hashing function is used to calculate a hash value of the
contents of this DataObject. The hash value is returned as a
hexadecimal string.
distinct(self, param_list)
This method returns the distinct values from an input list. The
current implementation is kinda cheesy.
exists(self)
Test is the file existsts
get_canonical_name(self, processlevel='')
The canonical name of a DataObject.
get_pathname(self)
Getter for pathname
is_on_dataserver(self)
Checks if file is accessable on the dataserver.
 
NOTE: A return of False does NOT imply the file is not on any
      dataserver!  It is simply not on any accessable
      dataserver.
is_stored(self)
locate(self)
See common/net/dataserver_client.py (Data_IO.locate).
 
Returns a list of strings describing all dataservers where the file is
located as well as a few properties of the file, i.e.
 ['ip=...,port=...,path=...,size=...,mdate=...,
  'ip=...,port=...,path=?,size=?,mdate=?']
 
Question marks indicate that this dataserver is not reachable.
name_insert_suffix(self, suffix)
name_replace_suffix(self, suffix)
name_with_new_suffix(self, suffix)
release(self)
retrieve(self)
set_filename(self, pathname=None, processlevel='')
Specify a filename for this DataObject or use the default filename.
 
This method is used to set the filename attribute of a DataObject.
If called without a filename, the filename is set to the canonical name.
Classes that are derived from DataObject are expected to define a
method get_canonical_name() that returns the name for an instance
of that class. This is mandatory for CalFiles (or files that are
store()d on the data server) and optional for other files.
set_pathname(self, pathname)
Setter for pathname
set_process_parameters_from_dict(self, pars={})
pars is a dictionary of the type e.g.:
{'BiasFrame.process_params.SIGMA_CLIP':8}
set_stored(self)
set_user_config(self, pars={})
store(self)
store_with_hash_as_name(self, prefix='', suffix='fits')
Name the file after the hash value of the file and store it.
 
First the hash value of the file is calculated. The pathname of the
dataobject is renamed to the hash value with the given suffix appended.
Then the file is stored.

Class methods inherited from common.database.DataObject.DataObject:
is_cal(cls) from common.database.DBMeta.DBObjectMeta
Test for being cal, derived raw classes should set _IS_CAL to 1
is_config(cls) from common.database.DBMeta.DBObjectMeta
Test for being config, derived raw classes should set _IS_CONFIG to 1
is_raw(cls) from common.database.DBMeta.DBObjectMeta
Test for being raw, derived raw classes should set _IS_RAW to 1
is_science(cls) from common.database.DBMeta.DBObjectMeta
Test for being science, derived raw classes should set _IS_SCIENCE to 1
is_seq(cls) from common.database.DBMeta.DBObjectMeta
Test for being seq, derived raw classes should set _IS_SEQ to 1
is_support(cls) from common.database.DBMeta.DBObjectMeta
Test for being config, derived raw classes should set _IS_SUPPORT to 1

Data descriptors inherited from common.database.DataObject.DataObject:
pathname

Data and other attributes inherited from common.database.DataObject.DataObject:
filepath = './'
localname = ''
mandatory_dependencies = ()
storage = <common.net.dataserver_client.Storage at 0x2aaabad1f6c8>

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 0x1028a70>
pickle_id = None

Methods inherited from astro.main.OnTheFly.OnTheFly:
Flagged(self)
Check if any flag is set
return 1 for flag is set
return 0 no flag
after_set_onthefly_dependencies(self, switches, advanced)
this method is called after the onthefly method set_onthefly_dependencies
derived classes can implement this method to customize the dependencies
setting after this has been done automatically by onthefly
after_uptodate_object(self, dependencies_missing, dependencies_new, dependencies_obsolete)
The uptodate_object method determines if the object is uptodate, and will result in three listings :
 dependencies_missing - missing mandatory dependencies
 dependencies_new - new dependencies
 dependencies_obsolete - current dependencies that are obsolete
Derived classes can override this method to tweak the listings
check_for_mandatory(self, dep_str, dep_new)
check if dependency is mandatory and present
dep_str is the name of the attribute, dep_new is the (attribute) object
get_onthefly_dependencies(self, advanced=None)
Method retrieves a list of all dependencies used for
on-the-fly processing
Return: [dependency, dependency class, dependency name]
uptodate(self, date_time=None, template=None, switches=None, advanced=None)
This method checks if the object is up-to-date, for the given datetime.
OnTheFly_uptodate class has the functionality for checking uptodate

Class methods inherited from astro.main.OnTheFly.OnTheFly:
exist(cls, date_time=None, chip=None, filter=None, object_id=None, parent=None, parent_attr=None, template=None, extra=[], advanced=None, switches=None) from common.database.DBMeta.DBObjectMeta
for the given parameters and class return the most
recent object(s), or None
get_onthefly(cls, date_time=None, filter=None, chip=None, object_id=None, advanced=None, switches=None, template=None, parent=None, parent_attr=None) from common.database.DBMeta.DBObjectMeta
For the given parameters and class get the object,
if the object does not exist -> make it.
This is done recursively for all dependencies.
 
The object can only be made if there are raws

 
class SourceListError(exceptions.Exception)
    
Method resolution order:
SourceListError
exceptions.Exception
exceptions.BaseException
__builtin__.object

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object at 0x719220>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message
exception message

 
class SourceListParameters(common.database.DBMain.DBObject)
    
Method resolution order:
SourceListParameters
common.database.DBMain.DBObject
__builtin__.object

Data descriptors defined here:
HTM_DEPTH
Highest level of HTM indexing [None]
SOURCE_CODE_VERSION
The version of the source code [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

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 0x1028a70>
pickle_id = None

 
Functions
       
Area_To_HTM_Ranges(depth=9, Area=None)
# Translates Area to htm ranges
ImportSourceList(Name='USNO-A2.0', Area=None, debug=0, checkmode=1, datadir=None, tablename=None, uplevel=0)
ImportSourceList imports pieces of sky into a local sourcelist.
First the function checks which piece of sky is already present in the local
sourcelist. Then the missing pieces are imported.
 
The function returns the SourceList instance.
 
Name:   Name of sourcelist to import (default: USNO-A2.0)
Area:   Area which to import.
add_ranges(r1, r2)
# computes the total range of two htm ranges
check_for_nan(*args)
check for a nan value in the list of arguments
correct_bounding_box(tuple)
do_convert(convfunc, value)
extract_region(filename, xmin, xmax, ymin, ymax)
Use fitscopy to extract a region [xmin:xmax, ymin:ymax] from FITS file
"filename".
Returns the filename of the cutout; with filename:
   image-xmin-xmax_ymin-ymax.fits
get_center_from_area(area)
Get the central (RA, DEC) from a bounding box of the form:
 
area = [(llRA, llDEC), (lrRA, lrDEC), (urRA, urDEC), (ulRA, ulDEC)]
get_partition_names(htmrange)
get_partition_range(partname)
get_projection_from_astrom(sl, use_cdelt=False)
determine projection info from self.frame.astrom
get_projection_from_cat(catname)
gettableunits(attr)
importable_SourceList(sl)
in_range(rng, i)
# returns True or False when i inside/ouside range rng
intersect_ranges(r1, r2)
# computes the overlapping  htm range from two htm ranges
isrange(htmrange)
main()
make_area_query(htm_range, depth_factor=1, alias=None, mode='N', index='"HTM"', in_group=-1)
Returns an SQL query for sources within a certain area, determined by their htm indexes.
 
htm_range       list of tuples with start and end htm values
depth_factor    conversion factor to the wanted htm depth
alias           Table alias in SQL query
mode            can be: 'N' normal mode, puts all ranges in query
                        'S' simple mode, puts only limiting range in query
                        'E' extensive mode, puts all ranges and limiting range
                        in query
index           SQL name of index
make_in_list(item, inlist)
make_range(rangelist)
outersect_ranges(r1, r2)
# computes the non matching part of two ranges, one contained in the other
q_get_attrs_of_sourcelists(slids, hint='', owner='AWOPER', table=None, type='SourceList$sources$', attrname=None, union=False)
q_get_attrs_of_sourcelists returns the name and types of all attributes which are connected to
a number of sourcelists.
 
slids       SLIDs (list of SourceList IDentifiers)
hint        Oracle hint (i.e. /*+INDEX(T)*/)
owner       Schema Owner (i.e. AWOPER)
table       name of table (i.e. SourceList)
type        basetype of table row (i.e. SourceList$sources$)
attrname    name of attribute where the type name is stored (i.e. +*sources)
union       denotes whether to use a union query or not
q_get_data_from_sourcelist(slid, attrlist=[], hint='', owner='AWOPER', type_name='SourceList$sources$', oltable=None)
q_get_data_from_sourcelist returns the Oracle query string to
return the specified column values of the sourcelists rows.
Return value is a tuple consisting of query string and attribute
variable name. The latter can be used to append to the query, i.e.
(q, v) = q_get_data_from sourcelist(slid, attrlist=["RA", 'DEC'])
 
q += 'WHERE %(v)s."RA" > 133.0 and %(v)s."RA" < 145.0 and rownum < 100' % vars()
 
slid        SLID (SourceList IDentifier of SourceList)
attrlist    list of wanted columns
hint        Oracle hint (i.e. /*+INDEX(T)*/)
owner       Schema Owner (i.e. AWOPER)
type_name   (sub)type of rows (i.e. SourceList$sources$00001')
oltable     name of objectlist table (i.e. SourceList)
q_get_hint_for_index_on_htm(table_name, cursor, alias)
q_get_hint_for_index_on_slid(table_name, cursor, alias)
q_get_index_name_for_table(table_name, owner, column_name)
q_get_oltablename_for_sourcelist(slid, owner='AWOPER', table=None, attrname=None)
q_get_oltablename_for_sourcelist returns the Oracle query string to
return the table name whare the objectslist objects are stored.
 
slid        SLID (SourceList IDentifier of SourceList)
owner       Schema Owner (i.e. AWOPER)
table       name of table (i.e. SourceList)
attrname    name of attribute where the type name is stored (i.e. +*sources)
q_get_rowcount_of_sourcelist(SLID, hint='', owner='AWOPER', oltable=None)
q_get_rowcount_of_sourcelist returns the query which will obtain the number of rows (i.e.
the number of sources) in the specified sourcelist
 
SLID    SourceList IDentifier
hint    Oracle hint (i.e. /*+INDEX(T)*/)
owner   Schema Owner (i.e. AWOPER)
oltable name of objectlist table containing the associates
        (i.e. SourceList*sources/SOURCELIST*SOURCES)
q_get_tablename_for_objectlist(owner='AWOPER', type_name='SourceList$sources$')
q_get_tablename_for_objectlist returns the Oracle query string to
return the table name whare the objectslist objects are stored.
 
owner       Schema Owner (i.e. AWOPER)
type_name   (sub)type of rows (i.e. SourceList$sources$00001')
q_get_typeid_of_sourcelist(slid, hint='', owner='AWOPER', table=None, attrname=None, type='SourceList$sources$')
q_get_typeid_of_sourcelist returns the Oracle query string to return the sys_typeid of the
sourcelist rows.
 
slid        SLID (SourceList IDentifier of SourceList
hint        Oracle hint (i.e. /*+INDEX(T)*/)
owner       Schema Owner (i.e. AWOPER)
table       name of table (i.e. SourceList)
attrname    name of attribute where the type name is stored (i.e. +*sources)
type        supertype of rows (i.e. SourceList$sources$')
q_get_typename_of_sourcelist(slid, hint='', owner='AWOPER', table=None, attrname=None)
q_get_typename_of_sourcelist returns the Oracle query string to return the typename of the
sourcelist rows.
 
slid    SLID (SourceList IDentifier of SourceList
hint    Oracle hint (i.e. /*+INDEX(T)*/)
owner   Schema Owner (i.e. AWOPER)
table   name of table (i.e. SourceList*sources)
attrname    name of attribute where the type name is stored (i.e. +*sources)
run_sextractor_double_image_mode(sourcelist, detection_frame, measurement_frame, sexparams, sexconf)
Cutouts are made of the overlapping region of the detection and
measurement images. After SExtractor is run, parameters X_IMAGE and Y_IMAGE
are adjusted so they correspond to the pixel postions on the original
frame rather than the cutout.
sdss_rangequery(url=None, attributes=None, synonyms=None, area=None, table='PhotoObjAll', depth=9)
Run query and return file object
shift_pixel_coordinates(catalog, shift_x, shift_y)
Used for SExtractor double image mode; the pixel coordinates determined
by SExtractor are those of the overlapping cutout; pixel positions must be
shifted back to the position in the original frame.
sort_range(r)
# sorts ranges and merge them if necessary
translate_column_name(column_name)
translate_dict_to_list(data, keyselect=None)
translate_dict_to_list converst a dictionary with values of type list to
a list of lists, sorted and selected according to the keys in keyselect.
usno_rangequery(url=None, attributes=None, area=None)
Run query and return file object

 
Data
        BDSM_NAMES = ['f-BDSM', 'py-BDSM', 'bdsm', 'BDSM']
DEFAULT_HTM_DEPTH = 25
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', ...}
FITSCOLUMN_NAMES = {'ALPHA_J2000': 'RA', 'ALPHA_SKY': 'RA', 'A_IMAGE': 'A', 'BACKGROUND': 'BackGr', 'B_IMAGE': 'B', 'DELTA_J2000': 'DEC', 'DELTA_SKY': 'DEC', 'Dec': 'DEC', 'FLAGS': 'Flag', 'FLUX_MAX': 'MaxVal', ...}
ImportedSourceListNames = ['USNO-A2.0', 'USNO-B1.0', 'SDSS-PhotoObjAll-DR3', 'SDSS-PhotoObjAll-DR4', 'SDSS-PhotoObjAll-DR5', 'SDSS-Photoz-DR5', 'SDSS-Photoz2-DR5', 'SDSS-SpecObjAll-DR5', 'WSA-lasSource-DR2', 'WSA-lasSource-DR3', '2MASS-PSC', '2MASS-XST']
SL_HINT = ''
SOURCELIST_DICT = {'A': <type 'float'>, 'B': <type 'float'>, 'DEC': <type 'float'>, 'FLAG': <type 'long'>, 'HTM': <type 'long'>, 'POSANG': <class 'common.util.types.single_float'>, 'RA': <type 'float'>, 'SID': <type 'long'>, 'SLID': <type 'long'>}
USNO_ATTR_FORMS = ['1d', '1d', '1f', '1f', '1h', '1h', '1h']
USNO_ATTR_NAMES = ['RA', 'DEC', 'USNO_BMAG', 'USNO_RMAG', 'USNO_GSC', 'USNO_Q', 'USNO_FIELD']
USNO_ATTR_TYPES = [<type 'float'>, <type 'float'>, <class 'common.util.types.single_float'>, <class 'common.util.types.single_float'>, <type 'int'>, <type 'int'>, <type 'int'>]
USNO_RECORD_LEN = 12
__version__ = '@(#)$Revision: 1.212 $'
database = <common.database.Database.Database object at 0x2aaab59b6cd0>
fits_typemap = {'A': <type 'str'>, 'D': <type 'float'>, 'E': <class 'common.util.types.single_float'>, 'F': <class 'common.util.types.single_float'>, 'H': <type 'int'>, 'I': <type 'int'>, 'J': <type 'int'>, 'K': <type 'long'>, 'L': <type 'int'>}
tableunitsmap = {'A': 'pixel', 'B': 'pixel', 'BackGr': 'count', 'CLASS_STAR': None, 'Corr': 'pixel**2', 'DEC': 'deg', 'ERRA_IMAGE': 'pixel', 'ERRB_IMAGE': 'pixel', 'ERRTHETA_IMAGE': 'deg', 'ERRX2_IMAGE': 'pixel**2', ...}