text stringlengths 81 112k |
|---|
This may be overridden by a subclass.
def run(self, *args, **kw):
""" This may be overridden by a subclass. """
if self._runFunc is not None:
# remove the two args sent by EditParDialog which we do not use
if 'mode' in kw: kw.pop('mode')
if '_save' in kw: kw.pop('_sa... |
Print all the trigger logic to a string and return it.
def triggerLogicToStr(self):
""" Print all the trigger logic to a string and return it. """
try:
import json
except ImportError:
return "Cannot dump triggers/dependencies/executes (need json)"
retval = "TRIGG... |
Given a config file, find its associated config-spec file, and
return the full pathname of the file.
def _findAssociatedConfigSpecFile(self, cfgFileName):
""" Given a config file, find its associated config-spec file, and
return the full pathname of the file. """
# Handle simplest 2 ca... |
Walk the given ConfigObj dict pulling out IRAF-like parameters into
a list. Since this operates on a dict this can be called recursively.
This is also our chance to find and pull out triggers and such
dependencies.
def _getParamsFromConfigDict(self, cfgObj, scopePrefix='',
... |
For a given item (scope + name), return all strings (in a tuple)
that it is meant to trigger, if any exist. Returns None is none.
def getTriggerStrings(self, parScope, parName):
""" For a given item (scope + name), return all strings (in a tuple)
that it is meant to trigger, if any exist. Ret... |
For a given item (scope + name), return all strings (in a tuple)
that it is meant to execute, if any exist. Returns None is none.
def getExecuteStrings(self, parScope, parName):
""" For a given item (scope + name), return all strings (in a tuple)
that it is meant to execute, if any exist. Ret... |
Return a list, in order, of any parameters marked with "pos=N" in
the .cfgspc file.
def getPosArgs(self):
""" Return a list, in order, of any parameters marked with "pos=N" in
the .cfgspc file. """
if len(self._posArgs) < 1: return []
# The first item in the tuple is the... |
Return a dict of all normal dict parameters - that is, all
parameters NOT marked with "pos=N" in the .cfgspc file. This will
also exclude all hidden parameters (metadata, rules, etc).
def getKwdArgs(self, flatten = False):
""" Return a dict of all normal dict parameters - that is, all
... |
For the given item name (and scope), we are being asked to try
the given value to see if it would pass validation. We are not
to set it, but just try it. We return a tuple:
If it fails, we return: (False, the last known valid value).
On success, we return: (True, None)... |
Use ConfigObj's get_extra_values() call to find any extra/unknown
parameters we may have loaded. Return a string similar to findTheLost.
If deleteAlso is True, this will also delete any extra/unknown items.
def listTheExtras(self, deleteAlso):
""" Use ConfigObj's get_extra_values() call to fin... |
Reloads the measurements from the backing store.
:return: 200 if success.
def get(self):
"""
Reloads the measurements from the backing store.
:return: 200 if success.
"""
try:
self._measurementController.reloadCompletedMeasurements()
return None, ... |
Writes each sample to a csv file.
:param data: the samples.
:return:
def handle(self, data):
"""
Writes each sample to a csv file.
:param data: the samples.
:return:
"""
self.logger.debug("Handling " + str(len(data)) + " data items")
for datum in ... |
Posts to the target to tell it a named measurement is starting.
:param measurementId:
def start(self, measurementId):
"""
Posts to the target to tell it a named measurement is starting.
:param measurementId:
"""
self.sendURL = self.rootURL + measurementId + '/' + self.de... |
puts the data in the target.
:param data: the data to post.
:return:
def handle(self, data):
"""
puts the data in the target.
:param data: the data to post.
:return:
"""
self.dataResponseCode.append(self._doPut(self.sendURL + '/data', data=data)) |
informs the target the named measurement has completed
:param measurementId: the measurement that has completed.
:return:
def stop(self, measurementId, failureReason=None):
"""
informs the target the named measurement has completed
:param measurementId: the measurement that has ... |
Convert decimal dotted quad string to long integer
>>> int(dottedQuadToNum('1 '))
1
>>> int(dottedQuadToNum(' 1.2'))
16777218
>>> int(dottedQuadToNum(' 1.2.3 '))
16908291
>>> int(dottedQuadToNum('1.2.3.4'))
16909060
>>> dottedQuadToNum('255.255.255.255')
4294967295
>>> dotte... |
Convert long int to dotted quad string
>>> numToDottedQuad(long(-1))
Traceback (most recent call last):
ValueError: Not a good numeric IP: -1
>>> numToDottedQuad(long(1))
'0.0.0.1'
>>> numToDottedQuad(long(16777218))
'1.0.0.2'
>>> numToDottedQuad(long(16908291))
'1.2.0.3'
>>> nu... |
Return numbers from inputs or raise VdtParamError.
Lets ``None`` pass through.
Pass in keyword argument ``to_float=True`` to
use float for the conversion rather than int.
>>> _is_num_param(('', ''), (0, 1.0))
[0, 1]
>>> _is_num_param(('', ''), (0, 1.0), to_float=True)
[0.0, 1.0]
>>> _i... |
A check that tests that a given value is an integer (int, or long)
and optionally, between bounds. A negative value is accepted, while
a float will fail.
If the value is a string, then the conversion is done - if possible.
Otherwise a VdtError is raised.
>>> vtor = Validator()
>>> vtor.check('... |
A check that tests that a given value is a float
(an integer will be accepted), and optionally - that it is between bounds.
If the value is a string, then the conversion is done - if possible.
Otherwise a VdtError is raised.
This can accept negative values.
>>> vtor = Validator()
>>> vtor.che... |
Check if the value represents a boolean.
>>> vtor = Validator()
>>> vtor.check('boolean', 0)
0
>>> vtor.check('boolean', False)
0
>>> vtor.check('boolean', '0')
0
>>> vtor.check('boolean', 'off')
0
>>> vtor.check('boolean', 'false')
0
>>> vtor.check('boolean', 'no')
... |
Check that the supplied value is an Internet Protocol address, v.4,
represented by a dotted-quad string, i.e. '1.2.3.4'.
>>> vtor = Validator()
>>> vtor.check('ip_addr', '1 ')
'1'
>>> vtor.check('ip_addr', ' 1.2')
'1.2'
>>> vtor.check('ip_addr', ' 1.2.3 ')
'1.2.3'
>>> vtor.check('ip... |
Check that the value is a list of values.
You can optionally specify the minimum and maximum number of members.
It does no check on list members.
>>> vtor = Validator()
>>> vtor.check('list', ())
[]
>>> vtor.check('list', [])
[]
>>> vtor.check('list', (1, 2))
[1, 2]
>>> vtor.c... |
Check that the value is a list of integers.
You can optionally specify the minimum and maximum number of members.
Each list member is checked that it is an integer.
>>> vtor = Validator()
>>> vtor.check('int_list', ())
[]
>>> vtor.check('int_list', [])
[]
>>> vtor.check('int_list', (1... |
Check that the value is a list of booleans.
You can optionally specify the minimum and maximum number of members.
Each list member is checked that it is a boolean.
>>> vtor = Validator()
>>> vtor.check('bool_list', ())
[]
>>> vtor.check('bool_list', [])
[]
>>> check_res = vtor.check('... |
Check that the value is a list of floats.
You can optionally specify the minimum and maximum number of members.
Each list member is checked that it is a float.
>>> vtor = Validator()
>>> vtor.check('float_list', ())
[]
>>> vtor.check('float_list', [])
[]
>>> vtor.check('float_list', (... |
Check that the value is a list of strings.
You can optionally specify the minimum and maximum number of members.
Each list member is checked that it is a string.
>>> vtor = Validator()
>>> vtor.check('string_list', ())
[]
>>> vtor.check('string_list', [])
[]
>>> vtor.check('string_lis... |
Check that the value is a list of IP addresses.
You can optionally specify the minimum and maximum number of members.
Each list member is checked that it is an IP address.
>>> vtor = Validator()
>>> vtor.check('ip_addr_list', ())
[]
>>> vtor.check('ip_addr_list', [])
[]
>>> vtor.check... |
Check that a value is a list, coercing strings into
a list with one member. Useful where users forget the
trailing comma that turns a single value into a list.
You can optionally specify the minimum and maximum number of members.
A minumum of greater than one will fail if the user only supplies a
s... |
Check that the value is a list.
Allow specifying the type of each member.
Work on lists of specific lengths.
You specify each member as a positional argument specifying type
Each type should be one of the following strings :
'integer', 'float', 'ip_addr', 'string', 'boolean'
So you can spec... |
This check matches the value to any of a set of options.
>>> vtor = Validator()
>>> vtor.check('option("yoda", "jedi")', 'yoda')
'yoda'
>>> vtor.check('option("yoda", "jedi")', 'jed') # doctest: +SKIP
Traceback (most recent call last):
VdtValueError: the value "jed" is unacceptable.
>>> vt... |
Usage: check(check, value)
Arguments:
check: string representing check to apply (including arguments)
value: object to be checked
Returns value, converted to correct type if necessary
If the check fails, raises a ``ValidateError`` subclass.
>>> vtor = Validator... |
Unquote a value if necessary.
def _unquote(self, val):
"""Unquote a value if necessary."""
if (len(val) >= 2) and (val[0] in ("'", '"')) and (val[0] == val[-1]):
val = val[1:-1]
return val |
Take apart a ``keyword=list('val, 'val')`` type string.
def _list_handle(self, listmatch):
"""Take apart a ``keyword=list('val, 'val')`` type string."""
out = []
name = listmatch.group(1)
args = listmatch.group(2)
for arg in self._list_members.findall(args):
out.appe... |
Given a check, return the default value for the check
(converted to the right type).
If the check doesn't specify a default value then a
``KeyError`` will be raised.
def get_default_value(self, check):
"""
Given a check, return the default value for the check
(converted... |
A constant value HDU will only be recognized as such if the header
contains a valid PIXVALUE and NAXIS == 0.
def match_header(cls, header):
"""A constant value HDU will only be recognized as such if the header
contains a valid PIXVALUE and NAXIS == 0.
"""
pixvalue = header.get(... |
Verify that the HDU's data is a constant value array.
def _check_constant_value_data(self, data):
"""Verify that the HDU's data is a constant value array."""
arrayval = data.flat[0]
if np.all(data == arrayval):
return arrayval
return None |
Return currently selected index (or -1)
def get_current_index(self):
""" Return currently selected index (or -1) """
# Need to convert to int; currently API returns a tuple of string
curSel = self.__lb.curselection()
if curSel and len(curSel) > 0:
return int(curSel[0])
... |
Input GEIS files "input" will be read and a HDUList object will
be returned that matches the waiver-FITS format written out by 'stwfits' in IRAF.
The user can use the writeto method to write the HDUList object to
a FITS file.
def convert(input):
"""Input GEIS files "input" will be read and a... |
loads configuration from some predictable locations.
:return: the config.
def _loadConfig(self):
"""
loads configuration from some predictable locations.
:return: the config.
"""
configPath = path.join(self._getConfigPath(), self._name + ".yml")
if os.path.exists... |
Writes the config to the configPath.
:param config a dict of config.
:param configPath the path to the file to write to, intermediate dirs will be created as necessary.
def _storeConfig(self, config, configPath):
"""
Writes the config to the configPath.
:param config a dict of ... |
Gets the currently configured config path.
:return: the path, raises ValueError if it doesn't exist.
def _getConfigPath(self):
"""
Gets the currently configured config path.
:return: the path, raises ValueError if it doesn't exist.
"""
confHome = environ.get('VIBE_CONFIG... |
Configures the python logging system to log to a debug file and to stdout for warn and above.
:return: the base logger.
def configureLogger(self):
"""
Configures the python logging system to log to a debug file and to stdout for warn and above.
:return: the base logger.
"""
... |
Translate IBM-format floating point numbers (as bytes) to IEEE 754
64-bit floating point format (as Python float).
def ibm_to_ieee(ibm):
'''
Translate IBM-format floating point numbers (as bytes) to IEEE 754
64-bit floating point format (as Python float).
'''
# IBM mainframe: sign * 0.mantis... |
Translate Python floating point numbers to IBM-format (as bytes).
def ieee_to_ibm(ieee):
'''
Translate Python floating point numbers to IBM-format (as bytes).
'''
# Python uses IEEE: sign * 1.mantissa * 2 ** (exponent - 1023)
# IBM mainframe: sign * 0.mantissa * 16 ** (exponent - 64)
if iee... |
Serialize ``columns`` to a JSON formatted ``bytes`` object.
def dumps(columns):
'''
Serialize ``columns`` to a JSON formatted ``bytes`` object.
'''
fp = BytesIO()
dump(columns, fp)
fp.seek(0)
return fp.read() |
Parse the 3-line (240-byte) header of a SAS XPORT file.
def match(header):
'''
Parse the 3-line (240-byte) header of a SAS XPORT file.
'''
mo = Library.header_re.match(header)
if mo is None:
raise ValueError(f'Not a SAS Version 5 or 6 XPORT file')
return {
... |
Parse the 4-line (320-byte) library member header.
def header_match(cls, header):
'''
Parse the 4-line (320-byte) library member header.
'''
mo = cls.header_re.match(header)
if mo is None:
msg = f'Expected {cls.header_re.pattern!r}, got {header!r}'
raise ... |
Parse a member namestrs header (1 line, 80 bytes).
def header_match(cls, data):
'''
Parse a member namestrs header (1 line, 80 bytes).
'''
mo = cls.header_re.match(data)
return int(mo['n_variables']) |
Parse variable metadata for a XPORT file member.
def readall(cls, member, size):
'''
Parse variable metadata for a XPORT file member.
'''
fp = member.library.fp
LINE = member.library.LINE
n = cls.header_match(fp.read(LINE))
namestrs = [fp.read(size) for i in ran... |
Determine Julian day count from Islamic date
def to_jd(year, month, day):
'''Determine Julian day count from Islamic date'''
return (day + ceil(29.5 * (month - 1)) + (year - 1) * 354 + trunc((3 + (11 * year)) / 30) + EPOCH) - 1 |
Calculate Islamic date from Julian day
def from_jd(jd):
'''Calculate Islamic date from Julian day'''
jd = trunc(jd) + 0.5
year = trunc(((30 * (jd - EPOCH)) + 10646) / 10631)
month = min(12, ceil((jd - (29 + to_jd(year, 1, 1))) / 29.5) + 1)
day = int(jd - to_jd(year, month, 1)) + 1
return (year... |
Go over all widgets and let them know they have been edited
recently and they need to check for any trigger actions. This
would be used right after all the widgets have their values
set or forced (e.g. via setAllEntriesFromParList).
def checkAllTriggers(self, action):
""" G... |
Did something which requires a new look. Move scrollbar up.
This often needs to be delayed a bit however, to let other
events in the queue through first.
def freshenFocus(self):
""" Did something which requires a new look. Move scrollbar up.
This often needs to be delayed ... |
Mouse Wheel - under tkinter we seem to need Tk v8.5+ for this
def mwl(self, event):
"""Mouse Wheel - under tkinter we seem to need Tk v8.5+ for this """
if event.num == 4: # up on Linux
self.top.f.canvas.yview_scroll(-1*self._tmwm, 'units')
elif event.num == 5: # down on Linux
... |
Set focus to next item in sequence
def focusNext(self, event):
"""Set focus to next item in sequence"""
try:
event.widget.tk_focusNext().focus_set()
except TypeError:
# see tkinter equivalent code for tk_focusNext to see
# commented original version
... |
Set focus to previous item in sequence
def focusPrev(self, event):
"""Set focus to previous item in sequence"""
try:
event.widget.tk_focusPrev().focus_set()
except TypeError:
# see tkinter equivalent code for tk_focusPrev to see
# commented original version
... |
Scroll the panel down to ensure widget with focus to be visible
Tracks the last widget that doScroll was called for and ignores
repeated calls. That handles the case where the focus moves not
between parameter entries but to someplace outside the hierarchy.
In that case the scrolling i... |
Handle the situation where two par lists do not match.
This is meant to allow subclasses to override. Note that this only
handles "missing" pars and "extra" pars, not wrong-type pars.
def _handleParListMismatch(self, probStr, extra=False):
""" Handle the situation where two par lists do not mat... |
This creates self.defaultParamList. It also does some checks
on the paramList, sets its order if needed, and deletes any extra
or unknown pars if found. We assume the order of self.defaultParamList
is the correct order.
def _setupDefaultParamList(self):
""" This creates self.defaultPar... |
Make an entire section (minus skipList items) either active or
inactive. sectionName is the same as the param's scope.
def _toggleSectionActiveState(self, sectionName, state, skipList):
""" Make an entire section (minus skipList items) either active or
inactive. sectionName is the sam... |
Save the parameter settings to a user-specified file. Any
changes here must be coordinated with the corresponding tpar save_as
function.
def saveAs(self, event=None):
""" Save the parameter settings to a user-specified file. Any
changes here must be coordinated with the corresponding ... |
Pop up the help in a browser window. By default, this tries to
show the help for the current task. With the option arguments, it can
be used to show any help string.
def htmlHelp(self, helpString=None, title=None, istask=False, tag=None):
""" Pop up the help in a browser window. By default, ... |
Invoke task/epar/etc. help and put the page in a window.
This same logic is used for GUI help, task help, log msgs, etc.
def _showAnyHelp(self, kind, tag=None):
""" Invoke task/epar/etc. help and put the page in a window.
This same logic is used for GUI help, task help, log msgs, etc. """
... |
Set all the parameter entry values in the GUI to the values
in the given par list. If 'updateModel' is True, the internal
param list will be updated to the new values as well as the GUI
entries (slower and not always necessary). Note the
corresponding TparDisplay method.
... |
Return current par value from the GUI. This does not do any
validation, and it it not necessarily the same value saved in the
model, which is always behind the GUI setting, in time. This is NOT
to be used to get all the values - it would not be efficient.
def getValue(self, name, scope=None, na... |
Check, then set, then save the parameter settings for
all child (pset) windows.
Prompts if any problems are found. Returns None
on success, list of bad entries on failure.
def checkSetSaveChildren(self, doSave=True):
"""Check, then set, then save the parameter settings for
all... |
Internal callback used to make sure the msg list keeps moving.
def _pushMessages(self):
""" Internal callback used to make sure the msg list keeps moving. """
# This continues to get itself called until no msgs are left in list.
self.showStatus('')
if len(self._statusMsgsToShow) > 0:
... |
Show the given status string, but not until any given delay from
the previous message has expired. keep is a time (secs) to force
the message to remain without being overwritten or cleared. cat
is a string category used only in the historical log.
def showStatus(self, msg, keep=0, c... |
Start the GUI session, or simply load a task's ConfigObj.
def teal(theTask, parent=None, loadOnly=False, returnAs="dict",
canExecute=True, strict=False, errorsToTerm=False,
autoClose=True, defaults=False):
# overrides=None):
""" Start the GUI session, or simply load a task's ConfigObj. """... |
Shortcut to load TEAL .cfg files for non-GUI access where
loadOnly=True.
def load(theTask, canExecute=True, strict=True, defaults=False):
""" Shortcut to load TEAL .cfg files for non-GUI access where
loadOnly=True. """
return teal(theTask, parent=None, loadOnly=True, returnAs="dict",
ca... |
Find the task named taskPkgName, and delete any/all user-owned
.cfg files in the user's resource directory which apply to that task.
Like a unix utility, this returns 0 on success (no files found or only
1 found but deleted). For multiple files found, this uses deleteAll,
returning the file-name-list i... |
Load the given file (or existing object), and return a dict
of its values which are different from the default values. If report
is set, print to stdout the differences.
def diffFromDefaults(theTask, report=False):
""" Load the given file (or existing object), and return a dict
of its values which are... |
Return True if the given file name is located in an
installed area (versus a user-owned file)
def _isInstalled(fullFname):
""" Return True if the given file name is located in an
installed area (versus a user-owned file) """
if not fullFname: return False
if not os.path.exists(fullFname): return Fa... |
.cfgspc embedded code execution is done here, in a relatively confined
space. The variables available to the code to be executed are:
SCOPE, NAME, VAL, PARENT, TEAL
The code string itself is expected to set a var named OUT
def execEmbCode(SCOPE, NAME, VAL, TEAL, codeStr):
""" .cfgspc... |
Print a message listing TEAL-enabled tasks available under a
given installation directory (where pkgName resides).
If always is True, this will always print when tasks are
found; otherwise it will only print found tasks when in interactive
mode.
The parameter 'hidden' supports a ... |
This functions will return useful help as a string read from a file
in the task's installed directory called "<module>.help".
If no such file can be found, it will simply return an empty string.
Notes
-----
The location of the actual help file will be found under the task's
installed directory... |
Get a stringified val from a ConfigObj obj and return it as bool
def cfgGetBool(theObj, name, dflt):
""" Get a stringified val from a ConfigObj obj and return it as bool """
strval = theObj.get(name, None)
if strval is None:
return dflt
return strval.lower().strip() == 'true' |
Override so that we can run in a different mode.
def _overrideMasterSettings(self):
""" Override so that we can run in a different mode. """
# config-obj dict of defaults
cod = self._getGuiSettings()
# our own GUI setup
self._appName = APP_NAME
self._appHel... |
Override this so we can handle case of file not writable, as
well as to make our _lastSavedState copy.
def _doActualSave(self, fname, comment, set_ro=False, overwriteRO=False):
""" Override this so we can handle case of file not writable, as
well as to make our _lastSavedState copy. """... |
Determine if there are any edits in the GUI that have not yet been
saved (e.g. to a file).
def hasUnsavedChanges(self):
""" Determine if there are any edits in the GUI that have not yet been
saved (e.g. to a file). """
# Sanity check - this case shouldn't occur
assert self._las... |
Override to allow us to use an edited callback.
def _defineEditedCallbackObjectFor(self, parScope, parName):
""" Override to allow us to use an edited callback. """
# We know that the _taskParsObj is a ConfigObjPars
triggerStrs = self._taskParsObj.getTriggerStrings(parScope, parName)
... |
Override so we can append read-only status.
def updateTitle(self, atitle):
""" Override so we can append read-only status. """
if atitle and os.path.exists(atitle):
if _isInstalled(atitle):
atitle += ' [installed]'
elif not os.access(atitle, os.W_OK):
... |
This is the callback function invoked when an item is edited.
This is only called for those items which were previously
specified to use this mechanism. We do not turn this on for
all items because the performance might be prohibitive.
This kicks off any previously regis... |
Starts with given par (scope+name) and looks further down the list
of parameters until one of a different non-null scope is found. Upon
success, returns the (scope, name) tuple, otherwise (None, None).
def findNextSection(self, scope, name):
""" Starts with given par (scope+name) and looks fur... |
Overridden version for ConfigObj. theTask can be either
a .cfg file name or a ConfigObjPars object.
def _setTaskParsObj(self, theTask):
""" Overridden version for ConfigObj. theTask can be either
a .cfg file name or a ConfigObjPars object. """
# Create the ConfigObjPars obj
... |
Return a string to be used as the filter arg to the save file
dialog during Save-As.
def _getSaveAsFilter(self):
""" Return a string to be used as the filter arg to the save file
dialog during Save-As. """
# figure the dir to use, start with the one from the file
absRcDi... |
Go through all possible sites to find applicable .cfg files.
Return as an iterable.
def _getOpenChoices(self):
""" Go through all possible sites to find applicable .cfg files.
Return as an iterable. """
tsk = self._taskParsObj.getName()
taskFiles = set()
dirsSoFa... |
Load the parameter settings from a user-specified file.
def pfopen(self, event=None):
""" Load the parameter settings from a user-specified file. """
# Get the selected file name
fname = self._openMenuChoice.get()
# Also allow them to simply find any file - do not check _task_name_...... |
Override to include ConfigObj filename and specific errors.
Note that this only handles "missing" pars and "extra" pars, not
wrong-type pars. So it isn't that big of a deal.
def _handleParListMismatch(self, probStr, extra=False):
""" Override to include ConfigObj filename and specific errors.
... |
Load the default parameter settings into the GUI.
def _setToDefaults(self):
""" Load the default parameter settings into the GUI. """
# Create an empty object, where every item is set to it's default value
try:
tmpObj = cfgpars.ConfigObjPars(self._taskParsObj.filename,
... |
Retrieve the current parameter settings from the GUI.
def getDict(self):
""" Retrieve the current parameter settings from the GUI."""
# We are going to have to return the dict so let's
# first make sure all of our models are up to date with the values in
# the GUI right now.
bad... |
Load the parameter settings from a given dict into the GUI.
def loadDict(self, theDict):
""" Load the parameter settings from a given dict into the GUI. """
# We are going to have to merge this info into ourselves so let's
# first make sure all of our models are up to date with the values in
... |
Return a dict (ConfigObj) of all user settings found in rcFile.
def _getGuiSettings(self):
""" Return a dict (ConfigObj) of all user settings found in rcFile. """
# Put the settings into a ConfigObj dict (don't use a config-spec)
rcFile = self._rcDir+os.sep+APP_NAME.lower()+'.cfg'
if os... |
The base class doesn't implement this, so we will - save settings
(only GUI stuff, not task related) to a file.
def _saveGuiSettings(self):
""" The base class doesn't implement this, so we will - save settings
(only GUI stuff, not task related) to a file. """
# Put the settings into a C... |
Here we look through the entire .cfgspc to see if any parameters
are affected by this trigger. For those that are, we apply the action
to the GUI widget. The action is specified by depType.
def _applyTriggerValue(self, triggerName, outval):
""" Here we look through the entire .cfgspc to see if... |
Given a fits filename repesenting an association table reads in the table as a
dictionary which can be used by pydrizzle and multidrizzle.
An association table is a FITS binary table with 2 required columns: 'MEMNAME',
'MEMTYPE'. It checks 'MEMPRSNT' column and removes all files for which its value is 'no'... |
Write association table to a file.
def write(self, output=None):
"""
Write association table to a file.
"""
if not output:
outfile = self['output']+'_asn.fits'
output = self['output']
else:
outfile = output
# Delete the file if it ex... |
Reads a shift file from disk and populates a dictionary.
def readShiftFile(self, filename):
"""
Reads a shift file from disk and populates a dictionary.
"""
order = []
fshift = open(filename,'r')
flines = fshift.readlines()
fshift.close()
common = [f.str... |
Writes a shift file object to a file on disk using the convention for shift file format.
def writeShiftFile(self, filename="shifts.txt"):
"""
Writes a shift file object to a file on disk using the convention for shift file format.
"""
lines = ['# frame: ', self['frame'], '\n',
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.