def set_state (node,**fields): """helper function to set the state of a node specified by name or nodeindex"""; rec = dmi.record(state=dmi.record(fields)); if isinstance(node,str): rec.name = node; elif isinstance(node,int): rec.nodeindex = node; else: raise TypeError,'illegal node argumnent'; # pass command to kernel meqserver_interface.mqexec('Node.Set.State',rec,True); # True=silent
def set_state(node, **fields): """helper function to set the state of a node specified by name or nodeindex""" rec = dmi.record(state=dmi.record(fields)) if isinstance(node, str): rec.name = node elif isinstance(node, int): rec.nodeindex = node else: raise TypeError('illegal node argumnent') # pass command to kernel from Timba import meqserver_interface meqserver_interface.mqexec('Node.Set.State', rec, True)
def __init__ (self,name,parent=None): _dprint(2,"new unit",name,self.__class__); self.name = name; self.parent = parent; self.failed = None; self._fail_logged = False; self._success_logged = False; # inherit parent's options, and persistence level (-1) if parent: self.options = dmi.record(**parent.options); self.persist = parent.persist - 1; else: self.options = dmi.record(); self.persist = 0;
def __init__(self, name, parent=None): _dprint(2, "new unit", name, self.__class__) self.name = name self.parent = parent self.failed = None self._fail_logged = False self._success_logged = False # inherit parent's options, and persistence level (-1) if parent: self.options = dmi.record(**parent.options) self.persist = parent.persist - 1 else: self.options = dmi.record() self.persist = 0
def close(self, rec): """closes meter, posts message describing elapsed time and rate. Usually connected to a Vis.Channel.Closed signal.""" if self._app: msg = "dataset complete" rec = dmi.record() if self._vis_inittime is not None: elapsed = time.time() - self._vis_inittime rec.elapsed = hms_str(elapsed) msg += " in " + rec.elapsed else: elapsed = None if self._stats.rate is not None: rec.secs_per_ts = self._stats.rate msg = msg + "; avg %.2f sec/ts" % rec.secs_per_ts if self._vis_nt is not None: rec.num_tiles = self._vis_nt if elapsed is not None: rec.secs_per_tile = elapsed / self._vis_nt msg = msg + "; avg %.2f sec/tile" % rec.secs_per_tile if self._vis_rtime0 is not None: rec.start_time_rel = self._vis_rtime0 if self._vis_rtime1 is not None: rec.end_time_rel = self._vis_rtime1 self._app.log_message(msg, content=rec) self.reset()
def Solver (self,*childlist,**kw): solvables = kw.get('solvable',None); if solvables: # convert to list if a singleton is specified if not isinstance(solvables,(list,tuple)): solvables = (solvables,); # build list of names. Each solvable may be specified by a string name, # or by something with a "name" attribute solvnames = []; for s in solvables: if not isinstance(s,str): try: s = s.name; except AttributeError: return _NodeDef(NodeDefError("can't specify a solvable as something of type "+type(s).__name__)); solvnames.append(s); # create solvable command kw['solvable'] = dmi.record( command_by_list=[dmi.record(name=solvnames,state=dmi.record(solvable=True)), dmi.record(state=dmi.record(solvable=False))]); return _NodeDef('Meq','Solver',*childlist,**kw);
from Timba import dmi import re import sys # Default debug levels. # these may be overwritten/added to by other modules. # note that the "-debug" option sets a maximum that is applied here. debuglevels = {} # default arguments to app_proxy and derivatives args = dmi.record({ 'spawn': True, 'opt': False, 'verbose': 0, 'wp_verbose': 0, 'threads': True, 'gui': False, 'checkrefs': False }) # if this is false, then all gui definitions are omitted at startup, and # a gui can't be enabled later (set via the "-nogui" option) include_gui = True def parse_argv(argv): dbgre = re.compile('-d(.+)=([0-9]+)') # list of unparsed arguments remain = []
# from Timba import dmi import re import sys # Default debug levels. # these may be overwritten/added to by other modules. # note that the "-debug" option sets a maximum that is applied here. debuglevels = {}; # default arguments to app_proxy and derivatives args = dmi.record({ 'spawn':True,'opt':False, 'verbose':0,'wp_verbose':0, 'threads':True, 'gui':False,'checkrefs':False }); # if this is false, then all gui definitions are omitted at startup, and # a gui can't be enabled later (set via the "-nogui" option) include_gui = True; def parse_argv (argv): dbgre = re.compile('-d(.+)=([0-9]+)'); # list of unparsed arguments remain = []; for i,arg in enumerate(argv):
def stop_solver (self): if not self._solver: return; self.disable_stop_button("stopping..."); meqds.mqs().setnodestate(self._solver,dmi.record(interrupt_solution=True),sync=False);
category, ""), message) # # ===== MESSAGE BOXES === # # message box types # when capitalized, these are QMessageBox icon types as well Critical = 'critical' Information = 'information' Question = 'question' Warning = 'warning' # copy button types from QMessageBox Button = dmi.record() _button_types = ("Ok", "Open", "Save", "Cancel", "Close", "Discard", "Apply", "Reset", "RestoreDefaults", "Help", "SaveAll", "Yes", "YesToAll", "No", "NoToAll", "Abort", "Retry", "Ignore", "NoButton") ButtonNames = dict() if Qt: for button in _button_types: num = getattr(Qt.QMessageBox, button) setattr(Button, button, num) else: for i, button in enumerate(_button_types): setattr(Button, button, 1 << i) for button in _button_types:
# # Copyright (C) 2002-2007 # The MeqTree Foundation & # ASTRON (Netherlands Foundation for Research in Astronomy) # P.O.Box 2, 7990 AA Dwingeloo, The Netherlands # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see <http://www.gnu.org/licenses/>, # or write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # from Timba import dmi # This file contains initial TDL settings orphans_are_roots = True; forest_state = dmi.record();
else: print "TDL %s message: %s"%(message_category_names.get(category,""),message); # # ===== MESSAGE BOXES === # # message box types # when capitalized, these are QMessageBox icon types as well Critical = 'critical'; Information = 'information'; Question = 'question'; Warning = 'warning'; # copy button types from QMessageBox Button = dmi.record(); _button_types = ( "Ok","Open","Save","Cancel","Close","Discard","Apply", "Reset","RestoreDefaults","Help","SaveAll","Yes","YesToAll", "No","NoToAll","Abort","Retry","Ignore","NoButton"); ButtonNames = dict(); if Qt: for button in _button_types: num = getattr(Qt.QMessageBox,button); setattr(Button,button,num); else: for i,button in enumerate(_button_types): setattr(Button,button,1<<i); for button in _button_types: ButtonNames[getattr(Button,button)] = button;
def __init__ (self,pynode,staterec,initializing): self.pynode,self.staterec,self.initializing = pynode,staterec,initializing; self.newstate = dmi.record();