def __init__(self, session): Source.__init__(self) self.records_running = 0 self.session = session session.nav.record_event.append(self.gotRecordEvent) self.gotRecordEvent(None, None) return
def __init__(self, navcore): Source.__init__(self) PerServiceBase.__init__(self, navcore, {iPlayableService.evStart: self.gotEvent, iPlayableService.evUpdatedRadioText: self.gotEvent, iPlayableService.evUpdatedRtpText: self.gotEvent, iPlayableService.evUpdatedRassInteractivePicMask: self.gotEvent, iPlayableService.evEnd: self.gotEvent}, with_event=True)
def __init__(self): Source.__init__(self) self.disabled = False self._available = False self._appname = "" self.redButtonAppplicationReady_conn = eHbbtv.getInstance().redButtonAppplicationReady.connect(self._redButtonApplicationReady) self.aitInvalidated_conn = eHbbtv.getInstance().aitInvalidated.connect(self._aitInvalidated)
def readFromAddrBar(self): if len(str(self.addressInput.text())) > 1: if self.selected != False: self.selected = False; source = Source(); source = source.fromURL(str(self.addressInput.text())); if(source != False): try: feed = Feed(source); self.rssContentView.setHtml(unicode(FeedBox.FeedBox.showFeeds(feed.feedTitle, feed.toHTML()))); self.updateTitle(str(feed.feedTitle).replace("'", "'")); self.rmFeedButton.setEnabled(False); #self.reloadOneFeedButton.setEnabled(False); self.saveFromAddrButton.setEnabled(True); self.addFeedPopup.name.setText(feed.feedTitle); except: self.rssContentView.setHtml(unicode(FeedBox.FeedBox.parseError())); self.updateTitle("Unable to load RSS feed"); else: self.rssContentView.setHtml(unicode(FeedBox.FeedBox.downloadError())); self.updateTitle("Unable to load RSS feed"); self.feedListWidget.clearSelection();
def __init__(self, session, poll=600, type=0, diskName=True, allVisible=False): Source.__init__(self) self.session = session if type == 1: self.type = self.INTERNAL elif type == 2: self.type = self.INTERNAL_HDD elif type == 3: self.type = self.INTERNAL_SSD elif type == 4: self.type = self.EXTERNAL else: self.type = self.ALL self.isSleeping = False self.state_text = "" self.isHDD() self.diskName = diskName self.allVisible = allVisible self.standby_time = poll self.timer = eTimer() self.timer.callback.append(self.updateHddState) self.idle_time = int(config.usage.hdd_standby.value) config.usage.hdd_standby.addNotifier(self.setStandbyTime, initial_call=False) if self.hdd_list: self.updateHddState(force=True) if self.onPartitionAddRemove not in harddiskmanager.on_partition_list_change: harddiskmanager.on_partition_list_change.append(self.onPartitionAddRemove)
def destroy(self): res_mgr = eDVBResourceManager.getInstance() if res_mgr: self.frontendUseMaskChanged_conn = None else: print "no res_mgr!!" Source.destroy(self)
def destroy(self): res_mgr = eDVBResourceManager.getInstance() if res_mgr: res_mgr.frontendUseMaskChanged.get().remove(self.tunerUseMaskChanged) else: print 'no res_mgr!!' Source.destroy(self)
def __init__(self, id, name, interArrivalTime=None, entity='Dream.Batch', batchNumberOfUnits=1, **kw): Source.__init__(self, id=id, name=name, interArrivalTime=interArrivalTime, entity=entity) self.numberOfUnits = int(batchNumberOfUnits) from Globals import G G.BatchSourceList.append(self)
def destroy(self): if self.poll_timer: self.poll_timer.callback.remove(self.poll) if self.post_destroy is not None: self.fixed = self.post_destroy self.poll() Source.destroy(self)
def __init__(self, new_color, new_size, geo_coords=get_instance(0.0, 0.0), new_shape=shape_enum.CIRCLE): """ Constructor """ Source.__init__(self, new_color, geo_coords) self.size = new_size self.point_shape = new_shape
def destroy(self): if not self.frontend_source and not self.service_source: PerServiceBase.destroy(self) res_mgr = eDVBResourceManager.getInstance() if res_mgr: res_mgr.frontendUseMaskChanged.get().remove(self.updateTunerMask) Source.destroy(self)
def __init__(self, navcore, now_or_next): Source.__init__(self) PerServiceBase.__init__(self, navcore, {iPlayableService.evStart: self.gotEvent, iPlayableService.evUpdatedEventInfo: self.gotEvent, iPlayableService.evEnd: self.gotEvent}, with_event=True) self.now_or_next = now_or_next self.epgQuery = eEPGCache.getInstance().lookupEventTime
def __init__(self): Source.__init__(self) self.tuner_use_mask = 0 res_mgr = eDVBResourceManager.getInstance() if res_mgr: res_mgr.frontendUseMaskChanged.get().append(self.tunerUseMaskChanged) else: print 'no res_mgr!!'
def __init__(self, gcvs, new_color=colors.WHITE, lw=1.5): ''' Constructor ''' Source.__init__(self, new_color) self.ra_decs = [] self.line_width = lw self.gc_vertices = gcvs
def __init__(self): Source.__init__(self) self.tuner_use_mask = 0 res_mgr = eDVBResourceManager.getInstance() if res_mgr: self.frontendUseMaskChanged_conn = res_mgr.frontendUseMaskChanged.connect(self.tunerUseMaskChanged) else: print "no res_mgr!!"
def __init__(self, service_source = None, frontend_source = None, update_interval = 1000): Source.__init__(self) self.update_interval = update_interval self.service_source = service_source self.frontend_source = frontend_source self.invalidate() self.poll_timer = eTimer() self.poll_timer_conn = self.poll_timer.timeout.connect(self.updateFrontendStatus)
def __init__(self, service_source = None, frontend_source = None, update_interval = 1000): Source.__init__(self) self.update_interval = update_interval self.service_source = service_source self.frontend_source = frontend_source self.invalidate() self.poll_timer = eTimer() self.poll_timer.callback.append(self.updateFrontendStatus) self.poll_timer.start(update_interval, True)
def __init__(self, update_interval = 500, sensorid = None): self.update_interval = update_interval self.sensorid = sensorid Source.__init__(self) if sensorid is not None: self.update_timer = eTimer() self.update_timer_conn = self.update_timer.timeout.connect(self.updateValue) self.update_timer.start(self.update_interval)
def __init__(self, new_label, color, geo_coords=get_instance(0.0, 0.0), \ new_offset=0.02, new_fontsize=15): ''' Constructor ''' Source.__init__(self, color, geo_coords) self.label = new_label self.offset = new_offset self.font_size = new_fontsize
def __init__(self, update_interval = 500, sensorid = None): self.update_interval = update_interval self.sensorid = sensorid Source.__init__(self) if sensorid is not None: self.update_timer = eTimer() self.update_timer.callback.append(self.updateValue) self.update_timer.start(self.update_interval) return
def testInsert(self): sdao = SourceDAO() source = Source() source.name = 'zezinho' source.hash = self.hash source.software = 'mldonkey 3.1.2' source.osinfo = 'Linux' sid = sdao.insertOrUpdate(source) assert sid is not None, 'error inserting source'
def __init__(self, list = [ ], enableWrapAround = False, item_height = 25, fonts = [ ]): Source.__init__(self) self.__list = list self.onSelectionChanged = [ ] self.item_height = item_height self.fonts = fonts self.disable_callbacks = False self.enableWrapAround = enableWrapAround self.__style = "default" # style might be an optional string which can be used to define different visualisations in the skin
def __init__(self, fixed = False, function = None, destroy = None, poll = 0): Source.__init__(self) self.function = function self.fixed = fixed self.post_destroy = destroy if poll > 0: self.poll_timer = eTimer() self.poll_timer_conn = self.poll_timer.timeout.connect(self.poll) self.poll_timer.start(poll) else: self.poll_timer = None
def __init__(self, navcore): Source.__init__(self) PerServiceBase.__init__(self, navcore, {iPlayableService.evStart: self.serviceEvent, iPlayableService.evEnd: self.serviceEvent, iPlayableService.evUpdatedInfo: self.serviceEvent, iPlayableService.evUpdatedEventInfo: self.serviceEvent, iPlayableService.evNewProgramInfo: self.serviceEvent, iPlayableService.evCuesheetChanged: self.serviceEvent, iPlayableService.evVideoSizeChanged: self.serviceEvent, iPlayableService.evHBBTVInfo: self.serviceEvent}, with_event=True) self.navcore = navcore
def __init__(self, geo_coord, new_id, up_v=Vector3(0.0, 1.0, 0.0), im_scale=1): ''' Constructor ''' Source.__init__(self, colors.WHITE, geo_coord) self.is_blank = False self.requires_blending = False self.pixmap_image = None self.image_scale = im_scale self.set_up_vector(up_v) self.set_image_id(new_id)
def __init__(self, new_color=colors.WHITE): ''' Constructor ''' Source.__init__(self, new_color) self.level = None self.names = [] self.image_sources = [] self.line_sources = [] self.point_sources = [] self.text_sources = []
def __init__(self, fixed = False, function = None, destroy = None, poll = 0): Source.__init__(self) self.function = function self.fixed = fixed self.post_destroy = destroy if poll > 0: self.poll_timer = eTimer() self.poll_timer.callback.append(self.poll) self.poll_timer.start(poll) else: self.poll_timer = None
def __init__(self, service_source = None, frontend_source = None, navcore = None): self.navcore = None Source.__init__(self) if navcore: PerServiceBase.__init__(self, navcore, { iPlayableService.evTunedIn: self.updateFrontendData, iPlayableService.evEnd: self.serviceEnd }) self.service_source = service_source self.frontend_source = frontend_source self.updateFrontendData()
def __init__(self, list = None, enableWrapAround = False, item_height = 25, fonts = None): if not list: list = [] if not fonts: fonts = [] Source.__init__(self) self.__list = list self.onSelectionChanged = [] self.item_height = item_height self.fonts = fonts self.disable_callbacks = False self.enableWrapAround = enableWrapAround self.__style = 'default'
def __init__(self, navcore, now_or_next): Source.__init__(self) self.epgTimer = eTimer() self.epgTimer.callback.append(self.epgTimerCheck) PerServiceBase.__init__(self, navcore, { iPlayableService.evStart: self.gotEvent, iPlayableService.evUpdatedEventInfo: self.gotEvent, iPlayableService.evEnd: self.gotEvent }, with_event=True) self.now_or_next = now_or_next self.epgQuery = eEPGCache.getInstance().lookupEventTime self.NextStartTime = 0
def __init__(self): Source.__init__(self) self.check_timer = eTimer() self.check_timer.callback.append(self.poll) self.check_timer.start(60000)
def setUp(self, logFile='log/PullFTP.log'): self.logger = Logger(logFile, 'DEBUG', 'Sub') self.logger = self.logger.getLogger() self.source = Source('source-ftp', self.logger) self.puller = PullFTP(self.source, self.logger)
if __name__ == '__main__': # Default constructor. sourceLibraryDocument = SourceLibraryDocument() # Constructor with attribute values. sourceLibrary = SourceLibrary() sourceLibraryDocument = SourceLibraryDocument(sourceLibrary=sourceLibrary) assert str( sourceLibraryDocument ) == 'SourceLibraryDocument(source_library=SourceLibrary(_sources=[Source(_name=source,_spatialModel=SpatialModel(_file=None,_parameters=[Parameter(_free=False,_max=360.0,_min=0.0,_name=RA,_scale=1.0,_tagName=parameter,_value=0.0),Parameter(_free=False,_max=90.0,_min=-90.0,_name=DEC,_scale=1.0,_tagName=parameter,_value=0.0)],_tagName=spatialModel,_type=SkyDirFunction),_spectrum=Spectrum(_file=None,_parameters=[Parameter(_free=True,_max=1000.0,_min=0.001,_name=Prefactor,_scale=1e-09,_tagName=parameter,_value=1.0),Parameter(_free=True,_max=-1.0,_min=-5.0,_name=Index,_scale=1.0,_tagName=parameter,_value=-2.1),Parameter(_free=False,_max=2000.0,_min=30.0,_name=Scale,_scale=1.0,_tagName=parameter,_value=100.0)],_tagName=spectrum,_type=PowerLaw),_tagName=source,_type=PointSource)],_tagName=source_library,_title=Source Library))' # Add a new Source. from Source import Source sourceLibraryDocument.addSource(Source()) assert str( sourceLibraryDocument ) == 'SourceLibraryDocument(source_library=SourceLibrary(_sources=[Source(_name=source,_spatialModel=SpatialModel(_file=None,_parameters=[Parameter(_free=False,_max=360.0,_min=0.0,_name=RA,_scale=1.0,_tagName=parameter,_value=0.0),Parameter(_free=False,_max=90.0,_min=-90.0,_name=DEC,_scale=1.0,_tagName=parameter,_value=0.0)],_tagName=spatialModel,_type=SkyDirFunction),_spectrum=Spectrum(_file=None,_parameters=[Parameter(_free=True,_max=1000.0,_min=0.001,_name=Prefactor,_scale=1e-09,_tagName=parameter,_value=1.0),Parameter(_free=True,_max=-1.0,_min=-5.0,_name=Index,_scale=1.0,_tagName=parameter,_value=-2.1),Parameter(_free=False,_max=2000.0,_min=30.0,_name=Scale,_scale=1.0,_tagName=parameter,_value=100.0)],_tagName=spectrum,_type=PowerLaw),_tagName=source,_type=PointSource),Source(_name=source,_spatialModel=SpatialModel(_file=None,_parameters=[Parameter(_free=False,_max=360.0,_min=0.0,_name=RA,_scale=1.0,_tagName=parameter,_value=0.0),Parameter(_free=False,_max=90.0,_min=-90.0,_name=DEC,_scale=1.0,_tagName=parameter,_value=0.0)],_tagName=spatialModel,_type=SkyDirFunction),_spectrum=Spectrum(_file=None,_parameters=[Parameter(_free=True,_max=1000.0,_min=0.001,_name=Prefactor,_scale=1e-09,_tagName=parameter,_value=1.0),Parameter(_free=True,_max=-1.0,_min=-5.0,_name=Index,_scale=1.0,_tagName=parameter,_value=-2.1),Parameter(_free=False,_max=2000.0,_min=30.0,_name=Scale,_scale=1.0,_tagName=parameter,_value=100.0)],_tagName=spectrum,_type=PowerLaw),_tagName=source,_type=PointSource)],_tagName=source_library,_title=Source Library))' # Check the source count method. assert sourceLibraryDocument.getNumSources() == 2 # Remove the newly-added Source. sourceLibraryDocument.removeSource(1) assert sourceLibraryDocument.getNumSources() == 1 # Convert to/from DOM object. dom = sourceLibraryDocument.toDom() sourceLibraryDocumentCopy = SourceLibraryDocument(dom=dom) assert sourceLibraryDocumentCopy == sourceLibraryDocument
def _onSourceAddEGRETDiffuseSource(self): if debug: print 'Source/Add EGRET Diffuse Source' # Create a new EGRET diffuse Source. name = 'EGRET Diffuse Source %d' % self._getSourceID() # Create a power law spectrum for the EGRET diffuse source. spectrum = Spectrum(type='PowerLaw') # Adjust the Prefactor parameter. parameter = spectrum.getParameterByName('Prefactor') parameter.setValue(11.0) parameter.setScale(0.001) parameter.setMin(0.001) parameter.setMax(1000.0) parameter.setFree(True) spectrum.setParameterByName('Prefactor', parameter) # Adjust the Index parameter. parameter = spectrum.getParameterByName('Index') parameter.setValue(-2.1) parameter.setScale(1.0) parameter.setMin(-3.5) parameter.setMax(-1.0) parameter.setFree(False) spectrum.setParameterByName('Index', parameter) # Adjust the Scale parameter. parameter = spectrum.getParameterByName('Scale') parameter.setValue(100.0) parameter.setScale(1.0) parameter.setMin(50.0) parameter.setMax(200.0) parameter.setFree(False) spectrum.setParameterByName('Scale', parameter) # Create a spatial map spatial model. spatialModel = SpatialModel( type='SpatialMap', file=ModelEditorApp._EgretDiffuseSourcePath) source = Source(name=name, type='DiffuseSource', spectrum=spectrum, spatialModel=spatialModel) # Assemble the source. source = Source(name=name, type='DiffuseSource', spectrum=spectrum, spatialModel=spatialModel) # Fetch the current SourceLibraryDocument. sourceLibraryDocument = self._sourceLibraryDocumentEditor.get() # Append the new Source to the list of Sources. sourceLibraryDocument.addSource(source) # Populate the editor with the changes. self._sourceLibraryDocumentEditor.set(sourceLibraryDocument) # Select the new source. self._sourceLibraryDocumentEditor.selectSource(name)
def __init__(self, value=0, valuerange=100): Source.__init__(self) self.__value = value self.range = valuerange
def test_all_the_corners(): f = Field(Example) # picture (good) source = Source(('[[1, 0, 0], [0, 2, 2], [0, 0, 0]]', 'pic_all_as_pat')) code = f.compile(source) assert isinstance(code, Code) assert len(code.data) == len(source.data) ret = f.run(code) assert isinstance(ret, Block) assert ret.type == Block.type_pattern # picture (bad) source = Source(('[[1, 0, 0]], [0, 2, 2], [0, 0, 0]]', 'pic_all_as_pat')) code = f.compile(source) assert isinstance(code, Block) assert code.type == Block.type_error assert code.data.startswith('Malformed picture') # tuple (good) source = Source(('(9,)', '(10,11)', 'swap_top2')) code = f.compile(source) assert isinstance(code, Code) assert len(code.data) == len(source.data) ret = f.run(code) assert isinstance(ret, Block) assert ret.type == Block.type_integer assert isinstance(ret.data, int) assert ret.data == 9 # tuple (good) source = Source(('(3, 5)', '(9,)', 'swap_top2')) code = f.compile(source) assert isinstance(code, Code) assert len(code.data) == len(source.data) ret = f.run(code) assert isinstance(ret, Block) assert ret.type == Block.type_int_pair assert isinstance(ret.data, tuple) assert len(ret.data) == 2 # tuple (good) source = Source(('(3, 5, 4, 2)', '(9,)', 'swap_top2')) code = f.compile(source) assert isinstance(code, Code) assert len(code.data) == len(source.data) ret = f.run(code) assert isinstance(ret, Block) assert ret.type == Block.type_NESW assert isinstance(ret.data, tuple) assert len(ret.data) == 4 # tuple (bad) source = Source(('(2, ")', 'sto_a')) code = f.compile(source) assert isinstance(code, Block) assert code.type == Block.type_error assert code.data.startswith('Malformed tuple') # tuple (bad) source = Source(('(2, 8, 6)', 'sto_a')) code = f.compile(source) assert isinstance(code, Block) assert code.type == Block.type_error assert code.data.startswith('Tuple must be') # vector (good) source = Source(('[3, 5, 4]', '(9,)', 'swap_top2')) code = f.compile(source) assert isinstance(code, Code) assert len(code.data) == len(source.data) ret = f.run(code) assert isinstance(ret, Block) assert ret.type == Block.type_vector assert isinstance(ret.data, list) assert len(ret.data) == 3 # vector (bad) source = Source(('[2, "]', 'sto_a')) code = f.compile(source) assert isinstance(code, Block) assert code.type == Block.type_error assert code.data.startswith('Malformed vector') # Unknown opcode source = Source(('sto_a', 'make_it_happen')) code = f.compile(source) assert isinstance(code, Block) assert code.type == Block.type_error assert code.data.startswith('Unknown opcode') # Empty source source = Source(tuple()) code = f.compile(source) assert isinstance(code, Block) assert code.type == Block.type_error assert code.data == 'Empty source'
def destroy(self): weathermsn.callbacksAllIconsDownloaded.remove( self.callbackAllIconsDownloaded) Source.destroy(self)
def __init__(self): Source.__init__(self) self._available = False self._appname = '' self._useait = True
def destroy(self): PerServiceBase.destroy(self) Source.destroy(self)
def destroy(self): self.redButtonAppplicationReady_conn = None self.aitInvalidated_conn = None Source.destroy(self)
def setUp(self,logFile='log/Source.log'): self.logger = Logger(logFile, 'DEBUG', 'Sub') self.logger = self.logger.getLogger() self.source1 = Source('source-test', self.logger) self.source2 = Source('source-am', self.logger)
def __init__(self): Source.__init__(self) self.service = None
def _add1FGLSources(self): """Extract sources from the 1FGL catalog file Parameters: - self - This CatalogSourceExtractor object Return value: - none - Sets the self.sources variable to a list of source objects Usage: self._add1FGLSources() Description: This function loops over all of the sources in the 1FGL catalog file and extracts all those that lie within 5 degrees of the ROI. It creates PowerLaw source objects for each. Each model is added to the object's local list of sources. The Galactic Diffuse source is added but with a fixed index of 0. The user should modify this by hand if desired. """ # file=pyfits.open(self.catParams['catalogFile']) file=self.catFile.fitsFilePtr data=file[1].data try: name=data.field('Source_Name') except: name=data.field('NickName') ra=data.field('RA') dec=data.field('DEC') flux=data.field('Flux_Density') pivot=data.field('Pivot_Energy') index=data.field('Spectral_Index') sigma=data.field('Signif_Avg') for n,f,i,r,d,p,s in zip(name,flux,index,ra,dec,pivot,sigma): dist=angsep(self.ra,self.dec,r,d) # get distance from object to ROI center if (r==self.ra and d==self.dec): # just to avoid any small number errors dist = 0.0 if (dist <= self.radius+5.0): # object is in target area fscale=int(floor(log10(f))) sourceName='' for N in n.split(' '): sourceName+=N Name = (sourceName if not sourceName[0].isdigit() else "_"+sourceName) # add an underscore to prevent string/number issues if name starts with a digit source = Source(name = Name, type = "PointSource") self._PLspec(source,f,i,p,dist,s) ra = Parameter(name="RA",value = r, scale = 1.0, min = 0.0, max = 360.0, free = False) dec = Parameter(name="DEC",value = d, scale = 1.0, min = -90.0, max = 90.0, free = False) spatialModel = SpatialModel(type="SkyDirFunction",parameters=[ra,dec]) source.setSpatialModel(spatialModel) if (None == self.sources): self.sources = [] self.sources.append(source) # Set Galactic Diffuse model gdSpatial = SpatialModel(type="MapCubeFunction", file=self.catParams['galDiffFile']) gdSource = Source(name=self.catParams['gdModelName'], type='DiffuseSource',spatialModel=gdSpatial) #default spectrum is PowerLaw # but we need to fix the index spec = gdSource.getSpectrum() index = spec.getParameterByName("Index") index.setFree(False) # and also set it to zero (why? echoing Tyrel's script. This probably won't be used much at all give the existence of 2FGL and soon 3FGL) index.setMax("1.0") index.setValue("0.0") spec.setParameterByName("Index",index) gdSource.setSpectrum(spec) self.sources.append(gdSource) # Set isotropic diffuse source if (None == self.catParams['isoTempFile']): #null means no file so assume user wants an isotropic power law component isoSpectrum = Specturm() # create a default PowerLaw Spectrum Name='<source name="%s" type="DiffuseSource">\n' %ISOn else: #if a file is given assume it is an isotropic template isoSpectrum = Spectrum(type="FileFunction", file = self.catParams['isoTempFile']) #both of the above options use the same spatial model isoSpatial = SpatialModel(type="ConstantValue") isoSource = Source(name= self.catParams['isTempName'], type="DiffuseSource", spectrum=isoSpectrum, spatialModel=isoSpatial) self.sources.append(isoSource)
def __init__(self, config): Source.__init__(self) self.__config = config
def destroy(self): self.check_timer.callback.remove(self.poll) Source.destroy(self)
def destroy(self): if not self.frontend_source and not self.service_source: PerServiceBase.destroy(self) Source.destroy(self)
def __init__(self, text = "", filter = lambda x: x): Source.__init__(self) self.__text = text self.filter = filter
dom = document.toDom() print dom.toxml() if editor.getChanged(): print "Changed by the editor." if __name__ == '__main__': # Create the root window. root = Tkinter.Tk() Pmw.initialise(root) root.title('SourceLibraryDocumentEditor test') # Create a 2-source library. from Source import Source source1 = Source(name='Source 1') source2 = Source(name='Source 2') # Create a SourceLibraryDocument from the 2 sources. from SourceLibrary import SourceLibrary sourceLibrary = SourceLibrary(title='2 sources', sources=[source1, source2]) sourceLibraryDocument = SourceLibraryDocument(sourceLibrary = \ sourceLibrary) # Create and grid the editor, a button to commit changes, and a # button to dump its contents. sourceLibraryDocumentEditor = \ SourceLibraryDocumentEditor(root, sourceLibraryDocument) sourceLibraryDocumentEditor.grid(row=0, column=0) commitButton = Tkinter.Button(root,
def __init__(self): Source.__init__(self) def callbackAllIconsDownloaded(self): pass
def __init__(self): self.DEBUG('MSNWeather(Source) __init__') Source.__init__(self) #weathermsn.callbacksAllIconsDownloaded.append(self.callbackAllIconsDownloaded) weathermsn.callbacks.append(self.refreshCallback) weathermsn.getData()
def destroy(self): Source.destroy(self) def getWebCurrentItems(self): return {}
def destroy(self): self.poll_timer.callback.remove(self.updateFrontendStatus) Source.destroy(self)
def __init__(self): Source.__init__(self) self.sequence = 0 self.clear()
def destroy(self): self.session.nav.record_event.remove(self.gotRecordEvent) Source.destroy(self)
''' from SimPy.Simulation import now, activate, simulate, infinity, initialize from EventGenerator import EventGenerator from Machine import Machine from Source import Source from Exit import Exit from Part import Part from Queue import Queue from Globals import G import ExcelHandler import Globals G.trace = "Yes" S = Source('S1', 'Source', mean=1, item=Part) M1 = Machine('M1', 'Machine1', mean=0.75) Q1 = Queue('Q1', 'Queue1', capacity=infinity) M2 = Machine('M2', 'Machine2', mean=0.75) Q2 = Queue('Q2', 'Queue2', capacity=infinity) E = Exit('E1', 'Exit') #define predecessors and successors for the objects S.defineRouting([M1]) M1.defineRouting([S], [Q1]) Q1.defineRouting([M1], [M2]) M2.defineRouting([Q1], [Q2]) Q2.defineRouting([M2]) argumentDict = {'from': 'Q2', 'to': 'E1', 'safetyStock': 70, 'consumption': 20} EG = EventGenerator(id="EV",
def __init__(self, session): Source.__init__(self) self.records_running = 0 self.session = session session.nav.record_event.append(self.gotRecordEvent) self.gotRecordEvent(None, None) # get initial state
def solved_problems(): """ This is where the collection of solved problems is stored as source. """ # NOT IMPLEMENTED: # ================ # Low hanging # ----------- # 12997ef3.json # 12eac192.json # 1c0d0a4b.json # 2013d3e2.json # 21f83797.json # 2697da3f.json # 4093f84a.json # 4852f2fa.json # 55059096.json # 58743b76.json # Define a new image decomposition, say rulers (where two opposing quadrants are of just one color, rest is trivial) # 60a26a3e.json # 62b74c02.json # 6d0160f0.json # 6f473927.json # 90347967.json # ae58858e.json # af24b4cc.json # b94a9452.json # cd3c21df.json # d47aa2ff.json # e7dd8335.json # ef135b50.json # ef26cbf6.json # f0df5ff0.json # Moving conditions (inhibitory behavior) # --------------------------------------- # 6ad5bdfd.json # 9b4c17c4.json # cf133acc.json # With mandatory state (the color being transmitted) # f3e62deb.json # Patterns in place # ----------------- # 0ca9ddb6.json # 11852cab.json # 321b1fc6.json # 4258a5f9.json # 42918530.json # 88a10436.json # 95990924.json # dc1df850.json # Pattern matching # ---------------- # 50f325b5.json # 7e02026e.json # Properties of pictures as vectors or pics # ----------------------------------------- # 017c7c7b.json # 19bb5feb.json # 1fad071e.json # 27a28665.json # 2a5f8217.json # 3194b014.json # 39a8645d.json # 42a15761.json # 445eab21.json # 44f52bb0.json # 5117e062.json (also 1x1) # 54d82841.json # 5521c0d9.json # 6c434453.json # 6e19193c.json # 6ecd11f4.json # 77fdfe62.json # 794b24be.json # 7c008303.json # 855e0971.json # 963e52fc.json # a61ba2ce.json # ac2e8ecf.json # ae4f1146.json # b0f4d537.json # cbded52d.json # cdecee7f.json # d2abd087.json # d631b094.json # e509e548.json # f8b3ba0a.json # Relations defined by 1x1 hints # ------------------------------ # 070dd51e.json # 1a07d186.json # 22eb0ac0.json # 48d8fb45.json # 56ff96f3.json # 7d18a6fb.json # 992798f6.json # a1570a43.json # aabf363d.json (with despeckle) # af902bf9.json # b7249182.json # dc433765.json # ded97339.json # e9614598.json # f5b8619d.json # Rectangle logic # --------------- # 0a1d4ef5.json (with properties of pictures) # 23b5c85d.json # 25094a63.json # 31adaf00.json # 32597951.json # 3eda0437.json # 6cf79266.json # 8731374e.json # 91714a58.json # a8d7556c.json # e76a88a6.json # Despeckle # --------- # 0607ce86.json # 42a50994.json # Floodfill # --------- # 00d62c1b.json # 67b4a34d.json # 7447852a.json # 7c8af763.json # 83302e8f.json # 84db8fc4.json # 9edfc990.json # aa18de87.json # e0fb7511.json # Move layers # ----------- # bbc9ae5d.json # feca6190.json # Dictionary output # ----------------- # 9110e3c5.json # Tiling # ------ # 539a4f51.json # 8719f442.json # 8b28cd80.json # cad67732.json # 91413438.json # 93b4f4b3.json # Reconstruction # -------------- # 0934a4d8.json # 1b60fb0c.json # 1e97544e.json # 4c5c2cf0.json # 903d1b4a.json # 929ab4e9.json # 9ecd008a.json # c663677b.json # e95e3d8e.json # f9012d9b.json # f9d67f8b.json solved = { '00576224.json': Source(('get_question', 'pic_all_as_pat', 'pat_flip_left_right', 'pat_as_pic', 'sto_a', 'get_a', '2pic_cbind', 'get_a', '2pic_cbind', 'get_question', 'get_question', '2pic_cbind', 'get_question', '2pic_cbind', 'sto_a', '2pic_rbind', 'get_a', 'swap_top2', '2pic_rbind')), '007bbfb7.json': Source(('get_question', 'get_question', '2pic_multiply')), '0520fde7.json': Source(('get_question', 'pic_fork_on_v_axis_as_pics', 'pics_as_2pic', '2pic_and_masks_to_1', '(1, 2)', 'swap_top2', 'pic_intp_recolor')), '0692e18c.json': Source(('get_question', 'get_question', 'pic_two_col_reverse', '2pic_multiply')), '0b148d64.json': Source(('get_question', 'pic_fork_by_color_as_pics', 'pics_filter_single_color', 'pics_as_pic')), '0bb8deee.json': Source( ('(0, 1)', 'get_question', 'pic_shape_on_auto_grid', 'pic_intp_recolor', 'get_question', 'pic_fork_on_auto_grid_as_pics', 'pics_pic_multiply_as_pic')), '0c786b71.json': Source( ('(0, 0, 3, 0)', '(0, 4, 0, 0)', 'get_question', 'pic_all_as_pat', 'pat_flip_up_down', 'pat_flip_left_right', 'pat_as_pic', 'pic_nesw_extend', 'pic_all_as_pat', 'sto_a', 'pat_flip_left_right', 'get_a', '2pat_merge_as_pic', 'pic_nesw_extend', 'pic_all_as_pat', 'sto_a', 'pat_flip_up_down', 'get_a', '2pat_merge_as_pic')), '0c9aba6e.json': Source( ('get_question', 'pic_fork_on_h_axis_as_pics', 'pics_as_2pic', '2pic_maximum', '(0, 8)', 'swap_top2', 'pic_intp_recolor', '(6, 0)', 'swap_top2', 'pic_intp_recolor', '(2, 0)', 'swap_top2', 'pic_intp_recolor')), '0d3d703e.json': Source( ('get_question', '(1, 5)', 'swap_top2', 'pic_intp_swap_colors', '(2, 6)', 'swap_top2', 'pic_intp_swap_colors', '(3, 4)', 'swap_top2', 'pic_intp_swap_colors', '(8, 9)', 'swap_top2', 'pic_intp_swap_colors')), '1190e5a7.json': Source(('get_question', 'pic_fork_on_auto_grid_as_pics', 'pics_main_color_as_vec', 'get_question', 'pic_shape_on_auto_grid', 'pic_vec_recolor_each')), '15696249.json': Source(('get_question', 'pic_filter_axes', 'get_question', '2pic_multiply')), '195ba7dc.json': Source( ('get_question', 'pic_fork_on_v_axis_as_pics', 'pics_as_2pic', '2pic_maximum', '(7, 1)', 'swap_top2', 'pic_intp_recolor')), '1b2d62fb.json': Source( ('get_question', 'pic_fork_on_v_axis_as_pics', 'pics_as_2pic', '2pic_maximum', '(0, 8)', 'swap_top2', 'pic_intp_swap_colors', '(9, 0)', 'swap_top2', 'pic_intp_swap_colors')), '1cf80156.json': Source(('get_question', 'pic_fork_by_color_as_pics', 'pics_filter_single_color', 'pics_as_pic')), '1e0a9b12.json': Source(('(0, 0, 1, 0)', 'get_question', 'pic_nesw_gravity', '(0, 0, 1, 0)', 'swap_top2', 'pic_nesw_gravity', '(0, 0, 1, 0)', 'swap_top2', 'pic_nesw_gravity', '(0, 0, 1, 0)', 'swap_top2', 'pic_nesw_gravity', '(0, 0, 1, 0)', 'swap_top2', 'pic_nesw_gravity')), '1f85a75f.json': Source(('get_question', 'pic_fork_by_color_as_pics', 'pics_filter_single_color', 'pics_as_pic')), '2072aba6.json': Source(('[[1, 2], [2, 1]]', '(6,)', 'int_black_box_as_pic', '2pic_tile_all', '(2,)', 'get_question', 'pic_int_zoom_in', '2pic_recolor_any_rtl')), '25d8a9c8.json': Source(('(5,)', 'get_question', 'pic_filter_axes', 'pic_int_recolor_all')), '25ff71a9.json': Source(('get_question', 'pic_all_as_pat', '(0, 0, 1, 0)', 'swap_top2', 'pat_nesw_drag_all', 'pat_as_pic')), '27f8ce4f.json': Source(('get_question', 'pic_filter_mostfreq_col', 'get_question', '2pic_multiply')), '2dc579da.json': Source(('get_question', 'pic_fork_on_auto_grid_as_pics', 'pics_filter_unique_picture_as_pic')), '310f3251.json': Source(('(0, 1)', '(3,)', 'int_black_box_as_pic', 'pic_intp_recolor', '(2,)', '(1, 0, 0, 1)', 'get_question', 'pic_all_as_pat', 'pat_nesw_drag_all', 'pat_as_pic', 'pic_int_recolor_all', 'pic_all_as_pat', 'get_question', 'pic_all_as_pat', '2pat_merge_as_pic', '2pic_multiply')), '31d5ba1a.json': Source( ('(1, 6)', 'get_question', 'pic_fork_on_h_axis_as_pics', 'pics_as_2pic', '2pic_xor_masks_to_1', 'pic_intp_recolor')), '332efdb3.json': Source(('get_question', '[[1, 1], [1, 0]]', 'swap_top2', '2pic_tile_all')), '3428a4f5.json': Source(('get_question', 'pic_fork_on_h_axis_as_pics', 'pics_as_2pic', '2pic_xor_masks_to_1', '(1, 3)', 'swap_top2', 'pic_intp_recolor')), '34b99a2b.json': Source(('get_question', 'pic_fork_on_v_axis_as_pics', 'pics_as_2pic', '2pic_xor_masks_to_1', '(1, 2)', 'swap_top2', 'pic_intp_recolor')), '3618c87e.json': Source(('get_question', 'pic_fork_color_rest_black_as_pics', 'pics_as_2pic', 'sto_a', 'swap_top2', '(0, 0, 1, 0)', 'swap_top2', 'pic_nesw_gravity', '(0, 0, 1, 0)', 'swap_top2', 'pic_nesw_gravity', '(0, 0, 1, 0)', 'swap_top2', 'pic_nesw_gravity', '(1, 9)', 'swap_top2', 'pic_intp_recolor', 'get_a', '2pic_maximum', '(9, 1)', 'swap_top2', 'pic_intp_recolor')), '3906de3d.json': Source(('get_question', '(1, 0, 0, 0)', 'swap_top2', 'pic_nesw_gravity', '(1, 0, 0, 0)', 'swap_top2', 'pic_nesw_gravity', '(1, 0, 0, 0)', 'swap_top2', 'pic_nesw_gravity', '(1, 0, 0, 0)', 'swap_top2', 'pic_nesw_gravity', '(1, 0, 0, 0)', 'swap_top2', 'pic_nesw_gravity', '(1, 0, 0, 0)', 'swap_top2', 'pic_nesw_gravity', '(1, 0, 0, 0)', 'swap_top2', 'pic_nesw_gravity', '(1, 0, 0, 0)', 'swap_top2', 'pic_nesw_gravity', '(1, 0, 0, 0)', 'swap_top2', 'pic_nesw_gravity')), '3af2c5a8.json': Source(('(0, 4, 0, 0)', 'get_question', 'pic_nesw_extend', 'pic_all_as_pat', 'sto_a', 'pat_flip_left_right', 'get_a', '2pat_merge_as_pic', '(0, 0, 3, 0)', 'swap_top2', 'pic_nesw_extend', 'pic_all_as_pat', 'sto_a', 'pat_flip_up_down', 'get_a', '2pat_merge_as_pic')), '3c9b0459.json': Source(('get_question', 'pic_all_as_pat', 'pat_flip_up_down', 'pat_flip_left_right', 'pat_as_pic')), '423a55dc.json': Source(('get_question', 'pic_base_height_as_int', 'get_question', 'pic_int_slide_rows_west')), '4347f46a.json': Source(('get_question', 'pic_outline_4n')), '46442a0e.json': Source(('get_question', 'pic_rotate_90ccw', 'sto_a', 'pic_rotate_90ccw', 'sto_b', 'pic_rotate_90ccw', 'get_question', '2pic_cbind', 'get_b', 'get_a', '2pic_cbind', 'swap_top2', '2pic_rbind')), '46f33fce.json': Source(('get_question', '(2,)', 'swap_top2', 'pic_int_zoom_out', '(4,)', 'swap_top2', 'pic_int_zoom_in')), '48131b3c.json': Source(('get_question', 'pic_two_col_reverse', 'sto_a', 'get_a', '2pic_cbind', 'sto_a', 'get_a', '2pic_rbind')), '48f8583b.json': Source(('get_question', 'pic_filter_leastfreq_col', 'get_question', '2pic_multiply')), '496994bd.json': Source(('get_question', 'pic_all_as_pat', 'pat_flip_up_down', 'get_question', 'pic_all_as_pat', '2pat_merge_as_pic')), '4be741c5.json': Source(('get_question', 'pic_distinct_border_colors')), '4c4377d9.json': Source(('(0, 0, 3, 0)', 'get_question', 'pic_all_as_pat', 'pat_flip_up_down', 'pat_as_pic', 'pic_nesw_extend', 'pic_all_as_pat', 'sto_a', 'pat_flip_up_down', 'get_a', '2pat_merge_as_pic')), '506d28a5.json': Source( ('get_question', 'pic_fork_on_h_axis_as_pics', 'pics_as_2pic', '2pic_maximum', '(1, 3)', 'swap_top2', 'pic_intp_recolor', '(2, 3)', 'swap_top2', 'pic_intp_recolor')), '5582e5ca.json': Source(('get_question', 'pic_fork_on_auto_grid_as_pics', 'pics_main_color_as_vec', 'vec_row_as_pic', 'get_question', '2pic_tile_all')), '5614dbcf.json': Source( ('get_question', '(4, 5)', 'swap_top2', 'pic_intp_swap_colors', '(3, 3)', 'swap_top2', 'pic_intp_zoom_fit', '(4, 0)', 'swap_top2', 'pic_intp_recolor', '(4, 5)', 'swap_top2', 'pic_intp_swap_colors')), '5783df64.json': Source(('(3, 3)', 'get_question', 'pic_intp_zoom_fit')), '59341089.json': Source(('get_question', 'get_question', 'pic_all_as_pat', 'pat_flip_left_right', 'pat_as_pic', '2pic_cbind', 'sto_a', 'get_a', '2pic_cbind')), '5b6cbef5.json': Source(('get_question', 'get_question', '2pic_multiply')), '5bd6f4ac.json': Source(('get_question', '(0, 6)', '(3, 3)', 'swap_top3', 'pic_2intp_crop')), '5d2a5c43.json': Source( ('get_question', 'pic_fork_on_v_axis_as_pics', 'pics_as_2pic', '2pic_maximum', '(4, 8)', 'swap_top2', 'pic_intp_recolor')), '60c09cac.json': Source(('get_question', '(2,)', 'swap_top2', 'pic_int_zoom_in')), '6150a2bd.json': Source(('get_question', 'pic_all_as_pat', 'pat_flip_up_down', 'pat_flip_left_right', 'pat_as_pic')), '62c24649.json': Source(('(0, 0, 3, 0)', '(0, 3, 0, 0)', 'get_question', 'pic_nesw_extend', 'pic_all_as_pat', 'sto_a', 'pat_flip_left_right', 'get_a', '2pat_merge_as_pic', 'pic_nesw_extend', 'pic_all_as_pat', 'sto_a', 'pat_flip_up_down', 'get_a', '2pat_merge_as_pic')), '6430c8c4.json': Source( ('get_question', 'pic_fork_on_h_axis_as_pics', 'pics_as_2pic', '2pic_maximum', '(0, 3)', 'swap_top2', 'pic_intp_recolor', '(7, 0)', 'swap_top2', 'pic_intp_recolor', '(2, 0)', 'swap_top2', 'pic_intp_recolor')), '66e6c45b.json': Source( ('(2, 2)', '(1, 1)', 'get_question', 'pic_2intp_crop', '(1,)', 'swap_top2', 'pic_int_copy_border', 'sto_a', 'pic_corners', 'get_a', 'swap_top2', '2pic_recolor_any_rtl')), '66f2d22f.json': Source(('get_question', 'pic_fork_on_v_axis_as_pics', 'pics_as_2pic', '2pic_maximum', '(3, 5)', 'swap_top2', 'pic_intp_recolor', '(2, 5)', 'swap_top2', 'pic_intp_recolor', 'pic_two_col_reverse')), '67a3c6ac.json': Source(('get_question', 'pic_all_as_pat', 'pat_flip_left_right', 'pat_as_pic')), '67e8384a.json': Source(('(0, 0, 3, 0)', '(0, 3, 0, 0)', 'get_question', 'pic_nesw_extend', 'pic_all_as_pat', 'sto_a', 'pat_flip_left_right', 'get_a', '2pat_merge_as_pic', 'pic_nesw_extend', 'pic_all_as_pat', 'sto_a', 'pat_flip_up_down', 'get_a', '2pat_merge_as_pic')), '68b16354.json': Source(('get_question', 'pic_all_as_pat', 'pat_flip_up_down', 'pat_as_pic')), '68b67ca3.json': Source(('(2,)', 'get_question', 'pic_int_zoom_out')), '6d0aefbc.json': Source(('(0, 3, 0, 0)', 'get_question', 'pic_nesw_extend', 'pic_all_as_pat', 'sto_a', 'pat_flip_left_right', 'get_a', '2pat_merge_as_pic')), '6ea4a07e.json': Source(('(8, 2)', '(1, 3)', '(4, 5)', 'get_question', 'pic_two_col_reverse', 'pic_intp_swap_colors', 'pic_intp_swap_colors', 'pic_intp_swap_colors')), '6f8cd79b.json': Source(('(8,)', 'get_question', 'pic_int_empty_border')), '6fa7a44f.json': Source(('(0, 0, 3, 0)', 'get_question', 'pic_nesw_extend', 'pic_all_as_pat', 'sto_a', 'pat_flip_up_down', 'get_a', '2pat_merge_as_pic')), '7039b2d7.json': Source(('get_question', 'pic_fork_on_auto_grid_as_pics', 'pics_main_color_as_vec', 'get_question', 'pic_shape_on_auto_grid', 'pic_vec_recolor_each')), '72ca375d.json': Source(('get_question', 'pic_fork_by_color_as_pics', 'pics_filter_v_symmetric', 'pics_as_pic')), '7468f01a.json': Source( ('get_question', '(8, 5)', 'swap_top2', 'pic_intp_swap_colors', '(4, 9)', 'swap_top2', 'pic_intp_swap_colors', '(1, 7)', 'swap_top2', 'pic_intp_swap_colors', 'pic_fork_by_color_as_pics', 'pics_as_2pic', 'pic_all_as_pat', 'pat_flip_left_right', 'pat_as_pic', '(8, 5)', 'swap_top2', 'pic_intp_swap_colors', '(4, 9)', 'swap_top2', 'pic_intp_swap_colors', '(1, 7)', 'swap_top2', 'pic_intp_swap_colors')), '746b3537.json': Source(('get_question', 'pic_distinct_border_colors')), '74dd1130.json': Source(('get_question', 'pic_transpose')), '780d0b14.json': Source(('get_question', 'pic_fork_on_auto_grid_as_pics', 'pics_main_color_as_vec', 'get_question', 'pic_shape_on_auto_grid', 'pic_vec_recolor_each')), '7953d61e.json': Source(('get_question', 'pic_rotate_90ccw', 'sto_a', 'pic_rotate_90ccw', 'sto_b', 'pic_rotate_90ccw', 'get_a', 'get_question', '2pic_cbind', 'swap_top2', 'get_b', '2pic_cbind', 'swap_top2', '2pic_rbind')), '7b7f7511.json': Source(('get_question', 'pic_autohalves_as_pics', 'pics_as_2pic')), '7fe24cdd.json': Source(('get_question', 'pic_rotate_90ccw', 'sto_a', 'pic_rotate_90ccw', 'sto_b', 'pic_rotate_90ccw', 'get_question', '2pic_cbind', 'get_b', 'get_a', '2pic_cbind', 'swap_top2', '2pic_rbind')), '833dafe3.json': Source(('get_question', 'get_question', 'pic_all_as_pat', 'pat_flip_left_right', 'pat_as_pic', '2pic_cbind', 'sto_a', 'pic_all_as_pat', 'pat_flip_up_down', 'pat_as_pic', 'get_a', 'swap_top2', '2pic_rbind')), '88a62173.json': Source(('get_question', 'pic_fork_on_auto_grid_as_pics', 'pics_filter_unique_picture_as_pic')), '8be77c9e.json': Source(('(0, 0, 3, 0)', 'get_question', 'pic_nesw_extend', 'pic_all_as_pat', 'sto_a', 'pat_flip_up_down', 'get_a', '2pat_merge_as_pic')), '8d5021e8.json': Source(('get_question', 'get_question', 'pic_all_as_pat', 'pat_flip_left_right', 'pat_as_pic', '2pic_cbind', 'sto_a', 'pic_all_as_pat', 'pat_flip_up_down', 'pat_as_pic', 'sto_b', 'get_a', '2pic_rbind', 'get_b', '2pic_rbind')), '8e2edd66.json': Source(('get_question', 'pic_two_col_reverse', 'sto_a', 'get_a', '2pic_multiply')), '8f2ea7aa.json': Source(('get_question', 'pic_fork_by_color_as_pics', 'pics_as_pic', 'sto_a', 'get_a', '2pic_multiply')), '9172f3a0.json': Source(('get_question', '(3,)', 'swap_top2', 'pic_int_zoom_in')), '94f9d214.json': Source( ('get_question', 'pic_fork_on_h_axis_as_pics', 'pics_as_2pic', '2pic_maximum', '(0, 2)', 'swap_top2', 'pic_intp_recolor', '(1, 0)', 'swap_top2', 'pic_intp_recolor', '(3, 0)', 'swap_top2', 'pic_intp_recolor')), '9565186b.json': Source(('get_question', 'pic_filter_mostfreq_col', '(0, 5)', 'swap_top2', 'pic_intp_recolor')), '99b1bc43.json': Source(('get_question', 'pic_fork_on_h_axis_as_pics', 'pics_as_2pic', '2pic_xor_masks_to_1', '(1, 3)', 'swap_top2', 'pic_intp_recolor')), '9ddd00f0.json': Source( ('get_question', 'pic_all_as_pat', 'sto_a', 'pat_flip_up_down', 'get_a', '2pat_merge_as_pic', 'get_question', 'pic_rotate_90ccw', 'sto_a', '2pic_maximum', 'pic_all_as_pat', 'sto_a', 'pat_flip_up_down', 'get_a', '2pat_merge_as_pic')), '9dfd6313.json': Source(('get_question', 'pic_transpose')), '9f236235.json': Source(('get_question', 'pic_fork_on_auto_grid_as_pics', 'pics_main_color_as_vec', 'get_question', 'pic_shape_on_auto_grid', 'pic_vec_recolor_each', 'pic_all_as_pat', 'pat_flip_left_right', 'pat_as_pic')), 'a416b8f3.json': Source(('get_question', 'get_question', '2pic_cbind')), 'a59b95c0.json': Source(('(0, 1)', 'get_question', 'pic_all_colors_as_vec', 'vec_length_as_int', 'int_black_box_as_pic', 'pic_intp_recolor', 'get_question', '2pic_multiply')), 'a79310a0.json': Source(('get_question', 'pic_all_as_pat', '(0, 0, 1, 0)', 'swap_top2', 'pat_nesw_drag_all', 'pat_as_pic', '(8, 2)', 'swap_top2', 'pic_intp_recolor')), 'a8610ef7.json': Source(('get_question', 'pic_all_as_pat', 'pat_flip_up_down', 'pat_as_pic', 'get_question', '2pic_and_masks_to_1', '(1, 2)', 'swap_top2', 'pic_intp_recolor', 'get_question', '(8, 1)', 'swap_top2', 'pic_intp_recolor', '2pic_maximum', '(1, 5)', 'swap_top2', 'pic_intp_recolor')), 'a87f7484.json': Source(('get_question', '(3, 3)', 'swap_top2', 'pic_intp_fork_on_shape_as_pics', 'pics_filter_unique_pattern_as_pic')), 'ac0a08a4.json': Source(('get_question', 'pic_all_colors_as_vec', 'vec_length_as_int', 'get_question', 'pic_int_zoom_in')), 'ad7e01d0.json': Source(('(5,)', 'get_question', 'pic_int_filter_color', 'get_question', '2pic_multiply')), 'b1948b0a.json': Source(('get_question', '(2, 6)', 'swap_top2', 'pic_intp_swap_colors')), 'b4a43f3b.json': Source(('get_question', 'pic_fork_on_h_axis_as_pics', 'pics_as_2pic', 'swap_top2', '(2,)', 'swap_top2', 'pic_int_zoom_out', '2pic_multiply')), 'b91ae062.json': Source(('get_question', 'pic_all_colors_as_vec', 'vec_length_as_int', 'get_question', 'pic_int_zoom_in')), 'bbb1b8b6.json': Source(('get_question', 'pic_fork_on_v_axis_as_pics', 'pics_as_2pic', 'pic_all_as_pat', 'swap_top2', 'pic_all_as_pat', '2pat_merge_if_disjoint_as_pic')), 'bc4146bd.json': Source( ('get_question', 'get_question', 'pic_all_as_pat', 'pat_flip_left_right', 'pat_as_pic', 'get_question', '2pic_cbind', 'sto_a', 'get_a', '2pic_cbind', '2pic_cbind')), 'bd4472b8.json': Source(('get_question', 'pic_fork_on_auto_grid_as_pics', 'pics_as_2pic', '(0, 1)', 'swap_top2', 'pic_intp_recolor', 'swap_top2', 'pic_transpose', 'swap_top2', '2pic_recolor_any_rtl', '(2, 0, 0, 0)', 'swap_top2', 'pic_nesw_extend', 'pic_all_as_pat', 'get_question', 'pic_all_as_pat', '2pat_merge_as_pic')), 'be03b35f.json': Source(('get_question', 'pic_fork_by_color_as_pics', 'pics_as_2pic', '2pic_tile_all', 'pic_rotate_90ccw')), 'c3202e5a.json': Source(('get_question', 'pic_fork_on_auto_grid_as_pics', 'pics_filter_single_color', 'pics_as_pic')), 'c3e719e8.json': Source(('get_question', 'pic_filter_mostfreq_col', 'get_question', '2pic_multiply')), 'c48954c1.json': Source(('get_question', 'pic_all_as_pat', 'pat_flip_left_right', 'pat_as_pic', 'sto_a', 'get_question', '2pic_cbind', 'get_a', '2pic_cbind', 'sto_a', 'pic_all_as_pat', 'pat_flip_up_down', 'pat_as_pic', 'sto_b', 'get_a', '2pic_rbind', 'get_b', '2pic_rbind')), 'c59eb873.json': Source(('get_question', '(2,)', 'swap_top2', 'pic_int_zoom_in')), 'c7d4e6ad.json': Source(('(0, 1)', 'get_question', 'pic_intp_select_columns', 'get_question', '(1, 5)', 'swap_top2', 'pic_intp_swap_colors', '2pic_recolor_any_rtl')), 'c9e6f938.json': Source(('(0, 3, 0, 0)', 'get_question', 'pic_nesw_extend', 'pic_all_as_pat', 'sto_a', 'pat_flip_left_right', 'get_a', '2pat_merge_as_pic')), 'c9f8e694.json': Source(('(0, 1)', 'get_question', 'pic_intp_select_columns', 'get_question', '2pic_recolor_any_rtl')), 'ccd554ac.json': Source(('(0, 1)', 'get_question', 'pic_intp_recolor', 'get_question', '2pic_multiply')), 'cce03e0d.json': Source(('(2,)', 'get_question', 'pic_int_filter_color', 'get_question', '2pic_multiply')), 'ce4f8723.json': Source( ('get_question', 'pic_fork_on_h_axis_as_pics', 'pics_as_2pic', '2pic_maximum', '(1, 3)', 'swap_top2', 'pic_intp_recolor', '(2, 3)', 'swap_top2', 'pic_intp_recolor')), 'ce039d91.json': Source( ('get_question', 'pic_all_as_pat', 'pat_flip_left_right', 'pat_as_pic', 'get_question', '2pic_and_masks_to_1', '(1, 9)', 'swap_top2', 'pic_intp_recolor', 'get_question', '2pic_maximum', '(9, 1)', 'swap_top2', 'pic_intp_recolor')), 'd10ecb37.json': Source(('get_question', 'pic_outline_4n', '(2, 2)', '(1, 1)', 'get_question', 'pic_2intp_crop', '2pic_tile_all')), 'd13f3404.json': Source(('(0, 3, 3, 0)', 'get_question', 'pic_nesw_extend', 'pic_all_as_pat', 'sto_a', '(0, 1, 1, 0)', 'get_a', 'pat_nesw_drag_all', 'sto_a', '(0, 1, 1, 0)', 'get_a', 'pat_nesw_drag_all', 'sto_a', '(0, 1, 1, 0)', 'get_a', 'pat_nesw_drag_all', 'sto_a', '(0, 1, 1, 0)', 'get_a', 'pat_nesw_drag_all', 'sto_a', '(0, 1, 1, 0)', 'get_a', 'pat_nesw_drag_all', '2pat_merge', '2pat_merge', '2pat_merge', '2pat_merge', '2pat_merge_as_pic')), 'd19f7514.json': Source( ('get_question', 'pic_fork_on_h_axis_as_pics', 'pics_as_2pic', '2pic_maximum', '(4, )', 'swap_top2', 'pic_int_recolor_all')), 'd23f8c26.json': Source(('(10, 0)', 'get_question', '(1, 10)', 'get_question', 'pic_v_axis', 'pic_intp_recolor', '2pic_recolor_any_rtl', 'pic_intp_recolor')), 'd406998b.json': Source(('get_question', '[[0, 3]]', 'swap_top2', '2pic_recolor_any_rtl')), 'd4b1c2b1.json': Source(('get_question', 'pic_all_colors_as_vec', 'vec_length_as_int', 'get_question', 'pic_int_zoom_in')), 'd511f180.json': Source(('get_question', '(5, 8)', 'swap_top2', 'pic_intp_swap_colors')), 'd56f2372.json': Source(('get_question', 'pic_fork_by_color_as_pics', 'pics_filter_v_symmetric', 'pics_as_pic')), 'dae9d2b5.json': Source( ('get_question', 'pic_fork_on_v_axis_as_pics', 'pics_as_2pic', '2pic_maximum', '(3, 6)', 'swap_top2', 'pic_intp_recolor', '(4, 6)', 'swap_top2', 'pic_intp_recolor')), 'e133d23d.json': Source( ('get_question', 'pic_fork_on_v_axis_as_pics', 'pics_as_2pic', '2pic_maximum', '(6, 2)', 'swap_top2', 'pic_intp_recolor', '(8, 2)', 'swap_top2', 'pic_intp_recolor')), 'e345f17b.json': Source(('get_question', 'pic_fork_on_v_axis_as_pics', 'pics_as_2pic', '2pic_maximum', '(4, )', 'swap_top2', 'pic_int_recolor_all', 'pic_two_col_reverse')), 'e3497940.json': Source(('get_question', 'pic_fork_on_v_axis_as_pics', 'pics_as_2pic', 'pic_all_as_pat', 'pat_flip_left_right', 'pat_as_pic', '2pic_maximum')), 'e633a9e5.json': Source(('(1,)', 'get_question', 'pic_int_copy_border')), 'e98196ab.json': Source(('get_question', 'pic_fork_on_h_axis_as_pics', 'pics_as_2pic', '2pic_maximum')), 'e99362f0.json': Source( ('get_question', '(5, 9)', 'swap_top2', 'pic_intp_swap_colors', 'pic_fork_on_auto_grid_as_pics', 'pics_maximum_as_pic', '(5, 9)', 'swap_top2', 'pic_intp_swap_colors')), 'ed36ccf7.json': Source(('get_question', 'pic_rotate_90ccw')), 'ed98d772.json': Source(('get_question', 'pic_rotate_90ccw', 'sto_a', 'pic_rotate_90ccw', 'sto_b', 'pic_rotate_90ccw', 'get_a', 'get_question', '2pic_cbind', 'swap_top2', 'get_b', '2pic_cbind', 'swap_top2', '2pic_rbind')), 'f25fbde4.json': Source(('get_question', 'pic_fork_by_color_as_pics', 'pics_as_pic', '(2,)', 'swap_top2', 'pic_int_zoom_in')), 'f25ffba3.json': Source(('get_question', 'pic_all_as_pat', 'sto_a', 'pat_flip_up_down', 'get_a', '2pat_merge_as_pic')), 'f2829549.json': Source( ('get_question', 'pic_fork_on_v_axis_as_pics', 'pics_as_2pic', '2pic_maximum', '(0, 3)', 'swap_top2', 'pic_intp_swap_colors', '(7, 0)', 'swap_top2', 'pic_intp_recolor', '(5, 0)', 'swap_top2', 'pic_intp_recolor')), 'f76d97a5.json': Source(('get_question', 'pic_two_col_reverse', 'sto_a', '(5, 0)', 'swap_top2', 'pic_intp_recolor')), 'fafffa47.json': Source( ('get_question', 'pic_fork_on_h_axis_as_pics', 'pics_as_2pic', '2pic_maximum', '(0, 2)', 'swap_top2', 'pic_intp_swap_colors', '(1, 0)', 'swap_top2', 'pic_intp_recolor', '(9, 0)', 'swap_top2', 'pic_intp_recolor')), 'fc754716.json': Source(('get_question', 'pic_all_colors_as_vec', 'vec_as_int', 'get_question', 'pic_int_empty_border')) } return solved
def __init__(self, root, command_func=None, validate_commands=True): Source.__init__(self) self.root = root self.command_func = command_func self.validate_commands = validate_commands
def add_source(self, tag, m, x, y): s = Source(self.plot, tag, m, x, y, ElementTypes["source"], self.watcher) self.__sources[tag] = s s.draw() return s
def _add3FGLSources(self): """Extract sources from the 3FGL catalog file Parameters: - self - This CatalogSourceExtractor object Return value: - none - Sets the self.sources variable to a list of source objects Usage: self._add3FGLSources() Description: This function loops over all of the sources in the 3FGL catalog file and extracts all those that lie within 5 degrees of the ROI. It creates Source objects for each on assigning it the appropriate spectral and spatial models based on the data provided in the catalog. Each model is added to the object's local list of sources. """ file = self.catFile.fitsFilePtr # file=pyfits.open(self.catParams['catalogFile']) #open source list file and access necessary fields, requires LAT source catalog definitions and names data=file[1].data extendedinfo=file[5].data extName=extendedinfo.field('Source_Name') extFile=extendedinfo.field('Spatial_Filename') name=data.field('Source_Name') ExtName=data.field('Extended_Source_Name') ra=data.field('RAJ2000') dec=data.field('DEJ2000') flux=data.field('Flux_Density') pivot=data.field('Pivot_Energy') index=data.field('Spectral_Index') cutoff=data.field('Cutoff') spectype=data.field('SpectrumType') beta=data.field('beta') sigma=data.field('Signif_Avg') ptSrcNum = 0 extSrcNum = 0 for n,f,i,r,d,p,c,t,b,S,EN in zip(name,flux,index,ra,dec,pivot,cutoff,spectype,beta,sigma,ExtName): dist=angsep(self.ra,self.dec,r,d) # get distance from object to ROI center if (r==self.ra and d==self.dec): # just to avoid any small number errors dist = 0.0 if (dist <= self.radius+5.0): # object is in target area sourceName='' for N in n.split(' '): # remove spaces from name sourceName+=N if EN!='' and not self.catParams['forcePointSource']: # We're making an extended source model extSrcNum+=1 Name = (EN if not EN[0].isdigit() else "_"+EN) # add an underscore to prevent string/number issues if name starts with a digit Type = "DiffuseSource" else: # we're building a point source model ptSrcNum+=1 Name = (sourceName if not sourceName[0].isdigit() else "_"+sourceName) # add an underscore to prevent string/number issues if name starts with a digit Type = "PointSource" source = Source(name = Name, type = Type) if EN!='Vela X' and EN!='MSH 15-52': if t=='PowerLaw': self._PLspec(source,f,i,p,dist,S) elif t=='PowerLaw2':#no value for flux from 100 MeV to 100 GeV in fits file0 if i!=1.:#so calculate it by integrating PowerLaw spectral model F=f*p**i/(-i+1)*(1.e5**(-i+1)-1.e2**(-1+1)) else: F=f*p*log(1.e3) self._PL2spec(source,F,i,dist,S) elif t=='LogParabola': self._LPspec(source,f,i,p,b,dist,S) else: self._COspec(source,f,i,p,c,dist,S) else: if EN=='Vela X': self._VXspec(source,i,dist) else: self._MSHspec(source,i,dist) if EN!='' and not self.catParams['forcePointSource']: eFile=None for exN,exf in zip(extName,extFile): if exN==EN: if len(self.catParams['extTempDir'])>0: if self.catParams['extTempDir'][-1]=='/': eFile=self.catParams['extTempDir']+exf else: eFile=self.catParams['extTempDir']+'/'+exf else: eFile=exf break if eFile==None: showError("The model template file for" + n + " does to seem to exist in the specified directory. Please update model file parameter by hand.") spatialModel = SpatialModel(type="SpatialMap",file = self.catParams['extTempDir']) else: spatialModel = SpatialModel(type="SpatialMap",file = eFile) else: ra = Parameter(name="RA",value = r, scale = 1.0, min = 0.0, max = 360.0, free = False) dec = Parameter(name="DEC",value = d, scale = 1.0, min = -90.0, max = 90.0, free = False) spatialModel = SpatialModel(type="SkyDirFunction",parameters=[ra,dec]) source.setSpatialModel(spatialModel) if (None == self.sources): self.sources = [] self.sources.append(source) # Set Galactic Diffuse model gdSpatial = SpatialModel(type="MapCubeFunction", file=self.catParams['galDiffFile']) gdSource = Source(name=self.catParams['gdModelName'], type='DiffuseSource',spatialModel=gdSpatial) #default spectrum is PowerLaw # but we need to fix the index spec = gdSource.getSpectrum() index = spec.getParameterByName("Index") index.setFree(False) spec.setParameterByName("Index",index) gdSource.setSpectrum(spec) self.sources.append(gdSource) # Set isotropic diffuse source if (None == self.catParams['isoTempFile']): #null means no file so assume user wants an isotropic power law component isoSpectrum = Specturm() # create a default PowerLaw Spectrum Name='<source name="%s" type="DiffuseSource">\n' %ISOn else: #if a file is given assume it is an isotropic template isoSpectrum = Spectrum(type="FileFunction", file = self.catParams['isoTempFile']) #both of the above options use the same spatial model isoSpatial = SpatialModel(type="ConstantValue") isoSource = Source(name= self.catParams['isTempName'], type="DiffuseSource", spectrum=isoSpectrum, spatialModel=isoSpatial) self.sources.append(isoSource)