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

completely raw data

 
Modules
       
astro.util.darma
datetime
os

 
Classes
       
common.database.DataObject.DataObject(common.database.DBMain.DBObject)
RawFitsData
exceptions.Exception(exceptions.BaseException)
RawFitsDataError

 
class RawFitsData(common.database.DataObject.DataObject)
    This data object represents completely raw data. When this object is
initialized the contents of the data are unknown.
 
 
Method resolution order:
RawFitsData
common.database.DataObject.DataObject
common.database.DBMain.DBObject
__builtin__.object

Methods defined here:
__init__(self, pathname='', **kw)
commit(self)
Commit object and insert header into database.
get_header(self)
Returns a list of tuples with 5 values (extension, position, name,
value, comment).
get_header_list(self)
Returns a list of DARMA header objects corresponding to the
primary and extension headers respectively from the original
RawFitsData header.
 
NOTE: This is a reconstruction of the original header.  As such,
      there may be minor changes in format of the values and
      headers themselves.  These differences will take the form of
      corrected scientific notation or possibly even a slight
      ordering differnce of the keywords.  This is due to the
      PyFITS verify routines and should have no adverse effects.
get_unique_header(self)
Returns a DARMA header object corresponding to a merger of the
primary and extension headers from the original RawFitsData header.
Any keywords common to more than one header are overwritten by the
most recent value (i.e., from the last header to be merged).
 
NOTE: This is a reconstruction of the original header.  As such,
      there may be minor changes in format of the values and
      headers themselves.  These differences will take the form of
      corrected scientific notation or possibly even a slight
      ordering differnce of the keywords.  This is due to the
      PyFITS verify routines and should have no adverse effects.
 
      COMMENTS are currently not merged correctly.
header_inserted(self)
Tell whether the headers have been inserted into the database.
initialize_date_attributes(self)
initialize_filter_attribute(self)
initialize_instrument_attribute(self)
initialize_misc_attributes(self)
initialize_observingblock_attribute(self)
initialize_template_attribute(self)
insert_header(self)
Inserts a set of RawFitsData headers into the database.
 
NOTE: The RawFitsData object MUST be commited first and the
      associated file MUST exist.
load_header(self)
Initialize self.header
read_header(self)
Read a header into descriptors.
 
The descriptor is assumed to include a number of all caps
attributes that map directly to FITS header keywords. In
addition, if any of the following attributes are present, this
routine will initialize those attributes.
 
Initialized attributes: instrument, date, misc, filter,
observing_block, template
retrieve(self)
Retrieve the RawFitsData FITS file from the dataserver.  Because the
RawFitsData files are stored in compressed form, they may need to
be decompressed.
 
This method checks which versions of the file exist on the dataserver.
If a compressed version is present, this is downloaded and
decompressed, otherwise the uncompressed version is retrieved.

Class methods defined here:
select(self, **searchterms) from common.database.DBMeta.DBObjectMeta
Class method to select RawFitsData.  Will eventually include
querying values from RawFitsData headers.
 
Syntax example:
 
q = RawFitsData.select(instrument='WFI', filter='#842',
    time_from='2000-01-02 04:45:46', time_to='2000-01-02 05:03:00')
 
Possible search terms:
----------------------
date        - select of the same date (i.e. date at the start of
              observing night, in yyyy-mm-dd format)
exptime     - select frames with similar exposure time
              (EXPTIME-0.8sec to EXPTIME+0.8 sec)
filename    - select a frame(!) by its filename
filter      - select of the same filter ('#842', '#843', etc.)
instrument  - select of the same instrument ('WFI', 'WFC', 'OCAM')
object      - select for OBJECT header keyword, uses "like"
              functionality, which allows wildcards "*" and "?"
time_from   - precise form of date, in yyyy-mm-dd hh:mm:ss format
time_to     - required when using time_from
 
NOT YET IMPLEMENTED!
header      - dictionary of {'keyword' : ('',)
select_from_header(self, keyword, operator, value, type) from common.database.DBMeta.DBObjectMeta
Select method specifically to query values out of RawFitsData
headers.
 
    keyword: string value of the header keyword
   operator: comparison operator as a string (>, <, =, >=, <=, !=)
      value: value to compare
       type: data type of the value (e.g., str, int, date, etc.)

Static methods defined here:
group_by_date(rfd_list)
This method is used to group a list of RawFitsData objects by
observing night.
group_by_date_obs(rfd_list)
This method is used to group a list of RawFitsData objects by
date_obs.
group_by_filter(rfd_list)
This method is used to group a list of RawFitsData objects by
filter.
group_by_object(rfd_list)
This method is used to group a list of RawFitsData objects by
object name.

Data descriptors defined here:
ARCFILE
Archive file name[None]
DATE
UTC date the original data file was saved [None]
DATE_OBS
UTC date at the start of the observation [None]
EXPTIME
Total exposure time [sec]
LST
Local sidereal time at the start of the observation expressed as the number of seconds (a float) since UTC midnight [sec]
MJD_OBS
Modified Julian date at the start of the observation (JD-2400000.5) [day]
OBJECT
Object name [None]
OBSERVER
The observer [None]
UTC
Universal Coordinated Time (UTC) at the start of the observation expressed as the number of seconds (a float) since UTC midnight [sec]
filename
The name of the associated file [None]
filter
Information about the filter [None]
globalname
The name used to store and retrieve file to and from Storage [None]
instrument
Information about the instrument [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
observing_block
Information about the observing block [None]
template
Information about the template [None]

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)
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 0xa27cb0>

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

 
class RawFitsDataError(exceptions.Exception)
    
Method resolution order:
RawFitsDataError
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

 
Functions
       
get_distinct_date_obs(input_list)
get_distinct_filters(input_list)
get_distinct_objects(input_list)

 
Data
        __version__ = '@(#)$Revision: 1.63 $'