rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
username = urllib.quote_plus(username) | username = urllib.quote(username, safe='') | def url_add_authentication(url, username, password): """ Adds authentication data (username, password) to a given URL in order to construct an authenticated URL. >>> url_add_authentication('https://host.com/', '', None) 'https://host.com/' >>> url_add_authentication('http://example.org/', None, None) 'http://example.o... |
password = urllib.quote_plus(password) | password = urllib.quote(password, safe='') | def url_add_authentication(url, username, password): """ Adds authentication data (username, password) to a given URL in order to construct an authenticated URL. >>> url_add_authentication('https://host.com/', '', None) 'https://host.com/' >>> url_add_authentication('http://example.org/', None, None) 'http://example.o... |
log('Cannot update device %s: %s', uid, str(e), sender=self, traceback=True) | log('Cannot update device %s: %s', self.device_id, str(e), sender=self, traceback=True) | def update_device(self, action): try: log('Uploading device settings...', sender=self) self._client.update_device_settings(action.device_id, \ action.caption, action.device_type) log('Device settings uploaded.', sender=self) return True except Exception, e: log('Cannot update device %s: %s', uid, str(e), sender=self, t... |
dependency_manager.depend_on(_('Bluetooth file transfer'), _('Send podcast episodes to Bluetooth devices. Needs the bluetooth-sendto command from gnome-bluetooth.'), ['bluetooth'], ['bluetooth-sendto']) | dependency_manager.depend_on(_('Bluetooth file transfer'), _('Send podcast episodes to Bluetooth devices. Needs the bluetooth-sendto command from gnome-bluetooth.'), [], ['bluetooth-sendto']) | def tools_available(self, tools): """ See modules_available. """ result = {} all_available = True for tool in tools: if util.find_command(tool): result[tool] = True else: result[tool] = False all_available = False |
if include_description: | if include_description and self._all_episodes_view: return '%s\n<small>%s</small>' % (xml.sax.saxutils.escape(episode.title), _('from %s') % xml.sax.saxutils.escape(episode.channel.title)) elif include_description: | def _format_description(self, episode, include_description=False, is_downloading=None): if include_description: return '%s\n<small>%s</small>' % (xml.sax.saxutils.escape(episode.title), xml.sax.saxutils.escape(episode.one_line_description())) else: return xml.sax.saxutils.escape(episode.title) |
for channel in self.channels: for episode in channel.get_all_episodes(): yield episode | def all_episodes(): for channel in self.channels: for episode in channel.get_all_episodes(): episode._all_episodes_view = True yield episode return model.PodcastEpisode.sort_by_pubdate(all_episodes(), reverse=True) | def get_all_episodes(self): """Returns a generator that yields every episode""" for channel in self.channels: for episode in channel.get_all_episodes(): yield episode |
selection = self.treeviewEpisodes.get_selection() selection.connect('changed', self.on_selection_changed) | def new( self): self._config.connect_gtk_window(self.gPodderEpisodeSelector, 'episode_selector', True) if not hasattr( self, 'callback'): self.callback = None | |
def on_selection_changed(self, selection): | def on_treeview_button_release(self, widget, event): selection = widget.get_selection() | def on_selection_changed(self, selection): model, iter = selection.get_selected() if iter is not None: model.set_value(iter, self.COLUMN_TOGGLE, \ not model.get_value(iter, self.COLUMN_TOGGLE)) self.calculate_total_size() |
def on_treeview_button_release(self, widget, event): selection = widget.get_selection() self.on_selection_changed(widget.get_selection()) | def on_selection_changed(self, selection): model, iter = selection.get_selected() if iter is not None: model.set_value(iter, self.COLUMN_TOGGLE, \ not model.get_value(iter, self.COLUMN_TOGGLE)) self.calculate_total_size() | |
This will also normalize feed:// and itpc:// to http:// Also supported are phobos.apple.com links (iTunes podcast) and itms:// links (iTunes podcast direct link). | This will also normalize feed:// and itpc:// to http://. | def normalize_feed_url(url): """ Converts any URL to http:// or ftp:// so that it can be used with "wget". If the URL cannot be converted (invalid or unknown scheme), "None" is returned. This will also normalize feed:// and itpc:// to http:// Also supported are phobos.apple.com links (iTunes podcast) and itms:// links... |
do_parse_itunes_xml = (scheme == 'itms') | def normalize_feed_url(url): """ Converts any URL to http:// or ftp:// so that it can be used with "wget". If the URL cannot be converted (invalid or unknown scheme), "None" is returned. This will also normalize feed:// and itpc:// to http:// Also supported are phobos.apple.com links (iTunes podcast) and itms:// links... | |
if do_parse_itunes_xml: url = parse_itunes_xml(url) url = itunes_discover_rss(url) | def normalize_feed_url(url): """ Converts any URL to http:// or ftp:// so that it can be used with "wget". If the URL cannot be converted (invalid or unknown scheme), "None" is returned. This will also normalize feed:// and itpc:// to http:// Also supported are phobos.apple.com links (iTunes podcast) and itms:// links... | |
def parse_itunes_xml(url): """ Parses an XML document in the "url" parameter (this has to be a itms:// or http:// URL to a XML doc) and searches all "<dict>" elements for the first occurence of a "<key>feedURL</key>" element and then continues the search for the string value of this key. This returns the RSS feed URL ... | def parse_itunes_xml(url): """ Parses an XML document in the "url" parameter (this has to be a itms:// or http:// URL to a XML doc) and searches all "<dict>" elements for the first occurence of a "<key>feedURL</key>" element and then continues the search for the string value of this key. This returns the RSS feed URL ... | |
def itunes_discover_rss(url): """ Takes an iTunes-specific podcast URL and turns it into a "normal" RSS feed URL. If the given URL is not a phobos.apple.com URL, we will simply return the URL and assume it's already an RSS feed URL. Idea from Andrew Clarke's itunes-url-decoder.py """ if url is None: return url if no... | def http_get_and_gunzip(uri): """ Does a HTTP GET request and tells the server that we accept gzip-encoded data. This is necessary, because the Apple iTunes server will always return gzip-encoded data, regardless of what we really request. Returns the uncompressed document at the given URI. """ request = urllib2.Reque... | |
pixbuf = gtk.gdk.pixbuf_new_from_file(channel.cover_file) | pixbuf = gtk.gdk.pixbuf_new_from_file(util.sanitize_encoding(channel.cover_file)) | def __get_cover(self, channel, url, async=False, avoid_downloading=False): if not async and avoid_downloading and not os.path.exists(channel.cover_file): return (channel.url, self.get_default_cover(channel)) |
if self._config.sync_disks_after_transfer: | if self._config.sync_disks_after_transfer and not gpodder.win32: | def close(self): self.notify('status', _('Writing data to disk')) if self._config.sync_disks_after_transfer: successful_sync = (os.system('sync') == 0) else: log('Not syncing disks. Unmount your device before unplugging.', sender=self) successful_sync = True self.notify('done') self.notify('post-done', self, successful... |
self.pbFeedUpdate.set_fraction(float(updated)/float(total)) | self.pbFeedUpdate.set_fraction(float(updated+1)/float(total)) | def update_progress(): d = {'podcast': channel.title, 'position': updated+1, 'total': total} progression = _('Updated %(podcast)s (%(position)d/%(total)d)') % d self.pbFeedUpdate.set_text(progression) if self.tray_icon: self.tray_icon.set_status(self.tray_icon.STATUS_UPDATING_FEED_CACHE, progression) self.pbFeedUpdate.... |
if not hasattr(episode, name): | if name.startswith('maemo_') and name.endswith('markup'): markup = getattr(episode, name) args = markup_re.match(markup).groups() row.append(self._markup_template % args) elif not hasattr(episode, name): | def new( self): self._config.connect_gtk_window(self.gPodderEpisodeSelector, 'episode_selector', True) if not hasattr( self, 'callback'): self.callback = None |
return str(timestamp.strftime('%A')) | return str(timestamp.strftime('%A').decode(encoding)) | def format_date(timestamp): """ Converts a UNIX timestamp to a date representation. This function returns "Today", "Yesterday", a weekday name or the date in %x format, which (according to the Python docs) is the "Locale's appropriate date representation". Returns None if there has been an error converting the timesta... |
self.wNotebook.set_current_page(0) | util.idle_add(self.wNotebook.set_current_page, 0) | def on_resume_all(button): selection = self.treeDownloads.get_selection() selection.select_all() selected_tasks, can_queue, can_cancel, can_pause, can_remove, can_force = self.downloads_list_get_selection() selection.unselect_all() self._for_each_task_set_status(selected_tasks, download.DownloadTask.QUEUED) self.messag... |
for e in entry.get('enclosures', ()): | for e in enclosures: | def from_feedparser_entry(entry, channel): episode = PodcastEpisode(channel) |
self.__MTPDevice = pymtp.MTP() | try: self.__MTPDevice = pymtp.MTP() except NameError, e: log('pymtp not found: %s', str(e), sender=self) self.__MTPDevice = None | def __init__(self, config): Device.__init__(self, config) self.__model_name = None self.__MTPDevice = pymtp.MTP() |
return self.__model_name | return self.__model_name if self.__MTPDevice is None: return _('MTP device') | def get_name(self): """ this function try to find a nice name for the device. First, it tries to find a friendly (user assigned) name (this name can be set by other application and is stored on the device). if no friendly name was assign, it tries to get the model name (given by the vendor). If no name is found at all,... |
self.__model_name = "MTP device" | self.__model_name = _('MTP device') | def get_name(self): """ this function try to find a nice name for the device. First, it tries to find a friendly (user assigned) name (this name can be set by other application and is stored on the device). if no friendly name was assign, it tries to get the model name (given by the vendor). If no name is found at all,... |
self.total_time == self.current_position: | self.total_time <= self.current_position: | def get_play_info_string(self): if self.current_position > 0 and \ self.total_time == self.current_position: return '%s (%s)' % (_('Finished'), self.get_duration_string(),) if self.current_position > 0: return '%s / %s' % (self.get_position_string(), \ self.get_duration_string()) else: return self.get_duration_string() |
if '://' not in url: | if '://' not in url and not os.path.exists(url): | def thread_func(self, tab=0): if tab == 1: model = OpmlListModel(opml.Importer(self._config.toplist_url)) if len(model) == 0: self.notification(_('The specified URL does not provide any valid OPML podcast items.'), _('No feeds found')) elif tab == 2: model = OpmlListModel(youtube.find_youtube_channels(self.entryYoutube... |
return struct.unpack('L', fourCharCode)[0] | return struct.unpack('I', fourCharCode)[0] | def aeKeyword(fourCharCode): """transform four character code into a long""" return struct.unpack('L', fourCharCode)[0] |
return open(self.KBD_SLIDER).read().strip() | try: return open(self.KBD_SLIDER).read().strip() except IOError: return self._KBD_CLOSED | def _get_keyboard_state(self): return open(self.KBD_SLIDER).read().strip() |
self.title = feed.feed.get('title', self.url) | self.title = re.sub('\s+', ' ', feed.feed.get('title', self.url)) | def _consume_updated_feed(self, feed, max_episodes=0, mimetype_prefs=''): self.parse_error = feed.get('bozo_exception', None) |
episode.title = entry.get('title', '') | episode.title = re.sub('\s+', ' ', entry.get('title', '')) | def from_feedparser_entry(entry, channel, mimetype_prefs=''): episode = PodcastEpisode(channel) |
xml.sax.saxutils.escape(self.title), \ | xml.sax.saxutils.escape(re.sub('\s+', ' ', self.title)), \ | def maemo_markup(self): if self.length > 0: length_str = '%s; ' % self.filesize_prop else: length_str = '' return ('<b>%s</b>\n<small>%s'+_('released %s')+ \ '; '+_('from %s')+'</small>') % (\ xml.sax.saxutils.escape(self.title), \ xml.sax.saxutils.escape(length_str), \ xml.sax.saxutils.escape(self.pubdate_prop), \ xml... |
xml.sax.saxutils.escape(self.channel.title)) | xml.sax.saxutils.escape(re.sub('\s+', ' ', self.channel.title))) | def maemo_markup(self): if self.length > 0: length_str = '%s; ' % self.filesize_prop else: length_str = '' return ('<b>%s</b>\n<small>%s'+_('released %s')+ \ '; '+_('from %s')+'</small>') % (\ xml.sax.saxutils.escape(self.title), \ xml.sax.saxutils.escape(length_str), \ xml.sax.saxutils.escape(self.pubdate_prop), \ xml... |
released = gpod.itdb_time_mac_to_host(track.time_released) released = util.format_date(released) | try: released = gpod.itdb_time_mac_to_host(track.time_released) released = util.format_date(released) except ValueError, ve: log('Cannot convert track time: %s', ve, sender=self) released = 0 | def get_all_tracks(self): tracks = [] for track in gpod.sw_get_playlist_tracks(self.podcasts_playlist): filename = gpod.itdb_filename_on_ipod(track) |
return HttpResponseRedirect("/display/?ct=%s&ids=%s" % (ct.pk, ",".join(selected))) | return HttpResponseRedirect("/simpleinvoice/display/?ct=%s&ids=%s" % (ct.pk, ",".join(selected))) | def display(self, request, queryset): selected = request.POST.getlist(admin.ACTION_CHECKBOX_NAME) ct = ContentType.objects.get_for_model(queryset.model) return HttpResponseRedirect("/display/?ct=%s&ids=%s" % (ct.pk, ",".join(selected))) |
file.write(elTab+'rot_order="ROT_ZYX"') | def writeScene(file, scene): if scene.world.mist_settings.use_mist: fog = 'FOG_QUADRATIC' else: fog = 'FOG_NONE' file.write('\n\t<scene id="%s" camera="#%s" ambient_color="%s" fog_type="%s" background_color="%s">' % ( scene.name, scene.camera.name, rgbColor(scene.world.ambient_color), fog, rgbColor(scene.world.horizon... | |
file.write(elTab+'rot_order="ROT_XYZ" xtype="C_PERSPECTIVE"') | file.write(elTab+'xtype="%s"' % 'C_PERSPECTIVE') file.write(elTab+'rot_order="ROT_XZY"') | def writeScene(file, scene): if scene.world.mist_settings.use_mist: fog = 'FOG_QUADRATIC' else: fog = 'FOG_NONE' file.write('\n\t<scene id="%s" camera="#%s" ambient_color="%s" fog_type="%s" background_color="%s">' % ( scene.name, scene.camera.name, rgbColor(scene.world.ambient_color), fog, rgbColor(scene.world.horizon... |
writeMeshes(file, compress_meshes) | writeMeshes(file, use_modifiers, use_normals, use_uv_coords, compress_meshes) | def save(operator, context, filepath="", use_modifiers=True, use_normals=True, use_uv_coords=True, compress_meshes=True): scene = context.scene meshFileName = "meshes.xml" materialFileName = "materials.xml" destDir = os.path.dirname(filepath) meshPath = destDir + "/" + meshFileName materialPath = destDir + "/" + mater... |
def writeMeshes(file, compress_meshes): | def writeMeshes(file, use_modifiers, use_normals, use_uv_coords,compress_meshes): | def writeMeshes(file, compress_meshes): for mesh in bpy.data.meshes: writeMesh(file, mesh, compress_meshes) |
writeMesh(file, mesh, compress_meshes) | writeMesh(file, mesh, use_modifiers, use_normals, use_uv_coords,compress_meshes) | def writeMeshes(file, compress_meshes): for mesh in bpy.data.meshes: writeMesh(file, mesh, compress_meshes) |
dest_dir = os.path.dirname(filepath) meshpath = dest_dir + "/" + meshFileName file = beginGLGEFile(meshpath) writeMeshes(file) endGLGEFile(file) file = beginGLGEFile(filepath) file.write('\t<import url="%s" />' % meshFileName) writeMaterials(file) writeScene(file, scene) endGLGEFile(file) return {'FINISHED'} def beg... | def save(operator, context, filepath="", use_modifiers=True, use_normals=True, use_uv_coords=True): scene = context.scene obj = context.object """ if not obj: raise Exception("Error, Select 1 active object") if scene.objects.active: bpy.ops.object.mode_set(mode='OBJECT') """ file = open(filepath, 'w') file.write('<... | |
writeMeshes(file) writeMaterials(file) writeScene(file, scene) | return file def endGLGEFile(file): | def save(operator, context, filepath="", use_modifiers=True, use_normals=True, use_uv_coords=True): scene = context.scene obj = context.object """ if not obj: raise Exception("Error, Select 1 active object") if scene.objects.active: bpy.ops.object.mode_set(mode='OBJECT') """ file = open(filepath, 'w') file.write('<... |
print("writing %r done" % filepath) return {'FINISHED'} | print("writing %r done" % file.name) | def save(operator, context, filepath="", use_modifiers=True, use_normals=True, use_uv_coords=True): scene = context.scene obj = context.object """ if not obj: raise Exception("Error, Select 1 active object") if scene.objects.active: bpy.ops.object.mode_set(mode='OBJECT') """ file = open(filepath, 'w') file.write('<... |
file.write('\n\t<scene id="%s" camera=" | file.write('\n\t<scene id="%s" ambient_color="%s" fog_type="%s" background_color="%s"' | def writeScene(file, scene): if scene.world.mist_settings.use_mist: fog = 'FOG_QUADRATIC' else: fog = 'FOG_NONE' file.write('\n\t<scene id="%s" camera="#%s" ambient_color="%s" fog_type="%s" background_color="%s">' % ( scene.name, scene.camera.name, rgbColor(scene.world.ambient_color), fog, rgbColor(scene.world.horizon... |
scene.camera.name, | def writeScene(file, scene): if scene.world.mist_settings.use_mist: fog = 'FOG_QUADRATIC' else: fog = 'FOG_NONE' file.write('\n\t<scene id="%s" camera="#%s" ambient_color="%s" fog_type="%s" background_color="%s">' % ( scene.name, scene.camera.name, rgbColor(scene.world.ambient_color), fog, rgbColor(scene.world.horizon... | |
conf.env.append_value('CXXFLAGS', [ '-ansi']) append_cxx_flags('-Wall -Wextra -Wno-unused-parameter -Woverloaded-virtual') | conf.env.append_value('CXXFLAGS', [ '-ansi', '-Woverloaded-virtual']) append_cxx_flags('-Wall -Wextra -Wno-unused-parameter') | def append_cxx_flags(vals): conf.env.append_value('CCFLAGS', vals.split()) conf.env.append_value('CXXFLAGS', vals.split()) |
for dataWriter in dataWriters: | updateCTF = 0 origCTF = self.settings.get("ColorTransferFunction") if len(dataWriters) > 1: updateCTF = 1 for i, dataWriter in enumerate(dataWriters): if updateCTF: self.settings.set("ColorTransferFunction", self.sourceunits[i].getColorTransferFunction()) | def doProcessing(self, bxdFile, **kws): """ Executes the module's operation using the current settings Parameters: bxdFile The name of the created .bxdfile Keywords: settings_only If this parameter is set, then only the settings will be written out and not the VTI files. timepoints The timepoints that should be proce... |
if rx < 0: x = 0 if ry < 0: y = 0 if rz < 0: z = 0 if rx >= self.parameters["X"]: rx = self.parameters["X"] - 1 if ry >= self.parameters["Y"]: rx = self.parameters["Y"] - 1 if rz >= self.parameters["Z"]: rx = self.parameters["Z"] - 1 | if rx < 0: rx = 0 if ry < 0: ry = 0 if rz < 0: rz = 0 if rx > self.parameters["X"] - 1: rx = self.parameters["X"] - 1 if ry > self.parameters["Y"] - 1: rx = self.parameters["Y"] - 1 if rz > self.parameters["Z"] - 1: rx = self.parameters["Z"] - 1 | def createObjectsForTimepoint(self, tp): """ Create objects for given timepoint """ objs = [] x,y,z = self.parameters["X"], self.parameters["Y"], self.parameters["Z"] coeff = z/float(x) if tp == 0: if self.parameters["MoveTowardsPoint"]: self.towardsPoints = [] for c in range(0, self.parameters["TargetPoints"]): print ... |
for objN, (rx,ry,rz), size in self.objects[currentTimepoint]: | for oIter, (objN, (rx,ry,rz), size) in enumerate(self.objects[currentTimepoint]): | def createData(self, currentTimepoint): """ Create a test dataset within the parameters defined """ x,y,z = self.parameters["X"], self.parameters["Y"], self.parameters["Z"] if self.modified: print "Creating the time series data" self.createTimeSeries() if self.parameters["CreateAll"]: n = min(self.parameters["CacheAmou... |
self.createObjectAt(image, rx,ry,rz, size) | (rx,ry,rz), realSize = self.createObjectAt(image, rx,ry,rz, size) self.objects[currentTimepoint][oIter] = (objN, (rx,ry,rz), realSize) | def createData(self, currentTimepoint): """ Create a test dataset within the parameters defined """ x,y,z = self.parameters["X"], self.parameters["Y"], self.parameters["Z"] if self.modified: print "Creating the time series data" self.createTimeSeries() if self.parameters["CreateAll"]: n = min(self.parameters["CacheAmou... |
n = 0 | def createObjectAt(self, imageData, x0, y0, z0, size): """ Create an object in the image at the give position @param imageData the image to modify @param x0, y0, z0 the coordinates of the object @param size the size of the object in pixels """ origr = math.pow(size*2.3561944901923448, 0.333333) #r = int(1+math.sq... | |
if xs < 0: xs = 0 if ys < 0: ys = 0 if zs < 0: zs = 0 | def createObjectAt(self, imageData, x0, y0, z0, size): """ Create an object in the image at the give position @param imageData the image to modify @param x0, y0, z0 the coordinates of the object @param size the size of the object in pixels """ origr = math.pow(size*2.3561944901923448, 0.333333) #r = int(1+math.sq... | |
if xe >= maxx: xe = maxx-1 if ye >= maxy: ye = maxy-1 if ze >= maxz: ze = maxz-1 | if xs < minx: x0 -= xs xs = 0 if ys < miny: y0 -= ys ys = 0 if zs < minz: z0 -= zs zs = 0 if xe > maxx: x0 = x0 - xe - maxx xe = maxx if ye > maxy: y0 = y0 - ye - maxy ye = maxy if ze > maxz: z0 = z0 - ze - maxz ze = maxz | def createObjectAt(self, imageData, x0, y0, z0, size): """ Create an object in the image at the give position @param imageData the image to modify @param x0, y0, z0 the coordinates of the object @param size the size of the object in pixels """ origr = math.pow(size*2.3561944901923448, 0.333333) #r = int(1+math.sq... |
return (x0,y0,z0), count | def createObjectAt(self, imageData, x0, y0, z0, size): """ Create an object in the image at the give position @param imageData the image to modify @param x0, y0, z0 the coordinates of the object @param size the size of the object in pixels """ origr = math.pow(size*2.3561944901923448, 0.333333) #r = int(1+math.sq... | |
for obj in self.objects[timepoint]: | voxelVolume = 1.0 for i in range(3): voxelVolume *= self.voxelSize[i] voxelVolume *= 1000000 for tpObjs in self.objects: tpObjs.sort() for i, obj in enumerate(self.objects[timepoint]): | def writeToFile(self, filename, dataUnit, timepoint): """ write the objects from a given timepoint to file """ settings = dataUnit.getSettings() settings.set("StatisticsFile", filename) |
for i in range(len(com)): com[i] *= self.voxelSize[i] | for cIter in range(len(com)): com[cIter] *= self.voxelSize[cIter] com[cIter] *= 1000000 distList = [] for j, obj2 in enumerate(self.objects[timepoint]): if i == j: continue objN2, com2, volume2 = obj2 com2 = list(com2) for cIter in range(3): com2[cIter] *= self.voxelSize[cIter] com2[cIter] *= 1000000 dx = com[0] - com... | def writeToFile(self, filename, dataUnit, timepoint): """ write the objects from a given timepoint to file """ settings = dataUnit.getSettings() settings.set("StatisticsFile", filename) |
volumeums.append(0.0) avgint.append(0) | volumeums.append(volume * voxelVolume) avgint.append(255.0) | def writeToFile(self, filename, dataUnit, timepoint): """ write the objects from a given timepoint to file """ settings = dataUnit.getSettings() settings.set("StatisticsFile", filename) |
avgdist.append(0.0) avgdiststderr.append(0.0) | avgdist.append(avgDist) avgdiststderr.append(avgDistStdErr) | def writeToFile(self, filename, dataUnit, timepoint): """ write the objects from a given timepoint to file """ settings = dataUnit.getSettings() settings.set("StatisticsFile", filename) |
for (objN,(comx,comy,comz),dist,inside) in self.objPolydata[timepoint]: w.writerow([objN, comx, comy, comz, dist, inside]) | for i, (objN,(comx,comy,comz),dist,inside) in enumerate(self.objPolydata[timepoint]): dist *= 1000000 w.writerow([i+1, comx, comy, comz, dist, inside]) | def writeToFile(self, filename, dataUnit, timepoint): """ write the objects from a given timepoint to file """ settings = dataUnit.getSettings() settings.set("StatisticsFile", filename) |
"ObjMinInt":"Min. intensity of objects", "ObjMaxInt":"Max. intensity of objects", | "ObjMinInt":"Min. intensity of objects at the first time point", "ObjMaxInt":"Max. intensity of objects at the first time point", "IntChange":"Max. intensity change (in %)", | def __init__(self): """ Initialization """ lib.ProcessingFilter.ProcessingFilter.__init__(self, (1, 1)) self.objects = [] self.readObjects = [] self.polydata = None self.objPolydata = [] self.timeStamps = [] self.imageCache = {} self.spacing = (1.0, 1.0, 1.0) self.voxelSize = (1.0, 1.0, 1.0) self.modified = 1 self.desc... |
"SizeChange":"Size change (in %)", | "SizeChange":"Max. size change (in %)", | def __init__(self): """ Initialization """ lib.ProcessingFilter.ProcessingFilter.__init__(self, (1, 1)) self.objects = [] self.readObjects = [] self.polydata = None self.objPolydata = [] self.timeStamps = [] self.imageCache = {} self.spacing = (1.0, 1.0, 1.0) self.voxelSize = (1.0, 1.0, 1.0) self.modified = 1 self.desc... |
"ClusterDistance":"Min. distance for clustering (in x,y px size)", | "ClusterDistance":"Max. distance for clustering (in x,y px size)", | def __init__(self): """ Initialization """ lib.ProcessingFilter.ProcessingFilter.__init__(self, (1, 1)) self.objects = [] self.readObjects = [] self.polydata = None self.objPolydata = [] self.timeStamps = [] self.imageCache = {} self.spacing = (1.0, 1.0, 1.0) self.voxelSize = (1.0, 1.0, 1.0) self.modified = 1 self.desc... |
["Noise",("CreateNoise","ShotNoiseAmount","ShotNoiseMin","BackgroundNoiseMin","BackgroundNoiseMax")], ["Objects",(("ReadObjects", "Select object statistics file", "*.csv"),"NumberOfObjectsStart","NumberOfObjectsEnd","ObjSizeStart","ObjSizeEnd","ObjMinInt","ObjMaxInt","ObjectFluctuationStart","ObjectFluctuationEnd","Siz... | ["Noise",("CreateNoise","ShotNoiseAmount","ShotNoiseMin","ShotNoiseMax","ShotNoiseDistribution","BackgroundNoiseMin","BackgroundNoiseMax")], ["Objects",(("ReadObjects", "Select object statistics file", "*.csv"),"NumberOfObjectsStart","NumberOfObjectsEnd","ObjSizeStart","ObjSizeEnd","SizeChange","ObjMinInt","ObjMaxInt",... | def getParameters(self): """ Return the list of parameters needed for configuring this GUI """ return [ ["Caching",("Cache","CacheAmount","CreateAll")],["Dimensions",("X","Y","Z","Time","TimeDifference")],["Shift", ("Shift","ShiftStart","ShiftEnd")], ["Noise",("CreateNoise","ShotNoiseAmount","ShotNoiseMin","BackgroundN... |
if self.parameters["Clustering"]: print "Introducing clustering" self.clusterObjects(self.objects) | def createTimeSeries(self): """ Create a time series of configurations that correspond to the current parameters """ self.modified = 0 x,y,z = self.parameters["X"],self.parameters["Y"], self.parameters["Z"] self.majorAxis = random.randint(int(0.55*y), int(0.85*y)) for image in self.imageCache.values(): image.ReleaseDa... | |
for i, (objN, (x,y,z), size) in enumerate(objs): | for i, (objN, (x,y,z), size, objInt) in enumerate(objs): | def createTimeSeries(self): """ Create a time series of configurations that correspond to the current parameters """ self.modified = 0 x,y,z = self.parameters["X"],self.parameters["Y"], self.parameters["Z"] self.majorAxis = random.randint(int(0.55*y), int(0.85*y)) for image in self.imageCache.values(): image.ReleaseDa... |
p = lib.Particle.Particle((x,y,z), (x,y,z), tp, size, 20, objN) | p = lib.Particle.Particle((x,y,z), (x,y,z), tp, size, objInt, objN) | def createTimeSeries(self): """ Create a time series of configurations that correspond to the current parameters """ self.modified = 0 x,y,z = self.parameters["X"],self.parameters["Y"], self.parameters["Z"] self.majorAxis = random.randint(int(0.55*y), int(0.85*y)) for image in self.imageCache.values(): image.ReleaseDa... |
if self.parameters["Clustering"]: print "Introducing clustering" self.clusterObjects(self.objects) | def createTimeSeries(self): """ Create a time series of configurations that correspond to the current parameters """ self.modified = 0 x,y,z = self.parameters["X"],self.parameters["Y"], self.parameters["Z"] self.majorAxis = random.randint(int(0.55*y), int(0.85*y)) for image in self.imageCache.values(): image.ReleaseDa... | |
clusteredObjN = {} | def clusterObjects(self, objects): """ Create clustering of objects """ combine = [] clustered = {} clusteredObjN = {} for tp,objs in enumerate(objects): for i, (objN, (x,y,z), size) in enumerate(objs): for j, (objN2, (x2,y2,z2), size) in enumerate(objs): if objN == objN2: continue if objN in clusteredObjN: continue i... | |
for i, (objN, (x,y,z), size) in enumerate(objs): for j, (objN2, (x2,y2,z2), size) in enumerate(objs): | if tp == 0: continue for i, (objN, (x,y,z), size, objInt) in enumerate(objs): for j, (objN2, (x2,y2,z2), size2, objInt2) in enumerate(objs): | def clusterObjects(self, objects): """ Create clustering of objects """ combine = [] clustered = {} clusteredObjN = {} for tp,objs in enumerate(objects): for i, (objN, (x,y,z), size) in enumerate(objs): for j, (objN2, (x2,y2,z2), size) in enumerate(objs): if objN == objN2: continue if objN in clusteredObjN: continue i... |
if objN in clusteredObjN: continue if objN2 in clusteredObjN: continue | def clusterObjects(self, objects): """ Create clustering of objects """ combine = [] clustered = {} clusteredObjN = {} for tp,objs in enumerate(objects): for i, (objN, (x,y,z), size) in enumerate(objs): for j, (objN2, (x2,y2,z2), size) in enumerate(objs): if objN == objN2: continue if objN in clusteredObjN: continue i... | |
clusteredObjN[objN]=1 clusteredObjN[objN2]=1 | def clusterObjects(self, objects): """ Create clustering of objects """ combine = [] clustered = {} clusteredObjN = {} for tp,objs in enumerate(objects): for i, (objN, (x,y,z), size) in enumerate(objs): for j, (objN2, (x2,y2,z2), size) in enumerate(objs): if objN == objN2: continue if objN in clusteredObjN: continue i... | |
if len(self.tracks[objN-1]) > tp and len(self.tracks[objN2-1]) > tp: self.tracks[objN-1].remove(self.tracks[objN-1][tp]) self.tracks[objN2-1].remove(self.tracks[objN2-1][tp]) | def clusterObjects(self, objects): """ Create clustering of objects """ combine = [] clustered = {} clusteredObjN = {} for tp,objs in enumerate(objects): for i, (objN, (x,y,z), size) in enumerate(objs): for j, (objN2, (x2,y2,z2), size) in enumerate(objs): if objN == objN2: continue if objN in clusteredObjN: continue i... | |
objN,(x1,y1,z1),s1 = ob1 objN2,(x2,y2,z2),s2 = ob2 | objN,(x1,y1,z1),s1,int1 = ob1 objN2,(x2,y2,z2),s2,int2 = ob2 | def clusterObjects(self, objects): """ Create clustering of objects """ combine = [] clustered = {} clusteredObjN = {} for tp,objs in enumerate(objects): for i, (objN, (x,y,z), size) in enumerate(objs): for j, (objN2, (x2,y2,z2), size) in enumerate(objs): if objN == objN2: continue if objN in clusteredObjN: continue i... |
objects[tp].append((objN,(x3,y3,z3), s3)) self.tracks[objN-1].insert(tp, lib.Particle.Particle((x3,y3,z3), (x3,y3,z3), tp, size, 20, objN)) | int3 = int((int1+int2) * 0.7) objects[tp].append((objN,(x3,y3,z3), s3, int3)) removedByTP = [] for remtp in range(len(self.objects)): removedByTP.append(0) | def clusterObjects(self, objects): """ Create clustering of objects """ combine = [] clustered = {} clusteredObjN = {} for tp,objs in enumerate(objects): for i, (objN, (x,y,z), size) in enumerate(objs): for j, (objN2, (x2,y2,z2), size) in enumerate(objs): if objN == objN2: continue if objN in clusteredObjN: continue i... |
removedByTP[tp] += 1 for remtp in range(len(self.objects)): print "Removed from timepoint %d: %d"%(remtp,removedByTP[remtp]) | def clusterObjects(self, objects): """ Create clustering of objects """ combine = [] clustered = {} clusteredObjN = {} for tp,objs in enumerate(objects): for i, (objN, (x,y,z), size) in enumerate(objs): for j, (objN2, (x2,y2,z2), size) in enumerate(objs): if objN == objN2: continue if objN in clusteredObjN: continue i... | |
for objN, (rx,ry,rz), size in self.objects[tp-1]: | for objN, (rx,ry,rz), size, objInt in self.objects[tp-1]: | def createObjectsForTimepoint(self, tp): """ Create objects for given timepoint """ objs = [] x,y,z = self.parameters["X"], self.parameters["Y"], self.parameters["Z"] coeff = z/float(x) if tp == 0: if self.parameters["MoveTowardsPoint"]: self.towardsPoints = [] for c in range(0, self.parameters["TargetPoints"]): print ... |
maxchange = int(size*(self.parameters["SizeChange"]/100.0)) | negative = 1.0 maxchange = int(round(size*(self.parameters["SizeChange"]/100.0))) if maxchange < 0: negative = -1 | def createObjectsForTimepoint(self, tp): """ Create objects for given timepoint """ objs = [] x,y,z = self.parameters["X"], self.parameters["Y"], self.parameters["Z"] coeff = z/float(x) if tp == 0: if self.parameters["MoveTowardsPoint"]: self.towardsPoints = [] for c in range(0, self.parameters["TargetPoints"]): print ... |
if random.random() < 0.5: change *= -1 | change *= negative | def createObjectsForTimepoint(self, tp): """ Create objects for given timepoint """ objs = [] x,y,z = self.parameters["X"], self.parameters["Y"], self.parameters["Z"] coeff = z/float(x) if tp == 0: if self.parameters["MoveTowardsPoint"]: self.towardsPoints = [] for c in range(0, self.parameters["TargetPoints"]): print ... |
objs.append((objN, (rx,ry,rz), size)) | if self.parameters["IntChange"]: negative = 1.0 maxchange = int(round(objInt*(self.parameters["IntChange"]/100.0))) if maxchange < 0: negative = -1 change = random.randint(0, maxchange) change *= negative objInt += change objs.append((objN, (rx,ry,rz), size, objInt)) | def createObjectsForTimepoint(self, tp): """ Create objects for given timepoint """ objs = [] x,y,z = self.parameters["X"], self.parameters["Y"], self.parameters["Z"] coeff = z/float(x) if tp == 0: if self.parameters["MoveTowardsPoint"]: self.towardsPoints = [] for c in range(0, self.parameters["TargetPoints"]): print ... |
objs.append((objNum, (rx,ry,rz), size)) | objInt = random.randint(self.parameters["ObjMinInt"],self.parameters["ObjMaxInt"]) objs.append((objNum, (rx,ry,rz), size, objInt)) | def createObject(self, objNum, objs): print "Creating object %d"%objNum |
image.SetScalarComponentFromDouble(rx,ry,rz,0,random.randint(self.parameters["ShotNoiseMin"],255)) | if shotNoiseDistr == DIST_UNIFORM: shotInt = random.randint(shotNoiseMin,shotNoiseMax) else: if shotNoiseDistr == DIST_NORM: shotInt = random.gauss(mu,sigma) elif shotNoiseDistr == DIST_POSNORM: shotInt = random.gauss(0.0, 2*sigma) shotInt = int(round(abs(shotInt) + shotNoiseMin)) elif shotNoiseDistr == DIST_NEGNORM: s... | def createData(self, currentTimepoint): """ Create a test dataset within the parameters defined """ x,y,z = self.parameters["X"], self.parameters["Y"], self.parameters["Z"] if self.modified: print "Creating the time series data" self.createTimeSeries() if self.parameters["CreateAll"]: n = min(self.parameters["CacheAmou... |
print "Creating objects" for oIter, (objN, (rx,ry,rz), size) in enumerate(self.objects[currentTimepoint]): | print "Creating objects",currentTimepoint for oIter, (objN, (rx,ry,rz), size, objInt) in enumerate(self.objects[currentTimepoint]): | def createData(self, currentTimepoint): """ Create a test dataset within the parameters defined """ x,y,z = self.parameters["X"], self.parameters["Y"], self.parameters["Z"] if self.modified: print "Creating the time series data" self.createTimeSeries() if self.parameters["CreateAll"]: n = min(self.parameters["CacheAmou... |
(rx,ry,rz), realSize, intList = self.createObjectAt(image, rx,ry,rz, size) | (rx,ry,rz), realSize, intList = self.createObjectAt(image, rx,ry,rz, size, objInt) | def createData(self, currentTimepoint): """ Create a test dataset within the parameters defined """ x,y,z = self.parameters["X"], self.parameters["Y"], self.parameters["Z"] if self.modified: print "Creating the time series data" self.createTimeSeries() if self.parameters["CreateAll"]: n = min(self.parameters["CacheAmou... |
def createObjectAt(self, imageData, x0, y0, z0, size): | def createObjectAt(self, imageData, x0, y0, z0, size, objInt): | def createObjectAt(self, imageData, x0, y0, z0, size): """ Create an object in the image at the give position @param imageData the image to modify @param x0, y0, z0 the coordinates of the object @param size the size of the object in pixels """ origr = math.pow(size*2.3561944901923448, 0.333333) #r = int(1+math.sq... |
origr = math.pow(size*2.3561944901923448, 0.333333) | origr = math.pow(size*0.23561944901923448, 0.333333) | def createObjectAt(self, imageData, x0, y0, z0, size): """ Create an object in the image at the give position @param imageData the image to modify @param x0, y0, z0 the coordinates of the object @param size the size of the object in pixels """ origr = math.pow(size*2.3561944901923448, 0.333333) #r = int(1+math.sq... |
r = int(origr) | r = int(round(origr)) if r < 1: r = 1 | def createObjectAt(self, imageData, x0, y0, z0, size): """ Create an object in the image at the give position @param imageData the image to modify @param x0, y0, z0 the coordinates of the object @param size the size of the object in pixels """ origr = math.pow(size*2.3561944901923448, 0.333333) #r = int(1+math.sq... |
x0 -= xs | xe += (minx - xs) | def createObjectAt(self, imageData, x0, y0, z0, size): """ Create an object in the image at the give position @param imageData the image to modify @param x0, y0, z0 the coordinates of the object @param size the size of the object in pixels """ origr = math.pow(size*2.3561944901923448, 0.333333) #r = int(1+math.sq... |
y0 -= ys | ye += (miny - ys) | def createObjectAt(self, imageData, x0, y0, z0, size): """ Create an object in the image at the give position @param imageData the image to modify @param x0, y0, z0 the coordinates of the object @param size the size of the object in pixels """ origr = math.pow(size*2.3561944901923448, 0.333333) #r = int(1+math.sq... |
z0 -= zs | ze += (minz - zs) | def createObjectAt(self, imageData, x0, y0, z0, size): """ Create an object in the image at the give position @param imageData the image to modify @param x0, y0, z0 the coordinates of the object @param size the size of the object in pixels """ origr = math.pow(size*2.3561944901923448, 0.333333) #r = int(1+math.sq... |
x0 = x0 - xe - maxx | xs -= (xe - maxx) | def createObjectAt(self, imageData, x0, y0, z0, size): """ Create an object in the image at the give position @param imageData the image to modify @param x0, y0, z0 the coordinates of the object @param size the size of the object in pixels """ origr = math.pow(size*2.3561944901923448, 0.333333) #r = int(1+math.sq... |
y0 = y0 - ye - maxy | ys -= (ye - maxy) | def createObjectAt(self, imageData, x0, y0, z0, size): """ Create an object in the image at the give position @param imageData the image to modify @param x0, y0, z0 the coordinates of the object @param size the size of the object in pixels """ origr = math.pow(size*2.3561944901923448, 0.333333) #r = int(1+math.sq... |
z0 = z0 - ze - maxz | zs -= (ze - maxz) | def createObjectAt(self, imageData, x0, y0, z0, size): """ Create an object in the image at the give position @param imageData the image to modify @param x0, y0, z0 the coordinates of the object @param size the size of the object in pixels """ origr = math.pow(size*2.3561944901923448, 0.333333) #r = int(1+math.sq... |
objInt = int(round(self.parameters["ObjMinInt"] + random.betavariate(2,2) * (self.parameters["ObjMaxInt"] - self.parameters["ObjMinInt"]))) | def createObjectAt(self, imageData, x0, y0, z0, size): """ Create an object in the image at the give position @param imageData the image to modify @param x0, y0, z0 the coordinates of the object @param size the size of the object in pixels """ origr = math.pow(size*2.3561944901923448, 0.333333) #r = int(1+math.sq... | |
if minInt < self.parameters["ObjMinInt"]: minInt = self.parameters["ObjMinInt"] | if minInt < 0: minInt = 0 if minInt > 255: minInt = 235 | def createObjectAt(self, imageData, x0, y0, z0, size): """ Create an object in the image at the give position @param imageData the image to modify @param x0, y0, z0 the coordinates of the object @param size the size of the object in pixels """ origr = math.pow(size*2.3561944901923448, 0.333333) #r = int(1+math.sq... |
if maxInt > self.parameters["ObjMaxInt"]: maxInt = self.parameters["ObjMaxInt"] | if maxInt < 0: maxInt = 20 if maxInt > 255: maxInt = 255 | def createObjectAt(self, imageData, x0, y0, z0, size): """ Create an object in the image at the give position @param imageData the image to modify @param x0, y0, z0 the coordinates of the object @param size the size of the object in pixels """ origr = math.pow(size*2.3561944901923448, 0.333333) #r = int(1+math.sq... |
return text | rv = UnicodeWithAttrs(text) if "toc" in self.extras: rv._toc = self._toc return rv | def convert(self, text): """Convert the given text.""" # Main function. The order in which other subs are called here is # essential. Link and image substitutions need to happen before # _EscapeSpecialChars(), so that any *'s or _'s in the <a> # and <img> tags get encoded. |
return "<h%d>%s</h%d>\n\n" \ % (n, self._run_span_gamut(match.group(1)), n) | header_id_attr = "" if "header-ids" in self.extras: header_id = self.header_id_from_text(match.group(1), prefix=self.extras["header-ids"]) header_id_attr = ' id="%s"' % header_id html = self._run_span_gamut(match.group(1)) if "toc" in self.extras: self._toc_add_entry(n, header_id, html) return "<h%d%s>%s</h%d>\n\n" % (... | def _setext_h_sub(self, match): n = {"=": 1, "-": 2}[match.group(2)[0]] demote_headers = self.extras.get("demote-headers") if demote_headers: n = min(n + demote_headers, 6) return "<h%d>%s</h%d>\n\n" \ % (n, self._run_span_gamut(match.group(1)), n) |
return "<h%d>%s</h%d>\n\n" \ % (n, self._run_span_gamut(match.group(2)), n) | header_id_attr = "" if "header-ids" in self.extras: header_id = self.header_id_from_text(match.group(2), prefix=self.extras["header-ids"]) header_id_attr = ' id="%s"' % header_id html = self._run_span_gamut(match.group(2)) if "toc" in self.extras: self._toc_add_entry(n, header_id, html) return "<h%d%s>%s</h%d>\n\n" % (... | def _atx_h_sub(self, match): n = len(match.group(1)) demote_headers = self.extras.get("demote-headers") if demote_headers: n = min(n + demote_headers, 6) return "<h%d>%s</h%d>\n\n" \ % (n, self._run_span_gamut(match.group(2)), n) |
return "\n\n<pre><code>%s\n</code></pre>\n\n" % codeblock | pre_class_str = self._html_class_str_from_tag("pre") code_class_str = self._html_class_str_from_tag("code") return "\n\n<pre%s><code%s>%s\n</code></pre>\n\n" % ( pre_class_str, code_class_str, codeblock) def _html_class_str_from_tag(self, tag): """Get the appropriate ' class="..."' string (note the leading space), if ... | def _code_block_sub(self, match): codeblock = match.group(1) codeblock = self._outdent(codeblock) codeblock = self._detab(codeblock) codeblock = codeblock.lstrip('\n') # trim leading newlines codeblock = codeblock.rstrip() # trim trailing whitespace |
if (li and li.group("next_marker") | if (li and len(li.group(2)) <= 3 and li.group("next_marker") | def _form_paragraphs(self, text): # Strip leading and trailing lines: text = text.strip('\n') |
for module in gConfig.getValue( "/DIRAC/Extensions", [] ): | for module in getCSExtensions(): | def __init__( self, *args, **kwargs ): super( DiracWebApp, self ).__init__( *args, **kwargs ) #Find base modules path self.__baseControllerPaths = [] for module in gConfig.getValue( "/DIRAC/Extensions", [] ): module = "%sDIRAC" % module modulePath = os.path.join( rootPath, module ) if os.path.isdir( os.path.join( modul... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.