common.services.calts package

Submodules

common.services.calts.CalibrationGraph module

Module with HTML Graph generators for the CalTS Graph View

class common.services.calts.CalibrationGraph.CalibrationGraph(parent, data)

Bases: object

Base class for generating Calibration Graphs, to be used in a html page

bar_height = 15
bar_width = 0
generate()

generate the Graph

graph_table_class = 'GraphTable'
classmethod initBar(background='', div_html='', height=15, left=-1, margin='1px 1px 1px 1px', other_args='', other_style='', width=0, zindex=0)

return initialized bar

classmethod initData(cal_type='', elements=None, heading=('', '', ''), dbview_url='', total_count=0)

initialize a data dict

classmethod initElement(text_left='', text_right='', bars=None)

return initialized element for the data

class common.services.calts.CalibrationGraph.CalibrationGraphDateObs(parent, data)

Bases: common.services.calts.CalibrationGraph.CalibrationGraph

class for generating DATE-OBS Calibration Graphs

bar_height = 15
generateBar(bar)

generate the bars part of the Graph

generateLegend(cal_type)

return the legend of the graph

classmethod initBar(**kwargs)

use the class variables for the initBar method

class common.services.calts.CalibrationGraph.CalibrationGraphTimestamps(parent, data)

Bases: common.services.calts.CalibrationGraph.CalibrationGraph

class for generating Timestamp Calibration Graphs

generateBar(bar)

generate the bars part of the Graph

generateLegend(cal_type)

return the legend of the graph

classmethod initBar(**kwargs)

use the class variables for the initBar method

class common.services.calts.CalibrationGraph.CalibrationGraphValidate(parent, data)

Bases: common.services.calts.CalibrationGraph.CalibrationGraph

class for generating Validate Calibration Graphs

bar_width = 13
generateBar(bar)

generate the bars part of the Graph

generateLegend(cal_type)

return the legend of the graph

classmethod initBar(**kwargs)

use the class variables for the initBar method

common.services.calts.HtmlCalibration module

File HtmlCalibration.py Author WJ Vriend (wjvriend[AT]astro.rug.nl)

CalTS base class definitions

exception common.services.calts.HtmlCalibration.CalibrationError

Bases: Exception

exception common.services.calts.HtmlCalibration.CalibrationNotSupportedError

Bases: common.services.calts.HtmlCalibration.CalibrationError

common.services.calts.HtmlCalibrationEdit module

File HtmlCalibrationEdit.py Author WJ Vriend (wjvriend[AT]astro.rug.nl)

exception common.services.calts.HtmlCalibrationEdit.CalibrationEditError

Bases: common.services.calts.HtmlCalibration.CalibrationError

class common.services.calts.HtmlCalibrationEdit.HtmlCalibrationEdit(args, parent=None)

Bases: common.services.general.HtmlBase.HtmlBase

This class generates html page for editing the timestamps and (un)setting the valid flag.

template file - CalibrationEdit.html.tmpl

CLOSEWIN = '<html><body onload="window.close();"></body></html>'
CLOSEWIN_REFRESH = '<html><body onload="window.opener.document.frmSelection.submit();window.close();"></body></html>'
ERROR_TEXT = 'An error has occured'
HTML_ERROR = '<html><body><h3>%s</h3><p>%%s</p></body></html>'
UPDATE_LOG = 'calts_sql_update.log'
URL_NAME = 'CalList'
check_date(a_date)

check if the given date is valid

check_dates(date_start, date_end)

check if the start date is before the end date

creation_date_1990 = datetime.datetime(1990, 1, 1, 0, 0)
forever_enabled = True
getDateObs(obj)

determine date obs to display

getFilename(obj)

Return the filename of the object

getHtml()

generate HTML, for selecting or updating

getIsValidSelectOptions()

Return the options for the is_valid select box Return two lists; what to show and the values

getMainTableCheckbox(obj, checked)

Return the checkbox definition in the table row

getMainTableCheckboxHeader(main_table_all_checked)

Return the checkbox definition in the table header

getMainTableContents()

return the contents for the main table(s)

getMainTableHeaders(objects, main_table_all_checked)

Return the headers of the main table

getMessages()

Return the messages to show

getObjectAttributes(obj)

return the attributes name and values of the object to show in the overview table return as [(‘name1’, ‘value1’), (‘name2’, ‘value2’), ..]

getTimestampEnd(obj)

Return the timestamp end value of the object

getTimestampStart(obj)

Return the timestamp start value of the object

classmethod get_url(class_str, object_id, server=None, project=None, privileges=None, full_url=True, hide_flagged=True)

return an url for the given class_str and object_id

classmethod is_retrievable(obj)

has this object a retrievable file associated

mainTableAllChecked(objects)

Should all entries in the main table be checked

max_comment_length = 20
max_length_elem = 45
oradate_format_long = "'DD-MM-YYYY HH24:MI:SS'"
oradate_format_short = "'DD-MM-YYYY'"
python_format_long = '%d-%m-%Y %T'
python_format_short = '%d-%m-%Y'
renderMainTable()

render the main Table

renderMainTableRow(obj, main_table_all_checked)

return the contents for the main table(s)

selectCalEdit()

retrieve calibration data from the database

classmethod supportsClass(class_string)

Does HtmlCalibrationEdit support the given class ?

updateCalEdit()

update calibration timestamps and is_valid to the DB

updatePrivileges()

update the privileges of the selected objects

use_in_template = False

common.services.calts.HtmlCalibrationGraph module

File HtmlCalibrationGraph.py Author WJ Vriend (wjvriend[AT]astro.rug.nl)

exception common.services.calts.HtmlCalibrationGraph.CalibrationGraphError

Bases: common.services.calts.HtmlCalibration.CalibrationError

class common.services.calts.HtmlCalibrationGraph.HtmlCalibrationGraph(args, parent=None)

Bases: common.services.general.HtmlBase.HtmlBase

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

template file - CalibrationGraph.html.tmpl

DbViewClass

alias of common.services.dbview.HtmlDbView.HtmlDbView

date_format_long = "'YYYY-MM-DD HH24:MI:SS'"
db_selects_default = ['object_id', 'ts_start', 'ts_end', 'creation', 'quality_flags', 'is_valid', 'attr1', 'attr2', 'filename', 'project', 'privileges', 'creator', 'nr_comments']
default_nr_db_selects = 13
determineBarBgColor(row)

return the background color of the bar

determineSubBarBgColor(row)

return the background color of the bar

classmethod formatDate(input_date)

format the date from the database as only date

classmethod formatDateTime(input_date)

format the date value from the database as date and time

formatTextTimestamp(row)

format the text shown on the left side of each timestamp row

classmethod format_attr1_attr2(attr1, attr2, count)

show attr1 and attr2 if not empty

getBarLayout(current_row, rs)

method returns lists which give the layout of the bars, which parts are eclipsed and which not

getCalibrationGraph()

Return the Calibration Graph class to generate the result, default the Timestamp Graph

getHtml()

generate HTML

getPlotDateObsAttrs()

return the attributes for the DateObs Graph

getPlotDateObsCounted()

Return what is counted in the Date Obs Graph

getSqlWhere()

construct the sql where statement also make query dict for dbview web service

getTooltipId(prefix='tooltip')

return unique tooltip id

classmethod isFlagged(row)

is the current row flagged ?

long_date_format = '%d %b %Y %H:%M:%S'
makePopupDateObs(count_what, count, table_rows)

return popup message for a date_obs element

makePopupTimestamps(row, extra_rows=[])

make popup table, to be shown in tooltip

makePopupTimestampsEclipsed(row, start, end)

return the popup message for the eclipsed period of a timestamp element

makePopupValidation(keys, values)

make a validation popup table for the given row

makeSqlDateObs(attr1, attr2, date_obs='DATE_OBS')

make the sql statement for raws with a date obs group by is on attr1 and/or attr2

makeSqlTimestamp()

construct the sql statement for timestamp based objects

min_width = 1.0
plotDateObsBars(graph_cls)

plot the graphical representation of objects with DATE_OBS attribute grouped per night and attr1/attr2 (ie chip/filter/template)

plotTimestampBars(graph_cls)

plot the graphical representation of the timestamps

prioritize(row)
This used to be translate_privileges which translated

privileges 1 = self, 2 = group, 3> = public return 0 for 1, 2 (private)

1 for 3, 4, 5 (public)

Now the prioritizing is done based on the project (project_favourite) the current project return 0 else return 1

project_favourite = False
short_date_format = '%d %b %Y'
use_in_template = True

common.services.calts.HtmlCalibrationQuality module

File HtmlCalibrationQuality.py Author WJ Vriend (wjvriend[AT]astro.rug.nl) Date Dec 2004

class common.services.calts.HtmlCalibrationQuality.HtmlCalibrationQuality(args)

Bases: common.services.general.HtmlBase.HtmlBase

‘ 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 HtmlComment.py - adding/viewing Comments

CLR_BACKGROUND = 'f5f5f5'
CLR_ECLIPSED = '000000'
CLR_QUAL = '9922cc'
CLR_USED1 = '44cc44'
CLR_USED2 = '33ccff'
CLR_VALID = 'dd2222'
CommentClass

alias of common.services.calts.HtmlComment.HtmlComment

DARKEN_FACTOR = 1.5
DefaultClass = ''
EditClass

alias of common.services.calts.HtmlCalibrationEdit.HtmlCalibrationEdit

GraphClass

alias of common.services.calts.HtmlCalibrationGraph.HtmlCalibrationGraph

TableClass

alias of common.services.calts.HtmlCalibrationTable.HtmlCalibrationTable

TimestampMax = datetime.datetime(2030, 12, 31, 0, 0)
TimestampMin = datetime.datetime(1990, 1, 1, 0, 0)
attr1_name = ''
attr2_name = ''
author_email = 'wjvriend@astro.rug.nl'
author_name = 'Willem-Jan Vriend'
classmethod displayClasses()

return the classes to display

classmethod generateInstrumentSelect(sel_instrument, valid_instruments=[])

generate html statements for the selects of a combo box with all (valid) instruments

classmethod generateMonthSelect(selected_month)

generate a html combo box for month selection

classmethod generateQuarterSelect(selected_quarter)

generate a html combo box for quarter selection

generateSelectionTable()

generate the Selection Table

classmethod generateWeekSelect(selected_week)

generate a html combo box for week selection

generateYearSelect()

Return the html combo box select options with all years to select Also set self.years to all selectable years.

getAttr1Value()

return the value of attr1, nifu

getAttr2Value()

return the value of attr2, ESO_INS_MODE

classmethod getClass(class_str)

return the class for the given class string

classmethod getClassText(class_str)

return the class text representation for the given class string

getCookies()

return a list of cookies

classmethod getDatesMonth(year, month)

return minimal and maximum date for the given month

classmethod getDatesQuarter(year, quarter)

return minimal and maximum date for the given quarter

classmethod getDatesWeek(year, week)

return minimal and maximum date for the given week from http://code.activestate.com/recipes/521915-start-date-and-end-date-of-given-week

classmethod getDatesYear(year)

return minimal and maximum date for the given year

getHeadExtra()

return extra html head statements, for example css or javsscript links

getHtml()

generate html

getInputYears()

return the years to select

classmethod getIntroText()

return the text to display on the intro page

classmethod getMinMaxDate(week, month, quarter, year)

get the minimum and maximum date from the input, used to query

classmethod getMonthLength(year, month)

get the length of the month in days

classmethod getProjectInstruments()

Return all projects together with the corresponding instrument

getSelectionTableElements()

return the elements to generate the Selection Table

getTimezoneDelta()

get the timezone delta (hour and minute)

classmethod hasFlags(cls_test)

does the cls_test have flags (ie is_valid or quality_flags)

hasInstrument(CalClass)

Is the given class instrument dependent ?

help_page = '/builds/omegacen/common/services/calts/static/Calts_Help.html'
initTemplate(tmpl)

initialize the template

privileges_dict = {1: 'private', 2: 'project', 3: 'public', 4: 'world'}
rendererGetHtml()

try calling the getHtml method of the renderer

setAttr1Value(value)

return the value of attr1, nifu

setAttr2Value(value)

return the value of attr2, ESO_INS_MODE

setView(view)

What view should we use; Graph or Table ?

top_heading = '<a href="http://portal.astro-wise.org">Astro-WISE Homepage</a>'
useDateSelection(tz_delta)

depending on the date selection use method to get min/max date

common.services.calts.HtmlCalibrationTable module

File HtmlCalibrationTable.py Author WJ Vriend (wjvriend[AT]astro.rug.nl) Date Dec 2004

exception common.services.calts.HtmlCalibrationTable.CalibrationTableError

Bases: common.services.calts.HtmlCalibration.CalibrationError

class common.services.calts.HtmlCalibrationTable.HtmlCalibrationTable(args, parent=None)

Bases: common.services.general.HtmlBase.HtmlBase

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

template file - CalibrationTable.html.tmpl

ERROR_HTML = '<html><body><h3>%s</h3><p>%%s</p></body></html>'
ERROR_TEXT = 'Error encountered:'
MAX_ROWS = 2000
date_format_long = "'DD-MM-YYYY HH24:MI:SS'"
date_format_long_disp = '%d %b %Y %T'
date_format_short_disp = '%d %b %Y'
extraTablePreHeaders()

return extra (pre) headers for the html table, that are headers after the comments column but before the regular headers

extraTablePreValues(row, count)

return extra elements for the table row

formatRowValue(col_name, col_value)

format the row value with given column name

getHtml()

generate html

getTableHeaders()

return the columns or headers for this table

getTableRows()

return all the rows to render in the html table, some columns are mandatory: (1) object_id, when using checkboxes and link to Edit form (2) filename, for link to Edit form (3) nr of comments

index_filename = 1
index_nr_comments = -1
index_object_id = 0
makeTableHeader()

make html table header

makeTableRow(row, count)

make a html table table row from the db row

make_all()

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

show_comments = True
use_in_template = True

common.services.calts.HtmlComment module

File HtmlCComment.py Author WJ Vriend (wjvriend[AT]astro.rug.nl) Date Apr 2005

class common.services.calts.HtmlComment.HtmlComment(args, parent=None)

Bases: common.services.general.HtmlBase.HtmlBase

This class generates the html page for viewing and adding comments.

template file - Comment.html.tmpl

CLOSEWIN = '<html><body onload="window.close();"></body></html>'
DBERROR_OBJ = '<html><body>ERROR in HtmlComment when selecting object, exception: %s</body></html>'
ERROR_CRERATING_COMMENT = '<html><body>ERROR in HtmlComment creating Comment; %s</body></html>'
ERROR_STR = 'ERROR in HtmlComment'
UNKNOWN = '<html><body>ERROR in HtmlComment; unknown operation</body></html>'
URL_NAME = 'CalList'
addComment()

get date and time from input and store comment

date_format_python = '%d-%m-%Y %H:%M:%S'
getHtml()

generate html

classmethod getPersistentComment()

Return the persistent Comment class

classmethod get_url(class_str, object_id, server=None, project=None, privileges=None, full_url=True)

return an url for the given class_str and object_id

showComments()
classmethod storeComment(caltype, object_id, content, user='', date=None)

store comment in the database

use_in_template = False

Module contents