|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.PropertyContainer
util.PropertyResources
util.PropertyBundles
mysql.AbstractSql
mysql.ObserveSql
public class ObserveSql
A class that allows static access to a database containing observational data of a target. It mainly consists the fits header keys of individual observations. IT is normally a table called obs defined in the following way:
Column | Type | Modifiers
-----------+-----------------------------+-----------
date | timestamp without time zone | not null
dateobs | timestamp without time zone | not null
instrument | smallint |
iversion | smallint |
exptime | real |
amplmode | character(8) |
pressure | real |
dettemp | real |
cryotemp | real |
austatus | smallint |
auseeing | real |
domestat | boolean |
observer | smallint |
transfered | boolean |
online | boolean |
filename | character varying(255) |
path | character varying(255) |
imagetyp | smallint |
object | character varying(255) |
telfocus | real |
objname | character varying(255) |
azimuth | real |
telalt | real |
ambtemp | real |
relhum | real |
maxwind | real |
telescop | character(8) |
naquire | smallint |
guideloss | real |
tempm1 | real |
tempm2 | real |
avrgwind | real |
winddir | real |
atmpress | real |
dewpoint | real |
aumiss | real |
seseff | real |
snest | real |
aulight | real |
aulign | real |
objid | character varying(255) |
azfirst | real |
altfirst | real |
aztotal | real |
ztotal | real |
ADU_av | real |
ADU_var | real |
ADU_CNM3 | real |
ADU_CNM4 | real |
ADU_CNM5 | real |
ADU_CNM6 | real |
FILTER | character(8) |
TELDEROT | real |
EXPID | integer |
TARGETID | character varying(255) |
Indexes:
"obs_pkey" primary key, btree (dateobs)
The fields mean the following:
HistorySql.TargetSqlHistorySql
| Nested Class Summary | |
|---|---|
static class |
ObserveSql.Adu
Connects to the database and returns the ADU statistic for all files of the stated telescope. |
static class |
ObserveSql.Duplicates
Removes double entries in the obs table, which slipped into it during psql upgrade in Feb. |
static class |
ObserveSql.Extract
A class to retrive columns from a database and output it into an ascii-file for e.g. |
static class |
ObserveSql.FitsParse
Only in debug mode, we read the fits file and print out what would be entered. |
static class |
ObserveSql.Flat
Connects to the database and tries to find flats with a stuck filterwheel. |
static class |
ObserveSql.Retrieve
Connects to the database and gets all values for the given unique object ID. |
static class |
ObserveSql.Tomato
Connects to the database and tries to find flats with a stuck filterwheel. |
static class |
ObserveSql.Transfer
To make sure that fits in the transfered directory has been correctly entered into the db. |
static class |
ObserveSql.Types
Enum version of image types. |
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
static String |
BIASTYPE
The image type qualifier for scientific observations. |
static String |
CALIBRATIONTYPE
The image type qualifier for scientific observations. |
static String |
DARKTYPE
The image type qualifier for scientific observations. |
private static String |
DEFADU1
The key to the field name for the ADU moment of that order. |
private static String |
DEFADU2
The key to the field name for the ADU moment of that order. |
private static String |
DEFADU3
The key to the field name for the ADU moment of that order. |
private static String |
DEFADU4
The key to the field name for the ADU moment of that order. |
private static String |
DEFADU5
The key to the field name for the ADU moment of that order. |
private static String |
DEFADU6
The key to the field name for the ADU moment of that order. |
private static String |
DEFDATEOBSFIELD
The default target name field in the database |
private static String |
DEFEXPID
The key to the unique exposure identifier. |
private static String |
DEFEXPTIMEFIELD
The default target name field in the database |
private static String |
DEFFILENAME
The key to the filename field. |
private static String |
DEFFILTER
The key to color filter used. |
private static String |
DEFIMAGETYP
The key to the image type integer field. |
private static String |
DEFIMAGETYPEFIELD
The default target name field in the database |
private static String |
DEFINSTRUMENT
The key to the unique exposure identifier. |
private static String |
DEFIVERSION
The key to the unique exposure identifier. |
private static String |
DEFOBSERVER
The key to the observer integer field. |
private static String |
DEFPATH
The key to the path field. |
private static String |
DEFSIMBADNAMEFIELD
The default simbad name field in the database |
private static String |
DEFTABLE
The default table name. |
private static String |
DEFTARGETNAMEFIELD
The default target name field in the database |
private static String |
DEFTARGETUNIQUE
The key to the unique target identifier. |
private static String |
DEFTELDEROT
The key to color filter used. |
private static String |
DEFTELESCOPEFIELD
The default target name field in the database |
private static String |
DEFTRANSFERRED
The key to the trasnferred field. |
private static String |
DEFUNIQUEFIELD
The default target name field in the database |
static String |
FLATFIELDTYPE
The image type qualifier for scientific observations. |
private static Map<String,Integer> |
IMAGETYPES
Mapping of image type numbers to image type qualifiers. |
static String |
INSTRUME
The header key holding instrument and version number as a string. |
private static Map<String,Integer> |
INSTYPES
Mapping of instrument names to instrument type qualifiers. |
static String |
KEY_ADU1
The key to the field name for the ADU moment of that order. |
static String |
KEY_ADU2
The key to the field name for the ADU moment of that order. |
static String |
KEY_ADU3
The key to the field name for the ADU moment of that order. |
static String |
KEY_ADU4
The key to the field name for the ADU moment of that order. |
static String |
KEY_ADU5
The key to the field name for the ADU moment of that order. |
static String |
KEY_ADU6
The key to the field name for the ADU moment of that order. |
static String |
KEY_DATEOBSFIELD
The key to the target name in the database. |
static String |
KEY_EXPID
The key to the unique exposure identifier. |
static String |
KEY_EXPTIMEFIELD
The key to the target name in the database. |
static String |
KEY_FILENAME
The key to the filename field. |
static String |
KEY_FILTER
The key to the field name for the ADU moment of that order. |
static String |
KEY_IMAGETYP
The key to the image type integer field. |
static String |
KEY_IMAGETYPEFIELD
The key to the imagetype field. |
static String |
KEY_INSTRUMENT
The key to the instrument int. |
static String |
KEY_IVERSION
The key to the instrument version. |
static String |
KEY_LOCALNFS
A mapping of archive path to local accessible ones. |
static String |
KEY_OBSERVER
The key to the observer integer field. |
static String |
KEY_PATH
The key to the path field. |
static String |
KEY_SIMBADNAMEFIELD
The key to the Simbad object name in the database. |
static String |
KEY_TARGETNAMEFIELD
The key to the target name in the database. |
static String |
KEY_TARGETUNIQUE
The key to the unique target identifier. |
static String |
KEY_TELDEROT
The key to the field name for the ADU moment of that order. |
static String |
KEY_TELESCOPEFIELD
The key to the telescope name in the database. |
static String |
KEY_TRANSFERRED
The key to the transferred field. |
static String |
KEY_UNIQUEFIELD
The key to the unique observation ID in the database. |
private static Map<String,String> |
KEYCOLUMN
Mapping of HDU header keys to column names. |
static String |
PREFIX_ADU
The prefix for the ADU keys. |
static String |
SCIENCETYPE
The image type qualifier for scientific observations. |
static String |
SKYTYPE
The image type qualifier for sky observations. |
static String |
UNKNOWNTYPE
The image type qualifier for scientific observations. |
| Fields inherited from class mysql.AbstractSql |
|---|
KEY_TABLE |
| Fields inherited from class util.PropertyBundles |
|---|
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES |
| Fields inherited from class util.PropertyResources |
|---|
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset |
| Fields inherited from class util.PropertyContainer |
|---|
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR |
| Fields inherited from interface util.ResourceSupplying |
|---|
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME |
| Fields inherited from interface util.PropertySupplying |
|---|
CONFIG, KEY_CLASS |
| Constructor Summary | |
|---|---|
ObserveSql(Map<String,String> prop)
Sets the properties of the history database and adds my defaults. |
|
| Method Summary | |
|---|---|
boolean |
enterFits(String unique,
File fits)
Grabs a fits file and enters all fields it can, if this is the first encounter of the exposure. |
boolean |
enterFits(String unique,
File fits,
boolean force)
Grabs a fits file and enters all fields it can. |
float[] |
getAduArray(String unique,
String adufield)
Retrieves an sql-array with the specified field name as a primitive float[]. |
static float[] |
getAduArray(String table,
String ufield,
String uval,
String adufield)
Static version, specfying also table and field name. |
static Date |
getDateFromUnique(String unique)
Gets the dateobs-field for the specified unique. |
static Date |
getDateFromUnique(String unique,
String ufield,
String dfield)
Gets the dateobs-field for the specified unique. |
private int |
getExpId(File fits)
Get exposure id from file name. |
static File |
getFileFromUnique(String unique)
Gets the file name from the object id. |
static File |
getFileFromUnique(String unique,
String ufield,
String pfield,
String ffield)
Gets the file name from the object id. |
Date |
getLastScienceObservation(String tel,
String filter)
Returns the date the questioned filter was last observed on the specified telescope. |
File |
getLocalFileFromUnique(String unique)
From the path and filename saved in the db, we have the possibility to divert to a local file name, if the nfs property is set. |
Object |
getMapping(String unique,
String field)
Returns the mapping of the requested column names to the stated unique in the obs table. |
Map<String,Object> |
getMappings(String unique,
Collection<String> f)
Returns the mapping of the requested column names to the stated unique in the obs table. |
private String |
getObjid(String unique,
File fits)
Returns the unique objid from the unique target id and a file name. |
Map<String,Map<String,Object>> |
getObservationForPick(String unique)
Returns a mapping of columns names to parsed java objects for the required unique pick id |
private Map<String,Map<String,Object>> |
getObservationMappings(Date from,
Date to,
Integer type,
String tel,
String add)
Returns a mapping of unique ID's to observational parameters (as maps) for all observations between the stated dates. |
Map<String,Map<String,Object>> |
getObservations(Date from,
Date to)
Returns a mapping of unique ID's to observational parameters (as maps) for all observations between the stated dates. |
Map<String,Map<String,Object>> |
getObservations(Date from,
Date to,
int type)
Returns a mapping of unique ID's to observational parameters (as maps) for all observations between the stated dates. |
Map<String,Map<String,Object>> |
getObservations(Date from,
Date to,
int type,
String t)
Returns a mapping of unique ID's to observational parameters (as maps) for all observations between the stated dates. |
Map<String,Map<String,Object>> |
getObservations(Date from,
Date to,
int type,
String t,
String additional)
Returns a mapping of unique ID's to observational parameters (as maps) for all observations between the stated dates. |
Map<String,Map<String,Object>> |
getObservations(Date from,
Date to,
String type)
Returns a mapping of unique ID's to observational parameters (as maps) for all observations between the stated dates. |
private Map<String,Object> |
headerInfo(nom.tam.fits.Header h)
We read all key/value pair in the header and then try to get values to the entries in KEYCOLUMN. |
boolean |
isFitsEntry(String unique,
File fits)
Test, if for a given file an entry already exists in the table. |
boolean |
removeObservationFromDatabase(String unique)
Removes an entry from the observe db if the unique specifier is given. |
private Map<String,Map<String,Object>> |
resultToMapping(ResultSet rs)
We take a result set and convert each row into a mapping of column names to Java objects. |
| Methods inherited from class mysql.AbstractSql |
|---|
getPassword, getTable, getUserName, init, isEntry |
| Methods inherited from class util.PropertyBundles |
|---|
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource |
| Methods inherited from class util.PropertyResources |
|---|
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet |
| Methods inherited from class util.PropertyContainer |
|---|
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface util.ResourceSupplying |
|---|
getResource, getResourceAsStream, getResources |
| Methods inherited from interface util.PropertySupplying |
|---|
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties |
| Field Detail |
|---|
public static final String INSTRUME
public static final String SKYTYPE
public static final String SCIENCETYPE
public static final String FLATFIELDTYPE
public static final String CALIBRATIONTYPE
public static final String BIASTYPE
public static final String DARKTYPE
public static final String UNKNOWNTYPE
public static final String KEY_UNIQUEFIELD
public static final String KEY_TARGETNAMEFIELD
public static final String KEY_TELESCOPEFIELD
public static final String KEY_DATEOBSFIELD
public static final String KEY_EXPTIMEFIELD
public static final String KEY_IMAGETYPEFIELD
public static final String KEY_SIMBADNAMEFIELD
public static final String KEY_TARGETUNIQUE
public static final String KEY_EXPID
public static final String KEY_INSTRUMENT
public static final String KEY_IVERSION
public static final String KEY_FILENAME
public static final String KEY_PATH
public static final String KEY_TRANSFERRED
public static final String KEY_OBSERVER
public static final String KEY_IMAGETYP
public static final String KEY_ADU1
public static final String KEY_ADU2
public static final String KEY_ADU3
public static final String KEY_ADU4
public static final String KEY_ADU5
public static final String KEY_ADU6
public static final String KEY_FILTER
public static final String KEY_TELDEROT
public static final String KEY_LOCALNFS
public static final String PREFIX_ADU
private static final Map<String,String> KEYCOLUMN
private static final Map<String,Integer> IMAGETYPES
private static final Map<String,Integer> INSTYPES
private static final String DEFTABLE
private static final String DEFTELESCOPEFIELD
private static final String DEFTARGETNAMEFIELD
private static final String DEFSIMBADNAMEFIELD
private static final String DEFUNIQUEFIELD
private static final String DEFDATEOBSFIELD
private static final String DEFEXPTIMEFIELD
private static final String DEFIMAGETYPEFIELD
private static final String DEFINSTRUMENT
private static final String DEFIVERSION
private static final String DEFFILENAME
private static final String DEFPATH
private static final String DEFTRANSFERRED
private static final String DEFOBSERVER
private static final String DEFIMAGETYP
private static final String DEFADU1
private static final String DEFADU2
private static final String DEFADU3
private static final String DEFADU4
private static final String DEFADU5
private static final String DEFADU6
private static final String DEFTARGETUNIQUE
private static final String DEFEXPID
private static final String DEFFILTER
private static final String DEFTELDEROT
| Constructor Detail |
|---|
public ObserveSql(Map<String,String> prop)
| Method Detail |
|---|
public final boolean removeObservationFromDatabase(String unique)
public Map<String,Map<String,Object>> getObservationForPick(String unique)
public Map<String,Map<String,Object>> getObservations(Date from,
Date to)
public Map<String,Map<String,Object>> getObservations(Date from,
Date to,
String type)
public Map<String,Map<String,Object>> getObservations(Date from,
Date to,
int type)
public Map<String,Map<String,Object>> getObservations(Date from,
Date to,
int type,
String t)
public Map<String,Map<String,Object>> getObservations(Date from,
Date to,
int type,
String t,
String additional)
private Map<String,Map<String,Object>> getObservationMappings(Date from,
Date to,
Integer type,
String tel,
String add)
public Date getLastScienceObservation(String tel,
String filter)
select dateobs from obs where telescop='STELLA1' and
"FILTER" = 'rp' and imagetyp = 1 order by dateobs desc
private String getObjid(String unique,
File fits)
private int getExpId(File fits)
public Object getMapping(String unique,
String field)
public Map<String,Object> getMappings(String unique,
Collection<String> f)
public static Date getDateFromUnique(String unique)
throws SQLException,
ConnectException
SQLException
ConnectException
public static Date getDateFromUnique(String unique,
String ufield,
String dfield)
throws SQLException,
ConnectException
SQLException
ConnectException
public File getLocalFileFromUnique(String unique)
throws SQLException,
ConnectException
SQLException
ConnectException
public static File getFileFromUnique(String unique)
throws SQLException,
ConnectException
SQLException
ConnectException
public static File getFileFromUnique(String unique,
String ufield,
String pfield,
String ffield)
throws SQLException,
ConnectException
SQLException
ConnectException
public float[] getAduArray(String unique,
String adufield)
throws SQLException,
ConnectException
ArrayTool.
SQLException
ConnectException
public static float[] getAduArray(String table,
String ufield,
String uval,
String adufield)
throws SQLException,
ConnectException
SQLException
ConnectException
public boolean isFitsEntry(String unique,
File fits)
throws SQLException,
ConnectException
SQLException
ConnectException
public boolean enterFits(String unique,
File fits)
throws SQLException,
ConnectException
SQLException
ConnectException
public boolean enterFits(String unique,
File fits,
boolean force)
throws SQLException,
ConnectException
force - If true, we overwrite an old entry with same objid
SQLException
ConnectExceptionprivate Map<String,Object> headerInfo(nom.tam.fits.Header h)
KEYCOLUMN. All non-null values are parsed to
appropriate objects and put as values to the column names.
private final Map<String,Map<String,Object>> resultToMapping(ResultSet rs)
throws SQLException
SQLException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||