Facility Modules (UKIRT)

hedwig.facility.ukirt.calculator_imag_phot

class hedwig.facility.ukirt.calculator_imag_phot.SkyCondition(id_, name)
_asdict()

Return a new dict which maps field names to their values.

_field_defaults = {}
_fields = ('id_', 'name')
classmethod _make(iterable)

Make a new SkyCondition object from a sequence or iterable

_replace(**kwds)

Return a new SkyCondition object replacing specified fields with new values

id_

Alias for field number 0

name

Alias for field number 1

class hedwig.facility.ukirt.calculator_imag_phot.SourceType(name, options)
_asdict()

Return a new dict which maps field names to their values.

_field_defaults = {}
_fields = ('name', 'options')
classmethod _make(iterable)

Make a new SourceType object from a sequence or iterable

_replace(**kwds)

Return a new SourceType object replacing specified fields with new values

name

Alias for field number 0

options

Alias for field number 1

class hedwig.facility.ukirt.calculator_imag_phot.ImagPhotCalculator(*args)
CALC_TIME = 1
CALC_MAG = 2
CALC_SNR = 3
modes = {1: ('time', 'Integration time required'), 2: ('mag', 'Magnitude for given time and SNR'), 3: ('snr', 'SNR for given time and magnitude')}
instruments = {'UFTI': ukirt_itc.UKIRTImagPhotITC.UFTI, 'UIST': ukirt_itc.UKIRTImagPhotITC.UIST, 'WFCAM': ukirt_itc.UKIRTImagPhotITC.WFCAM}
sky_conditions = {'bright': (ukirt_itc.UKIRTImagPhotITC.SKY_BRIGHT, 'Bright'), 'dark': (ukirt_itc.UKIRTImagPhotITC.SKY_DARK, 'Dark'), 'grey': (ukirt_itc.UKIRTImagPhotITC.SKY_GREY, 'Grey')}
source_types = {'ext': ('Extended', {'is_extended': True}), 'pnt': ('Point source', {'is_extended': False})}
limiting_factors = {ukirt_itc.UKIRTImagPhotITC.LIMIT_BACKGROUND: 'background', ukirt_itc.UKIRTImagPhotITC.LIMIT_READOUT: 'readout'}
version = 1
classmethod get_code()

Get the calculator “code”.

This is a short string used to uniquely identify the calculator within facilities which use it. It will correspond to an entry in the “calculator” table and be used in URLs.

get_name()
get_calc_version()
get_inputs(mode, version=None)
get_default_input(mode)
get_form_input(inputs, form)

Extract the input values from the submitted form.

This example would be sufficient in the case of some input text boxes, but subclasses need to override to support other form elements such as checkboxes.

parse_input(mode, input_, defaults=None)
format_input(inputs, values)

Format the calculator inputs for display in the input form.

This is because the input form needs to take string inputs so that we can give it back malformatted user input strings for correction.

convert_input_mode(mode, new_mode, input_)
convert_input_version(mode, old_version, input_)
get_outputs(mode, version=None)
get_extra_context()

Method which subclasses can override to supply extra context information to the view template.

hedwig.facility.ukirt.control

class hedwig.facility.ukirt.control.UKIRTPart
search_ukirt_allocation(proposal_id)

Retrieve observing allocations for the given proposal.

search_ukirt_request(proposal_id)

Retrieve observing requests for a the given propsoal.

sync_ukirt_proposal_allocation(proposal_id, records, _test_skip_check=False)

Update the observing allocations for the given proposal.

sync_ukirt_proposal_request(proposal_id, records, _test_skip_check=False)

Update the observing requests for the given proposal.

hedwig.facility.ukirt.meta

hedwig.facility.ukirt.type

class hedwig.facility.ukirt.type.UKIRTRequest
_asdict()

Return a new dict which maps field names to their values.

_field_defaults = {}
_fields = ()
classmethod _make(iterable)

Make a new UKIRTRequest object from a sequence or iterable

_replace(**kwds)

Return a new UKIRTRequest object replacing specified fields with new values

class hedwig.facility.ukirt.type.UKIRTBrightness
DARK = 1
GREY = 2
BRIGHT = 3
class BrightnessInfo(name, available)
_asdict()

Return a new dict which maps field names to their values.

_field_defaults = {}
_fields = ('name', 'available')
classmethod _make(iterable)

Make a new BrightnessInfo object from a sequence or iterable

_replace(**kwds)

Return a new BrightnessInfo object replacing specified fields with new values

available

Alias for field number 1

name

Alias for field number 0

_info = {1: ('Dark', True), 2: ('Grey', True), 3: ('Bright', True)}
class hedwig.facility.ukirt.type.UKIRTRequestTotal(total, brightness, instrument)
class hedwig.facility.ukirt.type.UKIRTCallType

Class providing information about JCMT call types.

_ukirt_info = {1: {'code': None, 'name': 'Regular', 'url_path': 'regular'}, 2: {'code': 'SERV', 'name': 'Urgent', 'name_proposal': True, 'url_path': 'urgent'}, 3: {'code': 'TEST'}, 4: {'code': 'RT', 'name': 'Rapid Turnaround', 'name_proposal': True, 'url_path': 'rapid'}, 5: {'code': 'SPLM'}}
_info = {1: (None, 'Regular', True, 'regular', False, False, False, (1, 2, 6, 3, 4, 5), ()), 2: ('SERV', 'Urgent', True, 'urgent', True, True, False, (1, 5, 6), (1,)), 3: ('TEST', 'Test', True, 'test', False, True, False, (1, 2, 7, 6, 3, 4, 5), ()), 4: ('RT', 'Rapid Turnaround', True, 'rapid', False, True, True, (1, 7, 6), ()), 5: ('SPLM', 'Supplemental', True, 'supplement', False, False, False, (1, 2, 6, 3, 4, 5), ())}
override = {'code': 'TEST'}
role_id = 3
role_info = ('T', 'Test', True, 'test', False, True, False, (1, 2, 7, 6, 3, 4, 5), ())
class hedwig.facility.ukirt.type.UKIRTInstrument
WFCAM = 1
CGS4 = 2
MICHELLE = 3
UFTI = 4
UIST = 5
class InstrumentInfo(name, available)
_asdict()

Return a new dict which maps field names to their values.

_field_defaults = {}
_fields = ('name', 'available')
classmethod _make(iterable)

Make a new InstrumentInfo object from a sequence or iterable

_replace(**kwds)

Return a new InstrumentInfo object replacing specified fields with new values

available

Alias for field number 1

name

Alias for field number 0

_info = {1: ('WFCAM', True), 2: ('CGS4', True), 3: ('Michelle', True), 4: ('UFTI', True), 5: ('UIST', True)}
class hedwig.facility.ukirt.type.UKIRTRequestCollection

Class used for collections of UKIRT observing requests.

validate()

Attempt to validate a collection of observing requests.

Raises:

UserError if a problem is found.

to_table()

Rearrange the records into a table by instrument and brightness.

Returns: ResultTable(table, brightness values, instruments)

get_total()

Get request totals.

to_sorted_list()

Get sorted list of requests with brightness/instrument as name.

hedwig.facility.ukirt.view

class hedwig.facility.ukirt.view.UKIRT(id_)
classmethod get_code()

Get the facility “code”.

This is a short string to uniquely identify the facility. It will correspond to an entry in the “facility” table.

get_name()

Get the name of the facility.

get_definite_name()

Get the name of the facility, with a definate article for use in a sentence, if one would be appropriate.

e.g. “the JCMT” or “UKIRT”.

Subclasses should override this method if they do not want the word “the” to appear.

get_call_types()

Get the call type enum-style class to be used with this facility.

get_calculator_classes()

Get a tuple of calculator classes which can be used with this facility.

Sub-classes should override this method to provide the correct list of calculators.

get_target_tool_classes()

Get a tuple of the target tool classes which can be used with this facility.

make_proposal_code(db, proposal)

Generate the proposal identifying code for a given proposal.

This should be overridden by sub-classes to apply the naming scheme in use at each facility.

_parse_proposal_code(proposal_code)

Perform the parsing step of processing a proposal code.

This splits the code into the semester code, queue code, call type and proposal number.

_copy_proposal(current_user, db, old_proposal, proposal, *args, **kwargs)
_view_proposal_extra(current_user, db, proposal, auth_cache=None)

Method to gather additional information for the proposal view page.

Sub-classes can override this method to add additional information to the proposal.

_validate_proposal_extra(db, proposal, extra, proposal_order)
_view_proposal_feedback_extra(current_user, db, proposal, can)

Method to gather additional information for the proposal feedback page.

_get_proposal_tabulation(current_user, db, call, can, with_extra=False)

Prepare information for the detailed tabulation of proposals.

This is used to prepare the information both for the online version and the downloadable CSV file. For the CSV file, the with_extra option is enabled and additional information, beyond that which can be displayed on the online version, is retrieved.

_get_review_call_allocation_dynamic(db, call, can, proposals)

Get dynamic information, including total time (hours) for each proposal.

This method should be overridden by subclasses to return the most suitable representative total time for each proposal. For example this could be the total allocation, falling back to the total request if no allocation has yet been assigned.

_get_proposal_tabulation_titles(tabulation)
_get_proposal_tabulation_rows(tabulation)
view_request_edit(current_user, db, proposal, can, form)
_read_request_form(proposal, form, skip_blank_time=False)
_view_proposal_decision_get(db, proposal, form)

Read the UKIRT allocation from the form without raising parse errors.

_view_proposal_decision_save(db, proposal, info)

Store the UKIRT allocation.

_view_proposal_decision_extra(db, proposal, info)

Generate extra template context for allocation on decision page.

get_feedback_extra(db, proposal)

Get additional context for the proposal feedbacke email message.