astro.services.pubs package

Submodules

astro.services.pubs.HtmlPubs module

File HtmlCalibration.py Author WJ Vriernd (wjvriend@astro.rug.nl) Date Jan 2005

class astro.services.pubs.HtmlPubs.HtmlPubs(args, package_file)

Bases: common.services.general.HtmlBase.HtmlBase

Base class for Html Pubs classes. Contains all the different calibration types, their names and table names. Furthermore some common date functions.

This class should NOT be instantiated

ASSOCIATELIST = 'AssociateList'
ASTROMETRICPARS = 'AstrometricParameters'
BIAS = 'BiasFrame'
COADDEDFRAME = 'CoaddedRegriddedFrame'
COLDPIXEL = 'ColdPixelMap'
CalTypesObjects = {'AssociateList': <class 'astro.main.AssociateList.AssociateList'>, 'AstrometricParameters': <class 'astro.main.AstrometricParameters.AstrometricParameters'>, 'BiasFrame': <class 'astro.main.BiasFrame.BiasFrame'>, 'CoaddedRegriddedFrame': <class 'astro.main.RegriddedFrame.CoaddedRegriddedFrame'>, 'ColdPixelMap': <class 'astro.main.ColdPixelMap.ColdPixelMap'>, 'DomeFlatFrame': <class 'astro.main.DomeFlatFrame.DomeFlatFrame'>, 'FringeFrame': <class 'astro.main.FringeFrame.FringeFrame'>, 'GainLinearity': <class 'astro.main.GainLinearity.GainLinearity'>, 'HotPixelMap': <class 'astro.main.HotPixelMap.HotPixelMap'>, 'IlluminationCorrection': <class 'astro.main.IlluminationCorrection.IlluminationCorrection'>, 'IlluminationCorrectionFrame': <class 'astro.main.IlluminationCorrectionFrame.IlluminationCorrectionFrame'>, 'MasterFlatFrame': <class 'astro.main.MasterFlatFrame.MasterFlatFrame'>, 'NightSkyFlatFrame': <class 'astro.main.NightSkyFlatFrame.NightSkyFlatFrame'>, 'PhotSrcCatalog': <class 'astro.main.PhotSrcCatalog.PhotSrcCatalog'>, 'PhotTransformation': <class 'astro.main.PhotTransformation.PhotTransformation'>, 'PhotometricParameters': <class 'astro.main.PhotometricParameters.PhotometricParameters'>, 'QuickCheckFrame': <class 'astro.main.QuickCheckFrame.QuickCheckFrame'>, 'RawBiasFrame': <class 'astro.main.RawFrame.RawBiasFrame'>, 'RawDarkFrame': <class 'astro.main.RawFrame.RawDarkFrame'>, 'RawDomeFlatFrame': <class 'astro.main.RawFrame.RawDomeFlatFrame'>, 'RawScienceFrame': <class 'astro.main.RawFrame.RawScienceFrame'>, 'RawTwilightFlatFrame': <class 'astro.main.RawFrame.RawTwilightFlatFrame'>, 'ReadNoise': <class 'astro.main.ReadNoise.ReadNoise'>, 'ReducedScienceFrame': <class 'astro.main.ReducedScienceFrame.ReducedScienceFrame'>, 'RegriddedFrame': <class 'astro.main.RegriddedFrame.RegriddedFrame'>, 'SourceList': <class 'astro.main.SourceList.SourceList'>, 'TwilightFlatFrame': <class 'astro.main.TwilightFlatFrame.TwilightFlatFrame'>}
CalTypesValues = {'AssociateList': ' AssociateList', 'AstrometricParameters': ' AstrometricParameters', 'BiasFrame': '541 Master Bias', 'CoaddedRegriddedFrame': ' CoaddedRegriddedFrame', 'ColdPixelMap': '535 Cold Pixelmap', 'DomeFlatFrame': '542 Master Domeflat', 'FringeFrame': '545 Fringe flat', 'GainLinearity': '523 CCD Gain', 'HotPixelMap': '522 Hot Pixelmap', 'IlluminationCorrection': '548F Illumination Coef.', 'IlluminationCorrectionFrame': '548 Illumination', 'MasterFlatFrame': '546 Master Flatfield', 'NightSkyFlatFrame': '544 Nightsky Flat', 'PhotSrcCatalog': '562T Photometric Catalog', 'PhotTransformation': '565 Band pass transformation', 'PhotometricParameters': '563 Photometric Parameters', 'QuickCheckFrame': ' QuickCheckFrame', 'RawBiasFrame': '631 RawBiasFrame', 'RawDarkFrame': '631 RawDarkFrame', 'RawDomeFlatFrame': '631 RawDomeFlatFrame', 'RawScienceFrame': '631 RawScienceFrame', 'RawTwilightFlatFrame': '631 RawTwilightFlatFrame', 'ReadNoise': '521 Readout Noise', 'ReducedScienceFrame': ' ReducedScienceFrame', 'RegriddedFrame': ' RegriddedFrame', 'SourceList': ' SourceList', 'TwilightFlatFrame': '543 Master Twilightflat'}
DOMEFLAT = 'DomeFlatFrame'
FRINGE = 'FringeFrame'
GAIN = 'GainLinearity'
HOTPIXEL = 'HotPixelMap'
ILLUMINATION = 'IlluminationCorrectionFrame'
ILLU_COEF = 'IlluminationCorrection'
MASTERFLAT = 'MasterFlatFrame'
NIGHTSKY = 'NightSkyFlatFrame'
PHOTOMETRIC = 'PhotometricParameters'
PHOTSRCCAT = 'PhotSrcCatalog'
PHOTTRANS = 'PhotTransformation'
QUICKCHECK = 'QuickCheckFrame'
RAWBIASFRAME = 'RawBiasFrame'
RAWDARKFRAME = 'RawDarkFrame'
RAWDOMEFLATFRAME = 'RawDomeFlatFrame'
RAWSCIENCEFRAME = 'RawScienceFrame'
RAWTWILIGHTFRAME = 'RawTwilightFlatFrame'
READNOISE = 'ReadNoise'
REDUCEDSCIENCEFRAME = 'ReducedScienceFrame'
REGRIDDEDFRAME = 'RegriddedFrame'
SOURCELIST = 'SourceList'
TWILIGHT = 'TwilightFlatFrame'
TimestampMax = datetime.datetime(2030, 12, 31, 0, 0)
TimestampMin = datetime.datetime(1990, 1, 1, 0, 0)
classmethod getMinMaxDate(week, month, quarter, year)
astro.services.pubs.HtmlPubs.getDatesMonth(year, month)

return minimal and maximum date for the given month

astro.services.pubs.HtmlPubs.getDatesQuarter(year, quarter)

return minimal and maximum date for the given quarter

astro.services.pubs.HtmlPubs.getDatesWeek(year, week)

return minimal and maximum date for the given week

astro.services.pubs.HtmlPubs.getDatesYear(year)

return minimal and maximum date for the given year

astro.services.pubs.HtmlPubs.getMonthLength(year, month)

get the length of the month in days

astro.services.pubs.HtmlPubsCore module

File HtmlCalibrationQuality.py Author WJ Vriernd (wjvriend@astro.rug.nl) Date Dec 2004

class astro.services.pubs.HtmlPubsCore.HtmlPubsCore(args)

Bases: astro.services.pubs.HtmlPubs.HtmlPubs

‘ Description: Script reads a html template file and fills variables. The html file file is the main GUI for adjusting timestamps of calibration files. The rendering of the calibartion data is done by two scripts; graphical or tabular. The editing of timestamp is done by a seperate template file.

Dependencies: CalibrationQuality.html.tmpl - main template file HtmlCalibrationGraph.py - graphical rendering HtmlCalibrationTable.py - tabular rendering HtmlCalibrationEdit.py - editing timestamps

ASKFORUSER_TEXT = '\n<h2>Please, insert valid user for this project</h2>\n'
DISPLAY_TYPES_PM = ['ReducedScienceFrame', 'RegriddedFrame', 'CoaddedRegriddedFrame', 'SourceList', 'AssociateList']
DISPLAY_TYPES_USER = ['ReadNoise', 'BiasFrame', 'GainLinearity', 'HotPixelMap', '<tr><td><hr>', 'ColdPixelMap', 'DomeFlatFrame', 'TwilightFlatFrame', 'FringeFrame', 'NightSkyFlatFrame', 'MasterFlatFrame', '<tr><td><hr>', 'PhotSrcCatalog', 'PhotometricParameters', 'PhotTransformation', 'IlluminationCorrectionFrame', 'IlluminationCorrection', '<tr><td><hr>', 'RawBiasFrame', 'RawDarkFrame', 'RawDomeFlatFrame', 'RawScienceFrame', 'RawTwilightFlatFrame', '<tr><td><hr>', 'ReducedScienceFrame', 'RegriddedFrame', 'CoaddedRegriddedFrame', 'SourceList', 'AssociateList']
HR = '<tr><td><hr>'
INTRO_TEXT = '\n<h2>This is the first version of Pubs</h2>\n<p>For a quick start:</p>\n<ul>\n<li>select a project and possibly an instrument\n<li>and a chip, filter and date from the top menu\n<li>and then a object from the left menu\n</ul>\n<p>\nThis service displays the timestamps and flags of objects in the database. These can be edited and changed, but you need to be logged in for this. To log in click on the username next to DB user in the upper left part of the screen. For most objects it is also to possible to add a comment, or view existing comments. To add a comment press the + or * sign right of the timestamps. If there is an\nimage associated with the object an I is plotted next to the comment indicator, linking to the image.<br>\n</p>\nChanges:\n<ul>\n<li>\n</ul>\n'
REJECTUSER_TEXT = '\n<h2>You are not allowed to use this role with this user</h2>\n'
TYPES_HEADER = '<tr><th>Object type'
WRONG_OBJECT = 'Plot option can not be implemented for this object'
generateYearSelect()

select all distinct years from timestamp_start and timestamp_end or date_obs or creation_date

getHtml()
astro.services.pubs.HtmlPubsCore.generateChipSelect(instrument, sel_chip)

generate html statements for a list / select box for all chips

astro.services.pubs.HtmlPubsCore.generateFilterSelect(instrument, sel_filter)

generate html statements for a list / select box for all filters

astro.services.pubs.HtmlPubsCore.generateInstrumentSelect(sel_instrument)

generate html statements for a list / select box for all instruments

astro.services.pubs.HtmlPubsCore.generateMonthSelect(selected_month)
astro.services.pubs.HtmlPubsCore.generatePrivateProjectSelect(sel_project)
astro.services.pubs.HtmlPubsCore.generateProjectSelect(priveleges, sel_project)
astro.services.pubs.HtmlPubsCore.generatePublicProjectSelect(sel_project)
astro.services.pubs.HtmlPubsCore.generateQuarterSelect(selected_quarter)
astro.services.pubs.HtmlPubsCore.generateWeekSelect(selected_week)
astro.services.pubs.HtmlPubsCore.setProjectInstrumentArray(template)

astro.services.pubs.HtmlPubsGraph module

File HtmlCalibrationGraph.py Author WJ Vriernd (wjvriend@astro.rug.nl) Date Dec 2004

class astro.services.pubs.HtmlPubsGraph.HtmlPubsGraph(args)

Bases: astro.services.pubs.HtmlPubs.HtmlPubs

This class generates the graphical data for calts in html format.

template file - PubsGraph.html.tmpl

BARS_WIDTH_1024 = 534
BARS_WIDTH_1280 = 790
BARS_WIDTH_800 = 310
CLR_BACKGROUND = 'f5f5f5'
CLR_ECLIPSED = '000000'
CLR_QUAL = '9922cc'
CLR_SUPER = 'dd2222'
CLR_USED = '44cc44'
CLR_VO = '00cc00'
DARKEN_FACTOR = 1.5
DBERROR = '<html><body>ERROR, database exception: %s</body></html>'
HTML_OVERLIB = 'onmouseover="return overlib(\'%s\', CAPTION, \'Details\');" onmouseout="return nd();"'
I_CHIP = 6
I_CREATION = 3
I_FILENAME = 8
I_FILTER = 7
I_NRCOMMENTS = 11
I_OBJID = 0
I_PRIVILEGE = 10
I_PROJECT = 9
I_QUAL = 4
I_SUPER = 5
I_TS_END = 2
I_TS_START = 1
MAX_ROWS = 1000
OraDate(ora_date)

make a datetime (date part) object from an oracle date

OraDateTime(ora_date)

make a datetime (time part) object from an oracle date

bars_height = 15
bars_left = 195
bars_top = 0
bars_width = 790
date_format_long = "'DD-MM-YYYY HH24:MI:SS'"
formatDate(input_date)

format the date values from the database

getBarLayout(elem, rs, ts_min, ts_max)
getHtml()
getMaxDate(lst)

return the maximum date from a list

getMinDate(lst)

return the maximum date from a list

is_numeric(num)

test for begin numeric

makePopupText(rec)
makePopupTextEclipsed(rec, start, end)

return the popup message for the eclipsed period

makeSql(ts_low, ts_high)
plotBackBar(tmpl, top, left, bar_width)
plotBar(tmpl, qual_flags, super_flag, top, left, bar_width, bar_text, privilege)
plotSubBar(tmpl, qual_flags, super_flag, top, left, bar_width, bar_text, privilege)
plotTextCD(tmpl, top, left, bar_text, table_row)

plot the creation date

plotTextTS(tmpl, count, table_row, top, bar_text)

plot the timestamp start - end and comment indicator

astro.services.pubs.HtmlPubsPlot module

File HtmlCalibrationTable.py Author WJ Vriernd (wjvriend@astro.rug.nl) Date Dec 2004

class astro.services.pubs.HtmlPubsPlot.HtmlPubsPlot(args)

Bases: astro.services.pubs.HtmlPubs.HtmlPubs

This class generates the tabular data for calts in html format.

template file - CalibrationTable.html.tmpl

COLUMNS = [['Filename', 't."filename"', 'object_id'], ['Object', 't."OBJECT#"', 'OBJECT'], ['Name', 't."name"', 'name'], ['Chip', 't."chip"."name"', 'chip'], ['Filter', 't."filter"."name"', 'filter'], ['Observation', 't."DATE_OBS"', 'DATE_OBS'], ['Creation', 't."creation_date"', 'creation_date'], ['Start', 't."timestamp_start"', 'timestamp_start'], ['End', 't."timestamp_end"', 'timestamp_end'], ['Super flag', 't."is_valid"', 'is_valid'], ['Quality flag', 't."quality_flags"', 'quality_flags'], ['Project', 't."+PROJECT"', 'object_id'], ['ULRA', 't."ulRA"', '+'], ['ULDEC', 't."ulDEC"', '+'], ['URRA', 't."urRA"', '+'], ['URDEC', 't."urDEC"', '+'], ['LRRA', 't."lrRA"', '+'], ['LRDEC', 't."lrDEC"', '+'], ['LLRA', 't."llRA"', '+'], ['LLDEC', 't."llDEC"', '+']]
ERROR = '<html><body>ERROR: %s</body></html>'
I_CHIP = 8
I_CREATION = 1
I_DATEOBS = 7
I_FILENAME = 5
I_FILTER = 9
I_NAME = 13
I_OBJECT = 12
I_OBJID = 0
I_PRIVILEGES = 11
I_PROJECT = 10
I_QUALFLAG = 4
I_SUPERFLAG = 6
I_TS_END = 3
I_TS_START = 2
MAX_ROWS = 50
date_format_long = "'DD-MM-YYYY HH24:MI:SS'"
date_format_long_disp = "'DD-Mon-YYYY HH24:MI:SS'"
date_format_short_disp = "'DD-Mon-YYYY'"
getHtml()

generate html

getWhere()

get the where statement and all where arguments

href = 'http://pubs.test.astro-wise.org:18892/?'
make_all()

loop through all input args, those with name elem_<object_id> make valid/invalid as specified in make_what

astro.services.pubs.HtmlPubsTable module

File HtmlCalibrationTable.py Author WJ Vriernd (wjvriend@astro.rug.nl) Date Dec 2004

class astro.services.pubs.HtmlPubsTable.HtmlPubsTable(args)

Bases: astro.services.pubs.HtmlPubs.HtmlPubs

This class generates the tabular data for calts in html format.

template file - CalibrationTable.html.tmpl

COLUMNS = [['Filename', 't."filename"', 'object_id'], ['Object', 't."OBJECT#"', 'OBJECT'], ['Name', 't."name"', 'name'], ['Chip', 't."chip"."name"', 'chip'], ['Filter', 't."filter"."name"', 'filter'], ['Observation', 't."DATE_OBS"', 'DATE_OBS'], ['Creation', 't."creation_date"', 'creation_date'], ['Start', 't."timestamp_start"', 'timestamp_start'], ['End', 't."timestamp_end"', 'timestamp_end'], ['Super flag', 't."is_valid"', 'is_valid'], ['Quality flag', 't."quality_flags"', 'quality_flags'], ['Project', 't."+PROJECT"', 'object_id'], ['Privileges', 't."+PRIVILEGES"', 'object_id']]
ERROR = '<html><body>ERROR: %s</body></html>'
I_CHIP = 8
I_CREATION = 1
I_DATEOBS = 7
I_FILENAME = 5
I_FILTER = 9
I_NAME = 13
I_OBJECT = 12
I_OBJID = 0
I_PRIVILEGES = 11
I_PROJECT = 10
I_QUALFLAG = 4
I_SUPERFLAG = 6
I_TS_END = 3
I_TS_START = 2
MAX_ROWS = 100
date_format_long = "'DD-MM-YYYY HH24:MI:SS'"
date_format_long_disp = "'DD-Mon-YYYY HH24:MI:SS'"
date_format_short_disp = "'DD-Mon-YYYY'"
getHtml()

generate html

getWhere()

get the where statement and all where arguments

make_privileges_down()

loop through all input args, those with name elem_<object_id> make valid/invalid as specified in make_what

make_privileges_up()

loop through all input args, those with name elem_<object_id> make valid/invalid as specified in make_what

make_vo()

loop through all input args, those with name elem_<object_id> make valid/invalid as specified in make_what

Module contents