repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
ejeschke/ginga | ginga/misc/Task.py | Task.init_and_start | def init_and_start(self, taskParent, override={}):
"""Convenience method to initialize and start a task.
"""
tag = self.initialize(taskParent, override=override)
self.start()
return tag | python | def init_and_start(self, taskParent, override={}):
"""Convenience method to initialize and start a task.
"""
tag = self.initialize(taskParent, override=override)
self.start()
return tag | [
"def",
"init_and_start",
"(",
"self",
",",
"taskParent",
",",
"override",
"=",
"{",
"}",
")",
":",
"tag",
"=",
"self",
".",
"initialize",
"(",
"taskParent",
",",
"override",
"=",
"override",
")",
"self",
".",
"start",
"(",
")",
"return",
"tag"
] | Convenience method to initialize and start a task. | [
"Convenience",
"method",
"to",
"initialize",
"and",
"start",
"a",
"task",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/misc/Task.py#L127-L133 | train |
ejeschke/ginga | ginga/misc/Task.py | Task.wait | def wait(self, timeout=None):
"""This method waits for an executing task to finish.
Subclass can override this method if necessary.
"""
self.ev_done.wait(timeout=timeout)
if not self.ev_done.is_set():
raise TaskTimeout("Task %s timed out." % self)
# --> self... | python | def wait(self, timeout=None):
"""This method waits for an executing task to finish.
Subclass can override this method if necessary.
"""
self.ev_done.wait(timeout=timeout)
if not self.ev_done.is_set():
raise TaskTimeout("Task %s timed out." % self)
# --> self... | [
"def",
"wait",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"self",
".",
"ev_done",
".",
"wait",
"(",
"timeout",
"=",
"timeout",
")",
"if",
"not",
"self",
".",
"ev_done",
".",
"is_set",
"(",
")",
":",
"raise",
"TaskTimeout",
"(",
"\"Task %s ti... | This method waits for an executing task to finish.
Subclass can override this method if necessary. | [
"This",
"method",
"waits",
"for",
"an",
"executing",
"task",
"to",
"finish",
".",
"Subclass",
"can",
"override",
"this",
"method",
"if",
"necessary",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/misc/Task.py#L173-L192 | train |
ejeschke/ginga | ginga/misc/Task.py | Task.done | def done(self, result, noraise=False):
"""This method is called when a task has finished executing.
Subclass can override this method if desired, but should call
superclass method at the end.
"""
# [??] Should this be in a critical section?
# Has done() already been call... | python | def done(self, result, noraise=False):
"""This method is called when a task has finished executing.
Subclass can override this method if desired, but should call
superclass method at the end.
"""
# [??] Should this be in a critical section?
# Has done() already been call... | [
"def",
"done",
"(",
"self",
",",
"result",
",",
"noraise",
"=",
"False",
")",
":",
"if",
"self",
".",
"ev_done",
".",
"is_set",
"(",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"result",
",",
"Exception",
")",
"and",
"(",
"not",
"noraise",
")",... | This method is called when a task has finished executing.
Subclass can override this method if desired, but should call
superclass method at the end. | [
"This",
"method",
"is",
"called",
"when",
"a",
"task",
"has",
"finished",
"executing",
".",
"Subclass",
"can",
"override",
"this",
"method",
"if",
"desired",
"but",
"should",
"call",
"superclass",
"method",
"at",
"the",
"end",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/misc/Task.py#L210-L244 | train |
ejeschke/ginga | ginga/misc/Task.py | Task.runTask | def runTask(self, task, timeout=None):
"""Run a child task to completion. Returns the result of
the child task.
"""
# Initialize the task.
task.initialize(self)
# Start the task.
task.start()
# Lets other threads run
time.sleep(0)
# Wai... | python | def runTask(self, task, timeout=None):
"""Run a child task to completion. Returns the result of
the child task.
"""
# Initialize the task.
task.initialize(self)
# Start the task.
task.start()
# Lets other threads run
time.sleep(0)
# Wai... | [
"def",
"runTask",
"(",
"self",
",",
"task",
",",
"timeout",
"=",
"None",
")",
":",
"task",
".",
"initialize",
"(",
"self",
")",
"task",
".",
"start",
"(",
")",
"time",
".",
"sleep",
"(",
"0",
")",
"res",
"=",
"task",
".",
"wait",
"(",
"timeout",
... | Run a child task to completion. Returns the result of
the child task. | [
"Run",
"a",
"child",
"task",
"to",
"completion",
".",
"Returns",
"the",
"result",
"of",
"the",
"child",
"task",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/misc/Task.py#L263-L280 | train |
ejeschke/ginga | ginga/misc/Task.py | SequentialTaskset.execute | def execute(self):
"""Run all child tasks, in order, waiting for completion of each.
Return the result of the final child task's execution.
"""
while self.index < len(self.tasklist):
res = self.step()
self.logger.debug('SeqSet task %i has completed with result %s'... | python | def execute(self):
"""Run all child tasks, in order, waiting for completion of each.
Return the result of the final child task's execution.
"""
while self.index < len(self.tasklist):
res = self.step()
self.logger.debug('SeqSet task %i has completed with result %s'... | [
"def",
"execute",
"(",
"self",
")",
":",
"while",
"self",
".",
"index",
"<",
"len",
"(",
"self",
".",
"tasklist",
")",
":",
"res",
"=",
"self",
".",
"step",
"(",
")",
"self",
".",
"logger",
".",
"debug",
"(",
"'SeqSet task %i has completed with result %s... | Run all child tasks, in order, waiting for completion of each.
Return the result of the final child task's execution. | [
"Run",
"all",
"child",
"tasks",
"in",
"order",
"waiting",
"for",
"completion",
"of",
"each",
".",
"Return",
"the",
"result",
"of",
"the",
"final",
"child",
"task",
"s",
"execution",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/misc/Task.py#L428-L438 | train |
ejeschke/ginga | ginga/misc/Task.py | oldConcurrentAndTaskset.execute | def execute(self):
"""Run all child tasks concurrently in separate threads.
Return 0 after all child tasks have completed execution.
"""
self.count = 0
self.taskset = []
self.results = {}
self.totaltime = time.time()
# Register termination callbacks for a... | python | def execute(self):
"""Run all child tasks concurrently in separate threads.
Return 0 after all child tasks have completed execution.
"""
self.count = 0
self.taskset = []
self.results = {}
self.totaltime = time.time()
# Register termination callbacks for a... | [
"def",
"execute",
"(",
"self",
")",
":",
"self",
".",
"count",
"=",
"0",
"self",
".",
"taskset",
"=",
"[",
"]",
"self",
".",
"results",
"=",
"{",
"}",
"self",
".",
"totaltime",
"=",
"time",
".",
"time",
"(",
")",
"for",
"task",
"in",
"list",
"(... | Run all child tasks concurrently in separate threads.
Return 0 after all child tasks have completed execution. | [
"Run",
"all",
"child",
"tasks",
"concurrently",
"in",
"separate",
"threads",
".",
"Return",
"0",
"after",
"all",
"child",
"tasks",
"have",
"completed",
"execution",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/misc/Task.py#L473-L514 | train |
ejeschke/ginga | ginga/misc/Task.py | newConcurrentAndTaskset.execute | def execute(self):
"""Run all child tasks concurrently in separate threads.
Return last result after all child tasks have completed execution.
"""
with self._lock_c:
self.count = 0
self.numtasks = 0
self.taskset = []
self.results = {}
... | python | def execute(self):
"""Run all child tasks concurrently in separate threads.
Return last result after all child tasks have completed execution.
"""
with self._lock_c:
self.count = 0
self.numtasks = 0
self.taskset = []
self.results = {}
... | [
"def",
"execute",
"(",
"self",
")",
":",
"with",
"self",
".",
"_lock_c",
":",
"self",
".",
"count",
"=",
"0",
"self",
".",
"numtasks",
"=",
"0",
"self",
".",
"taskset",
"=",
"[",
"]",
"self",
".",
"results",
"=",
"{",
"}",
"self",
".",
"totaltime... | Run all child tasks concurrently in separate threads.
Return last result after all child tasks have completed execution. | [
"Run",
"all",
"child",
"tasks",
"concurrently",
"in",
"separate",
"threads",
".",
"Return",
"last",
"result",
"after",
"all",
"child",
"tasks",
"have",
"completed",
"execution",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/misc/Task.py#L572-L634 | train |
ejeschke/ginga | ginga/misc/Task.py | WorkerThread.execute | def execute(self, task):
"""Execute a task.
"""
taskid = str(task)
res = None
try:
# Try to run the task. If we catch an exception, then
# it becomes the result.
self.time_start = time.time()
self.setstatus('executing %s' % taskid... | python | def execute(self, task):
"""Execute a task.
"""
taskid = str(task)
res = None
try:
# Try to run the task. If we catch an exception, then
# it becomes the result.
self.time_start = time.time()
self.setstatus('executing %s' % taskid... | [
"def",
"execute",
"(",
"self",
",",
"task",
")",
":",
"taskid",
"=",
"str",
"(",
"task",
")",
"res",
"=",
"None",
"try",
":",
"self",
".",
"time_start",
"=",
"time",
".",
"time",
"(",
")",
"self",
".",
"setstatus",
"(",
"'executing %s'",
"%",
"task... | Execute a task. | [
"Execute",
"a",
"task",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/misc/Task.py#L868-L912 | train |
ejeschke/ginga | ginga/misc/Task.py | ThreadPool.startall | def startall(self, wait=False, **kwdargs):
"""Start all of the threads in the thread pool. If _wait_ is True
then don't return until all threads are up and running. Any extra
keyword arguments are passed to the worker thread constructor.
"""
self.logger.debug("startall called")... | python | def startall(self, wait=False, **kwdargs):
"""Start all of the threads in the thread pool. If _wait_ is True
then don't return until all threads are up and running. Any extra
keyword arguments are passed to the worker thread constructor.
"""
self.logger.debug("startall called")... | [
"def",
"startall",
"(",
"self",
",",
"wait",
"=",
"False",
",",
"**",
"kwdargs",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"startall called\"",
")",
"with",
"self",
".",
"regcond",
":",
"while",
"self",
".",
"status",
"!=",
"'down'",
":",
... | Start all of the threads in the thread pool. If _wait_ is True
then don't return until all threads are up and running. Any extra
keyword arguments are passed to the worker thread constructor. | [
"Start",
"all",
"of",
"the",
"threads",
"in",
"the",
"thread",
"pool",
".",
"If",
"_wait_",
"is",
"True",
"then",
"don",
"t",
"return",
"until",
"all",
"threads",
"are",
"up",
"and",
"running",
".",
"Any",
"extra",
"keyword",
"arguments",
"are",
"passed"... | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/misc/Task.py#L999-L1048 | train |
ejeschke/ginga | ginga/misc/Task.py | ThreadPool.stopall | def stopall(self, wait=False):
"""Stop all threads in the worker pool. If _wait_ is True
then don't return until all threads are down.
"""
self.logger.debug("stopall called")
with self.regcond:
while self.status != 'up':
if self.status in ('stop', 'do... | python | def stopall(self, wait=False):
"""Stop all threads in the worker pool. If _wait_ is True
then don't return until all threads are down.
"""
self.logger.debug("stopall called")
with self.regcond:
while self.status != 'up':
if self.status in ('stop', 'do... | [
"def",
"stopall",
"(",
"self",
",",
"wait",
"=",
"False",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"stopall called\"",
")",
"with",
"self",
".",
"regcond",
":",
"while",
"self",
".",
"status",
"!=",
"'up'",
":",
"if",
"self",
".",
"statu... | Stop all threads in the worker pool. If _wait_ is True
then don't return until all threads are down. | [
"Stop",
"all",
"threads",
"in",
"the",
"worker",
"pool",
".",
"If",
"_wait_",
"is",
"True",
"then",
"don",
"t",
"return",
"until",
"all",
"threads",
"are",
"down",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/misc/Task.py#L1064-L1093 | train |
ejeschke/ginga | experimental/plugins/IIS_DataListener.py | wcs_pix_transform | def wcs_pix_transform(ct, i, format=0):
"""Computes the WCS corrected pixel value given a coordinate
transformation and the raw pixel value.
Input:
ct coordinate transformation. instance of coord_tran.
i raw pixel intensity.
format format string (optional).
Returns:
WCS cor... | python | def wcs_pix_transform(ct, i, format=0):
"""Computes the WCS corrected pixel value given a coordinate
transformation and the raw pixel value.
Input:
ct coordinate transformation. instance of coord_tran.
i raw pixel intensity.
format format string (optional).
Returns:
WCS cor... | [
"def",
"wcs_pix_transform",
"(",
"ct",
",",
"i",
",",
"format",
"=",
"0",
")",
":",
"z1",
"=",
"float",
"(",
"ct",
".",
"z1",
")",
"z2",
"=",
"float",
"(",
"ct",
".",
"z2",
")",
"i",
"=",
"float",
"(",
"i",
")",
"yscale",
"=",
"128.0",
"/",
... | Computes the WCS corrected pixel value given a coordinate
transformation and the raw pixel value.
Input:
ct coordinate transformation. instance of coord_tran.
i raw pixel intensity.
format format string (optional).
Returns:
WCS corrected pixel value | [
"Computes",
"the",
"WCS",
"corrected",
"pixel",
"value",
"given",
"a",
"coordinate",
"transformation",
"and",
"the",
"raw",
"pixel",
"value",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/experimental/plugins/IIS_DataListener.py#L947-L977 | train |
ejeschke/ginga | experimental/plugins/IIS_DataListener.py | IIS_DataListener.handle_request | def handle_request(self):
"""
Handles incoming connections, one at the time.
"""
try:
(request, client_address) = self.get_request()
except socket.error as e:
# Error handling goes here.
self.logger.error("error opening the connection: %s" % (... | python | def handle_request(self):
"""
Handles incoming connections, one at the time.
"""
try:
(request, client_address) = self.get_request()
except socket.error as e:
# Error handling goes here.
self.logger.error("error opening the connection: %s" % (... | [
"def",
"handle_request",
"(",
"self",
")",
":",
"try",
":",
"(",
"request",
",",
"client_address",
")",
"=",
"self",
".",
"get_request",
"(",
")",
"except",
"socket",
".",
"error",
"as",
"e",
":",
"self",
".",
"logger",
".",
"error",
"(",
"\"error open... | Handles incoming connections, one at the time. | [
"Handles",
"incoming",
"connections",
"one",
"at",
"the",
"time",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/experimental/plugins/IIS_DataListener.py#L144-L167 | train |
ejeschke/ginga | experimental/plugins/IIS_DataListener.py | IIS_DataListener.mainloop | def mainloop(self):
"""main control loop."""
try:
while (not self.ev_quit.is_set()):
try:
self.handle_request()
except socketTimeout:
continue
finally:
self.socket.close() | python | def mainloop(self):
"""main control loop."""
try:
while (not self.ev_quit.is_set()):
try:
self.handle_request()
except socketTimeout:
continue
finally:
self.socket.close() | [
"def",
"mainloop",
"(",
"self",
")",
":",
"try",
":",
"while",
"(",
"not",
"self",
".",
"ev_quit",
".",
"is_set",
"(",
")",
")",
":",
"try",
":",
"self",
".",
"handle_request",
"(",
")",
"except",
"socketTimeout",
":",
"continue",
"finally",
":",
"se... | main control loop. | [
"main",
"control",
"loop",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/experimental/plugins/IIS_DataListener.py#L169-L179 | train |
ejeschke/ginga | experimental/plugins/IIS_DataListener.py | IIS_RequestHandler.handle_feedback | def handle_feedback(self, pkt):
"""This part of the protocol is used by IRAF to erase a frame in
the framebuffers.
"""
self.logger.debug("handle feedback")
self.frame = self.decode_frameno(pkt.z & 0o7777) - 1
# erase the frame buffer
self.server.controller.init_f... | python | def handle_feedback(self, pkt):
"""This part of the protocol is used by IRAF to erase a frame in
the framebuffers.
"""
self.logger.debug("handle feedback")
self.frame = self.decode_frameno(pkt.z & 0o7777) - 1
# erase the frame buffer
self.server.controller.init_f... | [
"def",
"handle_feedback",
"(",
"self",
",",
"pkt",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"handle feedback\"",
")",
"self",
".",
"frame",
"=",
"self",
".",
"decode_frameno",
"(",
"pkt",
".",
"z",
"&",
"0o7777",
")",
"-",
"1",
"self",
"... | This part of the protocol is used by IRAF to erase a frame in
the framebuffers. | [
"This",
"part",
"of",
"the",
"protocol",
"is",
"used",
"by",
"IRAF",
"to",
"erase",
"a",
"frame",
"in",
"the",
"framebuffers",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/experimental/plugins/IIS_DataListener.py#L379-L388 | train |
ejeschke/ginga | experimental/plugins/IIS_DataListener.py | IIS_RequestHandler.handle_lut | def handle_lut(self, pkt):
"""This part of the protocol is used by IRAF to set the frame number.
"""
self.logger.debug("handle lut")
if pkt.subunit & COMMAND:
data_type = str(pkt.nbytes / 2) + 'h'
#size = struct.calcsize(data_type)
line = pkt.datain.re... | python | def handle_lut(self, pkt):
"""This part of the protocol is used by IRAF to set the frame number.
"""
self.logger.debug("handle lut")
if pkt.subunit & COMMAND:
data_type = str(pkt.nbytes / 2) + 'h'
#size = struct.calcsize(data_type)
line = pkt.datain.re... | [
"def",
"handle_lut",
"(",
"self",
",",
"pkt",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"handle lut\"",
")",
"if",
"pkt",
".",
"subunit",
"&",
"COMMAND",
":",
"data_type",
"=",
"str",
"(",
"pkt",
".",
"nbytes",
"/",
"2",
")",
"+",
"'h'"... | This part of the protocol is used by IRAF to set the frame number. | [
"This",
"part",
"of",
"the",
"protocol",
"is",
"used",
"by",
"IRAF",
"to",
"set",
"the",
"frame",
"number",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/experimental/plugins/IIS_DataListener.py#L390-L438 | train |
ejeschke/ginga | experimental/plugins/IIS_DataListener.py | IIS_RequestHandler.handle_imcursor | def handle_imcursor(self, pkt):
"""This part of the protocol is used by IRAF to read the cursor
position and keystrokes from the display client.
"""
self.logger.debug("handle imcursor")
if pkt.tid & IIS_READ:
if pkt.tid & IMC_SAMPLE:
self.logger.debug... | python | def handle_imcursor(self, pkt):
"""This part of the protocol is used by IRAF to read the cursor
position and keystrokes from the display client.
"""
self.logger.debug("handle imcursor")
if pkt.tid & IIS_READ:
if pkt.tid & IMC_SAMPLE:
self.logger.debug... | [
"def",
"handle_imcursor",
"(",
"self",
",",
"pkt",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"handle imcursor\"",
")",
"if",
"pkt",
".",
"tid",
"&",
"IIS_READ",
":",
"if",
"pkt",
".",
"tid",
"&",
"IMC_SAMPLE",
":",
"self",
".",
"logger",
... | This part of the protocol is used by IRAF to read the cursor
position and keystrokes from the display client. | [
"This",
"part",
"of",
"the",
"protocol",
"is",
"used",
"by",
"IRAF",
"to",
"read",
"the",
"cursor",
"position",
"and",
"keystrokes",
"from",
"the",
"display",
"client",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/experimental/plugins/IIS_DataListener.py#L632-L689 | train |
ejeschke/ginga | experimental/plugins/IIS_DataListener.py | IIS_RequestHandler.handle | def handle(self):
"""
This is where the action starts.
"""
self.logger = self.server.logger
# create a packet structure
packet = iis()
packet.datain = self.rfile
packet.dataout = self.wfile
# decode the header
size = struct.calcsize('8h')... | python | def handle(self):
"""
This is where the action starts.
"""
self.logger = self.server.logger
# create a packet structure
packet = iis()
packet.datain = self.rfile
packet.dataout = self.wfile
# decode the header
size = struct.calcsize('8h')... | [
"def",
"handle",
"(",
"self",
")",
":",
"self",
".",
"logger",
"=",
"self",
".",
"server",
".",
"logger",
"packet",
"=",
"iis",
"(",
")",
"packet",
".",
"datain",
"=",
"self",
".",
"rfile",
"packet",
".",
"dataout",
"=",
"self",
".",
"wfile",
"size... | This is where the action starts. | [
"This",
"is",
"where",
"the",
"action",
"starts",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/experimental/plugins/IIS_DataListener.py#L691-L804 | train |
ejeschke/ginga | experimental/plugins/IIS_DataListener.py | IIS_RequestHandler.display_image | def display_image(self, reset=1):
"""Utility routine used to display an updated frame from a framebuffer.
"""
try:
fb = self.server.controller.get_frame(self.frame)
except KeyError:
# the selected frame does not exist, create it
fb = self.server.contro... | python | def display_image(self, reset=1):
"""Utility routine used to display an updated frame from a framebuffer.
"""
try:
fb = self.server.controller.get_frame(self.frame)
except KeyError:
# the selected frame does not exist, create it
fb = self.server.contro... | [
"def",
"display_image",
"(",
"self",
",",
"reset",
"=",
"1",
")",
":",
"try",
":",
"fb",
"=",
"self",
".",
"server",
".",
"controller",
".",
"get_frame",
"(",
"self",
".",
"frame",
")",
"except",
"KeyError",
":",
"fb",
"=",
"self",
".",
"server",
"... | Utility routine used to display an updated frame from a framebuffer. | [
"Utility",
"routine",
"used",
"to",
"display",
"an",
"updated",
"frame",
"from",
"a",
"framebuffer",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/experimental/plugins/IIS_DataListener.py#L806-L826 | train |
ejeschke/ginga | ginga/rv/plugins/Contents.py | Contents._highlight_path | def _highlight_path(self, hl_path, tf):
"""Highlight or unhighlight a single entry.
Examples
--------
>>> hl_path = self._get_hl_key(chname, image)
>>> self._highlight_path(hl_path, True)
"""
fc = self.settings.get('row_font_color', 'green')
try:
... | python | def _highlight_path(self, hl_path, tf):
"""Highlight or unhighlight a single entry.
Examples
--------
>>> hl_path = self._get_hl_key(chname, image)
>>> self._highlight_path(hl_path, True)
"""
fc = self.settings.get('row_font_color', 'green')
try:
... | [
"def",
"_highlight_path",
"(",
"self",
",",
"hl_path",
",",
"tf",
")",
":",
"fc",
"=",
"self",
".",
"settings",
".",
"get",
"(",
"'row_font_color'",
",",
"'green'",
")",
"try",
":",
"self",
".",
"treeview",
".",
"highlight_path",
"(",
"hl_path",
",",
"... | Highlight or unhighlight a single entry.
Examples
--------
>>> hl_path = self._get_hl_key(chname, image)
>>> self._highlight_path(hl_path, True) | [
"Highlight",
"or",
"unhighlight",
"a",
"single",
"entry",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/Contents.py#L403-L418 | train |
ejeschke/ginga | ginga/rv/plugins/Contents.py | Contents.update_highlights | def update_highlights(self, old_highlight_set, new_highlight_set):
"""Unhighlight the entries represented by ``old_highlight_set``
and highlight the ones represented by ``new_highlight_set``.
Both are sets of keys.
"""
if not self.gui_up:
return
un_hilite_s... | python | def update_highlights(self, old_highlight_set, new_highlight_set):
"""Unhighlight the entries represented by ``old_highlight_set``
and highlight the ones represented by ``new_highlight_set``.
Both are sets of keys.
"""
if not self.gui_up:
return
un_hilite_s... | [
"def",
"update_highlights",
"(",
"self",
",",
"old_highlight_set",
",",
"new_highlight_set",
")",
":",
"if",
"not",
"self",
".",
"gui_up",
":",
"return",
"un_hilite_set",
"=",
"old_highlight_set",
"-",
"new_highlight_set",
"re_hilite_set",
"=",
"new_highlight_set",
... | Unhighlight the entries represented by ``old_highlight_set``
and highlight the ones represented by ``new_highlight_set``.
Both are sets of keys. | [
"Unhighlight",
"the",
"entries",
"represented",
"by",
"old_highlight_set",
"and",
"highlight",
"the",
"ones",
"represented",
"by",
"new_highlight_set",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/Contents.py#L420-L439 | train |
ejeschke/ginga | ginga/rv/plugins/Catalogs.py | CatalogListing.show_selection | def show_selection(self, star):
"""This method is called when the user clicks on a plotted star in the
fitsviewer.
"""
try:
# NOTE: this works around a quirk of Qt widget set where
# selecting programatically in the table triggers the widget
# selectio... | python | def show_selection(self, star):
"""This method is called when the user clicks on a plotted star in the
fitsviewer.
"""
try:
# NOTE: this works around a quirk of Qt widget set where
# selecting programatically in the table triggers the widget
# selectio... | [
"def",
"show_selection",
"(",
"self",
",",
"star",
")",
":",
"try",
":",
"self",
".",
"_select_flag",
"=",
"True",
"self",
".",
"mark_selection",
"(",
"star",
")",
"finally",
":",
"self",
".",
"_select_flag",
"=",
"False"
] | This method is called when the user clicks on a plotted star in the
fitsviewer. | [
"This",
"method",
"is",
"called",
"when",
"the",
"user",
"clicks",
"on",
"a",
"plotted",
"star",
"in",
"the",
"fitsviewer",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/Catalogs.py#L1028-L1040 | train |
ejeschke/ginga | ginga/rv/plugins/Catalogs.py | CatalogListing.select_star_cb | def select_star_cb(self, widget, res_dict):
"""This method is called when the user selects a star from the table.
"""
keys = list(res_dict.keys())
if len(keys) == 0:
self.selected = []
self.replot_stars()
else:
idx = int(keys[0])
st... | python | def select_star_cb(self, widget, res_dict):
"""This method is called when the user selects a star from the table.
"""
keys = list(res_dict.keys())
if len(keys) == 0:
self.selected = []
self.replot_stars()
else:
idx = int(keys[0])
st... | [
"def",
"select_star_cb",
"(",
"self",
",",
"widget",
",",
"res_dict",
")",
":",
"keys",
"=",
"list",
"(",
"res_dict",
".",
"keys",
"(",
")",
")",
"if",
"len",
"(",
"keys",
")",
"==",
"0",
":",
"self",
".",
"selected",
"=",
"[",
"]",
"self",
".",
... | This method is called when the user selects a star from the table. | [
"This",
"method",
"is",
"called",
"when",
"the",
"user",
"selects",
"a",
"star",
"from",
"the",
"table",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/Catalogs.py#L1308-L1320 | train |
ejeschke/ginga | ginga/BaseImage.py | BaseImage._calc_order | def _calc_order(self, order):
"""Called to set the order of a multi-channel image.
The order should be determined by the loader, but this will
make a best guess if passed `order` is `None`.
"""
if order is not None and order != '':
self.order = order.upper()
e... | python | def _calc_order(self, order):
"""Called to set the order of a multi-channel image.
The order should be determined by the loader, but this will
make a best guess if passed `order` is `None`.
"""
if order is not None and order != '':
self.order = order.upper()
e... | [
"def",
"_calc_order",
"(",
"self",
",",
"order",
")",
":",
"if",
"order",
"is",
"not",
"None",
"and",
"order",
"!=",
"''",
":",
"self",
".",
"order",
"=",
"order",
".",
"upper",
"(",
")",
"else",
":",
"shape",
"=",
"self",
".",
"shape",
"if",
"le... | Called to set the order of a multi-channel image.
The order should be determined by the loader, but this will
make a best guess if passed `order` is `None`. | [
"Called",
"to",
"set",
"the",
"order",
"of",
"a",
"multi",
"-",
"channel",
"image",
".",
"The",
"order",
"should",
"be",
"determined",
"by",
"the",
"loader",
"but",
"this",
"will",
"make",
"a",
"best",
"guess",
"if",
"passed",
"order",
"is",
"None",
".... | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/BaseImage.py#L221-L242 | train |
ejeschke/ginga | ginga/BaseImage.py | BaseImage.cutout_data | def cutout_data(self, x1, y1, x2, y2, xstep=1, ystep=1, astype=None):
"""cut out data area based on coords.
"""
view = np.s_[y1:y2:ystep, x1:x2:xstep]
data = self._slice(view)
if astype:
data = data.astype(astype, copy=False)
return data | python | def cutout_data(self, x1, y1, x2, y2, xstep=1, ystep=1, astype=None):
"""cut out data area based on coords.
"""
view = np.s_[y1:y2:ystep, x1:x2:xstep]
data = self._slice(view)
if astype:
data = data.astype(astype, copy=False)
return data | [
"def",
"cutout_data",
"(",
"self",
",",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
",",
"xstep",
"=",
"1",
",",
"ystep",
"=",
"1",
",",
"astype",
"=",
"None",
")",
":",
"view",
"=",
"np",
".",
"s_",
"[",
"y1",
":",
"y2",
":",
"ystep",
",",
"x1"... | cut out data area based on coords. | [
"cut",
"out",
"data",
"area",
"based",
"on",
"coords",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/BaseImage.py#L293-L300 | train |
ejeschke/ginga | ginga/BaseImage.py | BaseImage.get_shape_mask | def get_shape_mask(self, shape_obj):
"""
Return full mask where True marks pixels within the given shape.
"""
wd, ht = self.get_size()
yi = np.mgrid[:ht].reshape(-1, 1)
xi = np.mgrid[:wd].reshape(1, -1)
pts = np.asarray((xi, yi)).T
contains = shape_obj.con... | python | def get_shape_mask(self, shape_obj):
"""
Return full mask where True marks pixels within the given shape.
"""
wd, ht = self.get_size()
yi = np.mgrid[:ht].reshape(-1, 1)
xi = np.mgrid[:wd].reshape(1, -1)
pts = np.asarray((xi, yi)).T
contains = shape_obj.con... | [
"def",
"get_shape_mask",
"(",
"self",
",",
"shape_obj",
")",
":",
"wd",
",",
"ht",
"=",
"self",
".",
"get_size",
"(",
")",
"yi",
"=",
"np",
".",
"mgrid",
"[",
":",
"ht",
"]",
".",
"reshape",
"(",
"-",
"1",
",",
"1",
")",
"xi",
"=",
"np",
".",... | Return full mask where True marks pixels within the given shape. | [
"Return",
"full",
"mask",
"where",
"True",
"marks",
"pixels",
"within",
"the",
"given",
"shape",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/BaseImage.py#L348-L357 | train |
ejeschke/ginga | ginga/BaseImage.py | BaseImage.get_shape_view | def get_shape_view(self, shape_obj, avoid_oob=True):
"""
Calculate a bounding box in the data enclosing `shape_obj` and
return a view that accesses it and a mask that is True only for
pixels enclosed in the region.
If `avoid_oob` is True (default) then the bounding box is clippe... | python | def get_shape_view(self, shape_obj, avoid_oob=True):
"""
Calculate a bounding box in the data enclosing `shape_obj` and
return a view that accesses it and a mask that is True only for
pixels enclosed in the region.
If `avoid_oob` is True (default) then the bounding box is clippe... | [
"def",
"get_shape_view",
"(",
"self",
",",
"shape_obj",
",",
"avoid_oob",
"=",
"True",
")",
":",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
"=",
"[",
"int",
"(",
"np",
".",
"round",
"(",
"n",
")",
")",
"for",
"n",
"in",
"shape_obj",
".",
"get_llur",
... | Calculate a bounding box in the data enclosing `shape_obj` and
return a view that accesses it and a mask that is True only for
pixels enclosed in the region.
If `avoid_oob` is True (default) then the bounding box is clipped
to avoid coordinates outside of the actual data. | [
"Calculate",
"a",
"bounding",
"box",
"in",
"the",
"data",
"enclosing",
"shape_obj",
"and",
"return",
"a",
"view",
"that",
"accesses",
"it",
"and",
"a",
"mask",
"that",
"is",
"True",
"only",
"for",
"pixels",
"enclosed",
"in",
"the",
"region",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/BaseImage.py#L359-L383 | train |
ejeschke/ginga | ginga/BaseImage.py | BaseImage.cutout_shape | def cutout_shape(self, shape_obj):
"""
Cut out and return a portion of the data corresponding to `shape_obj`.
A masked numpy array is returned, where the pixels not enclosed in
the shape are masked out.
"""
view, mask = self.get_shape_view(shape_obj)
# cutout ou... | python | def cutout_shape(self, shape_obj):
"""
Cut out and return a portion of the data corresponding to `shape_obj`.
A masked numpy array is returned, where the pixels not enclosed in
the shape are masked out.
"""
view, mask = self.get_shape_view(shape_obj)
# cutout ou... | [
"def",
"cutout_shape",
"(",
"self",
",",
"shape_obj",
")",
":",
"view",
",",
"mask",
"=",
"self",
".",
"get_shape_view",
"(",
"shape_obj",
")",
"data",
"=",
"self",
".",
"_slice",
"(",
"view",
")",
"mdata",
"=",
"np",
".",
"ma",
".",
"array",
"(",
... | Cut out and return a portion of the data corresponding to `shape_obj`.
A masked numpy array is returned, where the pixels not enclosed in
the shape are masked out. | [
"Cut",
"out",
"and",
"return",
"a",
"portion",
"of",
"the",
"data",
"corresponding",
"to",
"shape_obj",
".",
"A",
"masked",
"numpy",
"array",
"is",
"returned",
"where",
"the",
"pixels",
"not",
"enclosed",
"in",
"the",
"shape",
"are",
"masked",
"out",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/BaseImage.py#L385-L399 | train |
ejeschke/ginga | ginga/misc/Callback.py | Callbacks.remove_callback | def remove_callback(self, name, fn, *args, **kwargs):
"""Remove a specific callback that was added.
"""
try:
tup = (fn, args, kwargs)
if tup in self.cb[name]:
self.cb[name].remove(tup)
except KeyError:
raise CallbackError("No callback c... | python | def remove_callback(self, name, fn, *args, **kwargs):
"""Remove a specific callback that was added.
"""
try:
tup = (fn, args, kwargs)
if tup in self.cb[name]:
self.cb[name].remove(tup)
except KeyError:
raise CallbackError("No callback c... | [
"def",
"remove_callback",
"(",
"self",
",",
"name",
",",
"fn",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"try",
":",
"tup",
"=",
"(",
"fn",
",",
"args",
",",
"kwargs",
")",
"if",
"tup",
"in",
"self",
".",
"cb",
"[",
"name",
"]",
":",
"... | Remove a specific callback that was added. | [
"Remove",
"a",
"specific",
"callback",
"that",
"was",
"added",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/misc/Callback.py#L83-L92 | train |
ejeschke/ginga | ginga/qtw/QtHelp.py | cmap2pixmap | def cmap2pixmap(cmap, steps=50):
"""Convert a Ginga colormap into a QPixmap
"""
import numpy as np
inds = np.linspace(0, 1, steps)
n = len(cmap.clst) - 1
tups = [cmap.clst[int(x * n)] for x in inds]
rgbas = [QColor(int(r * 255), int(g * 255),
int(b * 255), 255).rgba() fo... | python | def cmap2pixmap(cmap, steps=50):
"""Convert a Ginga colormap into a QPixmap
"""
import numpy as np
inds = np.linspace(0, 1, steps)
n = len(cmap.clst) - 1
tups = [cmap.clst[int(x * n)] for x in inds]
rgbas = [QColor(int(r * 255), int(g * 255),
int(b * 255), 255).rgba() fo... | [
"def",
"cmap2pixmap",
"(",
"cmap",
",",
"steps",
"=",
"50",
")",
":",
"import",
"numpy",
"as",
"np",
"inds",
"=",
"np",
".",
"linspace",
"(",
"0",
",",
"1",
",",
"steps",
")",
"n",
"=",
"len",
"(",
"cmap",
".",
"clst",
")",
"-",
"1",
"tups",
... | Convert a Ginga colormap into a QPixmap | [
"Convert",
"a",
"Ginga",
"colormap",
"into",
"a",
"QPixmap"
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/qtw/QtHelp.py#L293-L309 | train |
ejeschke/ginga | ginga/qtw/QtHelp.py | Timer.start | def start(self, duration=None):
"""Start the timer. If `duration` is not None, it should
specify the time to expiration in seconds.
"""
if duration is None:
duration = self.duration
self.set(duration) | python | def start(self, duration=None):
"""Start the timer. If `duration` is not None, it should
specify the time to expiration in seconds.
"""
if duration is None:
duration = self.duration
self.set(duration) | [
"def",
"start",
"(",
"self",
",",
"duration",
"=",
"None",
")",
":",
"if",
"duration",
"is",
"None",
":",
"duration",
"=",
"self",
".",
"duration",
"self",
".",
"set",
"(",
"duration",
")"
] | Start the timer. If `duration` is not None, it should
specify the time to expiration in seconds. | [
"Start",
"the",
"timer",
".",
"If",
"duration",
"is",
"not",
"None",
"it",
"should",
"specify",
"the",
"time",
"to",
"expiration",
"in",
"seconds",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/qtw/QtHelp.py#L258-L265 | train |
ejeschke/ginga | ginga/rv/plugins/ScreenShot.py | ScreenShot._snap_cb | def _snap_cb(self, w):
"""This function is called when the user clicks the 'Snap' button.
"""
# Clear the snap image viewer
self.scrnimage.clear()
self.scrnimage.redraw_now(whence=0)
self.fv.update_pending()
format = self.tosave_type
if self._screen_size... | python | def _snap_cb(self, w):
"""This function is called when the user clicks the 'Snap' button.
"""
# Clear the snap image viewer
self.scrnimage.clear()
self.scrnimage.redraw_now(whence=0)
self.fv.update_pending()
format = self.tosave_type
if self._screen_size... | [
"def",
"_snap_cb",
"(",
"self",
",",
"w",
")",
":",
"self",
".",
"scrnimage",
".",
"clear",
"(",
")",
"self",
".",
"scrnimage",
".",
"redraw_now",
"(",
"whence",
"=",
"0",
")",
"self",
".",
"fv",
".",
"update_pending",
"(",
")",
"format",
"=",
"sel... | This function is called when the user clicks the 'Snap' button. | [
"This",
"function",
"is",
"called",
"when",
"the",
"user",
"clicks",
"the",
"Snap",
"button",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/ScreenShot.py#L272-L332 | train |
ejeschke/ginga | ginga/rv/plugins/ScreenShot.py | ScreenShot._save_cb | def _save_cb(self, w):
"""This function is called when the user clicks the 'Save' button.
We save the last taken shot to the folder and name specified.
"""
format = self.saved_type
if format is None:
return self.fv.show_error("Please save an image first.")
# ... | python | def _save_cb(self, w):
"""This function is called when the user clicks the 'Save' button.
We save the last taken shot to the folder and name specified.
"""
format = self.saved_type
if format is None:
return self.fv.show_error("Please save an image first.")
# ... | [
"def",
"_save_cb",
"(",
"self",
",",
"w",
")",
":",
"format",
"=",
"self",
".",
"saved_type",
"if",
"format",
"is",
"None",
":",
"return",
"self",
".",
"fv",
".",
"show_error",
"(",
"\"Please save an image first.\"",
")",
"filename",
"=",
"self",
".",
"w... | This function is called when the user clicks the 'Save' button.
We save the last taken shot to the folder and name specified. | [
"This",
"function",
"is",
"called",
"when",
"the",
"user",
"clicks",
"the",
"Save",
"button",
".",
"We",
"save",
"the",
"last",
"taken",
"shot",
"to",
"the",
"folder",
"and",
"name",
"specified",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/ScreenShot.py#L354-L380 | train |
ejeschke/ginga | ginga/rv/plugins/ScreenShot.py | ScreenShot._lock_aspect_cb | def _lock_aspect_cb(self, w, tf):
"""This function is called when the user clicks the 'Lock aspect'
checkbox. `tf` is True if checked, False otherwise.
"""
self._lock_aspect = tf
self.w.aspect.set_enabled(tf)
if self._lock_aspect:
self._set_aspect_cb()
... | python | def _lock_aspect_cb(self, w, tf):
"""This function is called when the user clicks the 'Lock aspect'
checkbox. `tf` is True if checked, False otherwise.
"""
self._lock_aspect = tf
self.w.aspect.set_enabled(tf)
if self._lock_aspect:
self._set_aspect_cb()
... | [
"def",
"_lock_aspect_cb",
"(",
"self",
",",
"w",
",",
"tf",
")",
":",
"self",
".",
"_lock_aspect",
"=",
"tf",
"self",
".",
"w",
".",
"aspect",
".",
"set_enabled",
"(",
"tf",
")",
"if",
"self",
".",
"_lock_aspect",
":",
"self",
".",
"_set_aspect_cb",
... | This function is called when the user clicks the 'Lock aspect'
checkbox. `tf` is True if checked, False otherwise. | [
"This",
"function",
"is",
"called",
"when",
"the",
"user",
"clicks",
"the",
"Lock",
"aspect",
"checkbox",
".",
"tf",
"is",
"True",
"if",
"checked",
"False",
"otherwise",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/ScreenShot.py#L494-L505 | train |
ejeschke/ginga | ginga/rv/plugins/ScreenShot.py | ScreenShot._screen_size_cb | def _screen_size_cb(self, w, tf):
"""This function is called when the user clicks the 'Screen size'
checkbox. `tf` is True if checked, False otherwise.
"""
self._screen_size = tf
self.w.width.set_enabled(not tf)
self.w.height.set_enabled(not tf)
self.w.lock_aspec... | python | def _screen_size_cb(self, w, tf):
"""This function is called when the user clicks the 'Screen size'
checkbox. `tf` is True if checked, False otherwise.
"""
self._screen_size = tf
self.w.width.set_enabled(not tf)
self.w.height.set_enabled(not tf)
self.w.lock_aspec... | [
"def",
"_screen_size_cb",
"(",
"self",
",",
"w",
",",
"tf",
")",
":",
"self",
".",
"_screen_size",
"=",
"tf",
"self",
".",
"w",
".",
"width",
".",
"set_enabled",
"(",
"not",
"tf",
")",
"self",
".",
"w",
".",
"height",
".",
"set_enabled",
"(",
"not"... | This function is called when the user clicks the 'Screen size'
checkbox. `tf` is True if checked, False otherwise. | [
"This",
"function",
"is",
"called",
"when",
"the",
"user",
"clicks",
"the",
"Screen",
"size",
"checkbox",
".",
"tf",
"is",
"True",
"if",
"checked",
"False",
"otherwise",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/ScreenShot.py#L517-L527 | train |
ejeschke/ginga | ginga/util/io_asdf.py | load_asdf | def load_asdf(asdf_obj, data_key='sci', wcs_key='wcs', header_key='meta'):
"""
Load from an ASDF object.
Parameters
----------
asdf_obj : obj
ASDF or ASDF-in-FITS object.
data_key, wcs_key, header_key : str
Key values to specify where to find data, WCS, and header
in AS... | python | def load_asdf(asdf_obj, data_key='sci', wcs_key='wcs', header_key='meta'):
"""
Load from an ASDF object.
Parameters
----------
asdf_obj : obj
ASDF or ASDF-in-FITS object.
data_key, wcs_key, header_key : str
Key values to specify where to find data, WCS, and header
in AS... | [
"def",
"load_asdf",
"(",
"asdf_obj",
",",
"data_key",
"=",
"'sci'",
",",
"wcs_key",
"=",
"'wcs'",
",",
"header_key",
"=",
"'meta'",
")",
":",
"asdf_keys",
"=",
"asdf_obj",
".",
"keys",
"(",
")",
"if",
"wcs_key",
"in",
"asdf_keys",
":",
"wcs",
"=",
"asd... | Load from an ASDF object.
Parameters
----------
asdf_obj : obj
ASDF or ASDF-in-FITS object.
data_key, wcs_key, header_key : str
Key values to specify where to find data, WCS, and header
in ASDF.
Returns
-------
data : ndarray or `None`
Image data, if found.... | [
"Load",
"from",
"an",
"ASDF",
"object",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/util/io_asdf.py#L23-L66 | train |
ejeschke/ginga | ginga/rv/plugins/Colorbar.py | Colorbar._match_cmap | def _match_cmap(self, fitsimage, colorbar):
"""
Help method to change the ColorBar to match the cut levels or
colormap used in a ginga ImageView.
"""
rgbmap = fitsimage.get_rgbmap()
loval, hival = fitsimage.get_cut_levels()
colorbar.set_range(loval, hival)
... | python | def _match_cmap(self, fitsimage, colorbar):
"""
Help method to change the ColorBar to match the cut levels or
colormap used in a ginga ImageView.
"""
rgbmap = fitsimage.get_rgbmap()
loval, hival = fitsimage.get_cut_levels()
colorbar.set_range(loval, hival)
... | [
"def",
"_match_cmap",
"(",
"self",
",",
"fitsimage",
",",
"colorbar",
")",
":",
"rgbmap",
"=",
"fitsimage",
".",
"get_rgbmap",
"(",
")",
"loval",
",",
"hival",
"=",
"fitsimage",
".",
"get_cut_levels",
"(",
")",
"colorbar",
".",
"set_range",
"(",
"loval",
... | Help method to change the ColorBar to match the cut levels or
colormap used in a ginga ImageView. | [
"Help",
"method",
"to",
"change",
"the",
"ColorBar",
"to",
"match",
"the",
"cut",
"levels",
"or",
"colormap",
"used",
"in",
"a",
"ginga",
"ImageView",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/Colorbar.py#L88-L98 | train |
ejeschke/ginga | ginga/rv/plugins/Colorbar.py | Colorbar.rgbmap_cb | def rgbmap_cb(self, rgbmap, channel):
"""
This method is called when the RGBMap is changed. We update
the ColorBar to match.
"""
if not self.gui_up:
return
fitsimage = channel.fitsimage
if fitsimage != self.fv.getfocus_fitsimage():
return ... | python | def rgbmap_cb(self, rgbmap, channel):
"""
This method is called when the RGBMap is changed. We update
the ColorBar to match.
"""
if not self.gui_up:
return
fitsimage = channel.fitsimage
if fitsimage != self.fv.getfocus_fitsimage():
return ... | [
"def",
"rgbmap_cb",
"(",
"self",
",",
"rgbmap",
",",
"channel",
")",
":",
"if",
"not",
"self",
".",
"gui_up",
":",
"return",
"fitsimage",
"=",
"channel",
".",
"fitsimage",
"if",
"fitsimage",
"!=",
"self",
".",
"fv",
".",
"getfocus_fitsimage",
"(",
")",
... | This method is called when the RGBMap is changed. We update
the ColorBar to match. | [
"This",
"method",
"is",
"called",
"when",
"the",
"RGBMap",
"is",
"changed",
".",
"We",
"update",
"the",
"ColorBar",
"to",
"match",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/Colorbar.py#L130-L140 | train |
ejeschke/ginga | ginga/util/addons.py | show_mode_indicator | def show_mode_indicator(viewer, tf, corner='ur'):
"""Show a keyboard mode indicator in one of the corners.
Parameters
----------
viewer : an ImageView subclass instance
If True, show the color bar; else remove it if present.
tf : bool
If True, show the mark; else remove it if prese... | python | def show_mode_indicator(viewer, tf, corner='ur'):
"""Show a keyboard mode indicator in one of the corners.
Parameters
----------
viewer : an ImageView subclass instance
If True, show the color bar; else remove it if present.
tf : bool
If True, show the mark; else remove it if prese... | [
"def",
"show_mode_indicator",
"(",
"viewer",
",",
"tf",
",",
"corner",
"=",
"'ur'",
")",
":",
"tag",
"=",
"'_$mode_indicator'",
"canvas",
"=",
"viewer",
".",
"get_private_canvas",
"(",
")",
"try",
":",
"indic",
"=",
"canvas",
".",
"get_object_by_tag",
"(",
... | Show a keyboard mode indicator in one of the corners.
Parameters
----------
viewer : an ImageView subclass instance
If True, show the color bar; else remove it if present.
tf : bool
If True, show the mark; else remove it if present.
corner : str
One of 'll', 'lr', 'ul' or ... | [
"Show",
"a",
"keyboard",
"mode",
"indicator",
"in",
"one",
"of",
"the",
"corners",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/util/addons.py#L44-L81 | train |
ejeschke/ginga | ginga/util/addons.py | show_color_bar | def show_color_bar(viewer, tf, side='bottom'):
"""Show a color bar in the window.
Parameters
----------
viewer : an ImageView subclass instance
If True, show the color bar; else remove it if present.
tf : bool
If True, show the color bar; else remove it if present.
side : str
... | python | def show_color_bar(viewer, tf, side='bottom'):
"""Show a color bar in the window.
Parameters
----------
viewer : an ImageView subclass instance
If True, show the color bar; else remove it if present.
tf : bool
If True, show the color bar; else remove it if present.
side : str
... | [
"def",
"show_color_bar",
"(",
"viewer",
",",
"tf",
",",
"side",
"=",
"'bottom'",
")",
":",
"tag",
"=",
"'_$color_bar'",
"canvas",
"=",
"viewer",
".",
"get_private_canvas",
"(",
")",
"try",
":",
"cbar",
"=",
"canvas",
".",
"get_object_by_tag",
"(",
"tag",
... | Show a color bar in the window.
Parameters
----------
viewer : an ImageView subclass instance
If True, show the color bar; else remove it if present.
tf : bool
If True, show the color bar; else remove it if present.
side : str
One of 'top' or 'bottom'. The default is 'bott... | [
"Show",
"a",
"color",
"bar",
"in",
"the",
"window",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/util/addons.py#L84-L114 | train |
ejeschke/ginga | ginga/util/addons.py | show_focus_indicator | def show_focus_indicator(viewer, tf, color='white'):
"""Show a focus indicator in the window.
Parameters
----------
viewer : an ImageView subclass instance
If True, show the color bar; else remove it if present.
tf : bool
If True, show the color bar; else remove it if present.
... | python | def show_focus_indicator(viewer, tf, color='white'):
"""Show a focus indicator in the window.
Parameters
----------
viewer : an ImageView subclass instance
If True, show the color bar; else remove it if present.
tf : bool
If True, show the color bar; else remove it if present.
... | [
"def",
"show_focus_indicator",
"(",
"viewer",
",",
"tf",
",",
"color",
"=",
"'white'",
")",
":",
"tag",
"=",
"'_$focus_indicator'",
"canvas",
"=",
"viewer",
".",
"get_private_canvas",
"(",
")",
"try",
":",
"fcsi",
"=",
"canvas",
".",
"get_object_by_tag",
"("... | Show a focus indicator in the window.
Parameters
----------
viewer : an ImageView subclass instance
If True, show the color bar; else remove it if present.
tf : bool
If True, show the color bar; else remove it if present.
color : str
Color for the focus indicator. | [
"Show",
"a",
"focus",
"indicator",
"in",
"the",
"window",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/util/addons.py#L117-L149 | train |
ejeschke/ginga | ginga/util/addons.py | add_zoom_buttons | def add_zoom_buttons(viewer, canvas=None, color='black'):
"""Add zoom buttons to a canvas.
Parameters
----------
viewer : an ImageView subclass instance
If True, show the color bar; else remove it if present.
canvas : a DrawingCanvas instance
The canvas to which the buttons should ... | python | def add_zoom_buttons(viewer, canvas=None, color='black'):
"""Add zoom buttons to a canvas.
Parameters
----------
viewer : an ImageView subclass instance
If True, show the color bar; else remove it if present.
canvas : a DrawingCanvas instance
The canvas to which the buttons should ... | [
"def",
"add_zoom_buttons",
"(",
"viewer",
",",
"canvas",
"=",
"None",
",",
"color",
"=",
"'black'",
")",
":",
"def",
"zoom",
"(",
"box",
",",
"canvas",
",",
"event",
",",
"pt",
",",
"viewer",
",",
"n",
")",
":",
"zl",
"=",
"viewer",
".",
"get_zoom"... | Add zoom buttons to a canvas.
Parameters
----------
viewer : an ImageView subclass instance
If True, show the color bar; else remove it if present.
canvas : a DrawingCanvas instance
The canvas to which the buttons should be added. If not supplied
defaults to the private canvas... | [
"Add",
"zoom",
"buttons",
"to",
"a",
"canvas",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/util/addons.py#L152-L220 | train |
ejeschke/ginga | ginga/gtkw/ImageViewGtk.py | ImageViewGtk.expose_event | def expose_event(self, widget, event):
"""When an area of the window is exposed, we just copy out of the
server-side, off-screen surface to that area.
"""
x, y, width, height = event.area
self.logger.debug("surface is %s" % self.surface)
if self.surface is not None:
... | python | def expose_event(self, widget, event):
"""When an area of the window is exposed, we just copy out of the
server-side, off-screen surface to that area.
"""
x, y, width, height = event.area
self.logger.debug("surface is %s" % self.surface)
if self.surface is not None:
... | [
"def",
"expose_event",
"(",
"self",
",",
"widget",
",",
"event",
")",
":",
"x",
",",
"y",
",",
"width",
",",
"height",
"=",
"event",
".",
"area",
"self",
".",
"logger",
".",
"debug",
"(",
"\"surface is %s\"",
"%",
"self",
".",
"surface",
")",
"if",
... | When an area of the window is exposed, we just copy out of the
server-side, off-screen surface to that area. | [
"When",
"an",
"area",
"of",
"the",
"window",
"is",
"exposed",
"we",
"just",
"copy",
"out",
"of",
"the",
"server",
"-",
"side",
"off",
"-",
"screen",
"surface",
"to",
"that",
"area",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/gtkw/ImageViewGtk.py#L150-L169 | train |
ejeschke/ginga | ginga/gtkw/ImageViewGtk.py | ImageViewGtk.size_request | def size_request(self, widget, requisition):
"""Callback function to request our desired size.
"""
requisition.width, requisition.height = self.get_desired_size()
return True | python | def size_request(self, widget, requisition):
"""Callback function to request our desired size.
"""
requisition.width, requisition.height = self.get_desired_size()
return True | [
"def",
"size_request",
"(",
"self",
",",
"widget",
",",
"requisition",
")",
":",
"requisition",
".",
"width",
",",
"requisition",
".",
"height",
"=",
"self",
".",
"get_desired_size",
"(",
")",
"return",
"True"
] | Callback function to request our desired size. | [
"Callback",
"function",
"to",
"request",
"our",
"desired",
"size",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/gtkw/ImageViewGtk.py#L195-L199 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.get_plugin_spec | def get_plugin_spec(self, name):
"""Get the specification attributes for plugin with name `name`."""
l_name = name.lower()
for spec in self.plugins:
name = spec.get('name', spec.get('klass', spec.module))
if name.lower() == l_name:
return spec
rais... | python | def get_plugin_spec(self, name):
"""Get the specification attributes for plugin with name `name`."""
l_name = name.lower()
for spec in self.plugins:
name = spec.get('name', spec.get('klass', spec.module))
if name.lower() == l_name:
return spec
rais... | [
"def",
"get_plugin_spec",
"(",
"self",
",",
"name",
")",
":",
"l_name",
"=",
"name",
".",
"lower",
"(",
")",
"for",
"spec",
"in",
"self",
".",
"plugins",
":",
"name",
"=",
"spec",
".",
"get",
"(",
"'name'",
",",
"spec",
".",
"get",
"(",
"'klass'",
... | Get the specification attributes for plugin with name `name`. | [
"Get",
"the",
"specification",
"attributes",
"for",
"plugin",
"with",
"name",
"name",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L397-L404 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.help_text | def help_text(self, name, text, text_kind='plain', trim_pfx=0):
"""
Provide help text for the user.
This method will convert the text as necessary with docutils and
display it in the WBrowser plugin, if available. If the plugin is
not available and the text is type 'rst' then t... | python | def help_text(self, name, text, text_kind='plain', trim_pfx=0):
"""
Provide help text for the user.
This method will convert the text as necessary with docutils and
display it in the WBrowser plugin, if available. If the plugin is
not available and the text is type 'rst' then t... | [
"def",
"help_text",
"(",
"self",
",",
"name",
",",
"text",
",",
"text_kind",
"=",
"'plain'",
",",
"trim_pfx",
"=",
"0",
")",
":",
"if",
"trim_pfx",
">",
"0",
":",
"text",
"=",
"toolbox",
".",
"trim_prefix",
"(",
"text",
",",
"trim_pfx",
")",
"if",
... | Provide help text for the user.
This method will convert the text as necessary with docutils and
display it in the WBrowser plugin, if available. If the plugin is
not available and the text is type 'rst' then the text will be
displayed in a plain text widget.
Parameters
... | [
"Provide",
"help",
"text",
"for",
"the",
"user",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L455-L510 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.load_file | def load_file(self, filepath, chname=None, wait=True,
create_channel=True, display_image=True,
image_loader=None):
"""Load a file and display it.
Parameters
----------
filepath : str
The path of the file to load (must reference a local fil... | python | def load_file(self, filepath, chname=None, wait=True,
create_channel=True, display_image=True,
image_loader=None):
"""Load a file and display it.
Parameters
----------
filepath : str
The path of the file to load (must reference a local fil... | [
"def",
"load_file",
"(",
"self",
",",
"filepath",
",",
"chname",
"=",
"None",
",",
"wait",
"=",
"True",
",",
"create_channel",
"=",
"True",
",",
"display_image",
"=",
"True",
",",
"image_loader",
"=",
"None",
")",
":",
"if",
"not",
"chname",
":",
"chan... | Load a file and display it.
Parameters
----------
filepath : str
The path of the file to load (must reference a local file).
chname : str, optional
The name of the channel in which to display the image.
wait : bool, optional
If `True`, then ... | [
"Load",
"a",
"file",
"and",
"display",
"it",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L615-L710 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.add_download | def add_download(self, info, future):
"""
Hand off a download to the Downloads plugin, if it is present.
Parameters
----------
info : `~ginga.misc.Bunch.Bunch`
A bunch of information about the URI as returned by
`ginga.util.iohelper.get_fileinfo()`
... | python | def add_download(self, info, future):
"""
Hand off a download to the Downloads plugin, if it is present.
Parameters
----------
info : `~ginga.misc.Bunch.Bunch`
A bunch of information about the URI as returned by
`ginga.util.iohelper.get_fileinfo()`
... | [
"def",
"add_download",
"(",
"self",
",",
"info",
",",
"future",
")",
":",
"if",
"self",
".",
"gpmon",
".",
"has_plugin",
"(",
"'Downloads'",
")",
":",
"obj",
"=",
"self",
".",
"gpmon",
".",
"get_plugin",
"(",
"'Downloads'",
")",
"self",
".",
"gui_do",
... | Hand off a download to the Downloads plugin, if it is present.
Parameters
----------
info : `~ginga.misc.Bunch.Bunch`
A bunch of information about the URI as returned by
`ginga.util.iohelper.get_fileinfo()`
future : `~ginga.misc.Future.Future`
A futu... | [
"Hand",
"off",
"a",
"download",
"to",
"the",
"Downloads",
"plugin",
"if",
"it",
"is",
"present",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L712-L732 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.open_file_cont | def open_file_cont(self, pathspec, loader_cont_fn):
"""Open a file and do some action on it.
Parameters
----------
pathspec : str
The path of the file to load (can be a URI, but must reference
a local file).
loader_cont_fn : func (data_obj) -> None
... | python | def open_file_cont(self, pathspec, loader_cont_fn):
"""Open a file and do some action on it.
Parameters
----------
pathspec : str
The path of the file to load (can be a URI, but must reference
a local file).
loader_cont_fn : func (data_obj) -> None
... | [
"def",
"open_file_cont",
"(",
"self",
",",
"pathspec",
",",
"loader_cont_fn",
")",
":",
"info",
"=",
"iohelper",
".",
"get_fileinfo",
"(",
"pathspec",
")",
"filepath",
"=",
"info",
".",
"filepath",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"fil... | Open a file and do some action on it.
Parameters
----------
pathspec : str
The path of the file to load (can be a URI, but must reference
a local file).
loader_cont_fn : func (data_obj) -> None
A continuation consisting of a function of one argument
... | [
"Open",
"a",
"file",
"and",
"do",
"some",
"action",
"on",
"it",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L772-L833 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.open_uris | def open_uris(self, uris, chname=None, bulk_add=False):
"""Open a set of URIs.
Parameters
----------
uris : list of str
The URIs of the files to load
chname: str, optional (defaults to channel with focus)
The name of the channel in which to load the item... | python | def open_uris(self, uris, chname=None, bulk_add=False):
"""Open a set of URIs.
Parameters
----------
uris : list of str
The URIs of the files to load
chname: str, optional (defaults to channel with focus)
The name of the channel in which to load the item... | [
"def",
"open_uris",
"(",
"self",
",",
"uris",
",",
"chname",
"=",
"None",
",",
"bulk_add",
"=",
"False",
")",
":",
"if",
"len",
"(",
"uris",
")",
"==",
"0",
":",
"return",
"if",
"chname",
"is",
"None",
":",
"channel",
"=",
"self",
".",
"get_channel... | Open a set of URIs.
Parameters
----------
uris : list of str
The URIs of the files to load
chname: str, optional (defaults to channel with focus)
The name of the channel in which to load the items
bulk_add : bool, optional (defaults to False)
... | [
"Open",
"a",
"set",
"of",
"URIs",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L835-L886 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.zoom_in | def zoom_in(self):
"""Zoom the view in one zoom step.
"""
viewer = self.getfocus_viewer()
if hasattr(viewer, 'zoom_in'):
viewer.zoom_in()
return True | python | def zoom_in(self):
"""Zoom the view in one zoom step.
"""
viewer = self.getfocus_viewer()
if hasattr(viewer, 'zoom_in'):
viewer.zoom_in()
return True | [
"def",
"zoom_in",
"(",
"self",
")",
":",
"viewer",
"=",
"self",
".",
"getfocus_viewer",
"(",
")",
"if",
"hasattr",
"(",
"viewer",
",",
"'zoom_in'",
")",
":",
"viewer",
".",
"zoom_in",
"(",
")",
"return",
"True"
] | Zoom the view in one zoom step. | [
"Zoom",
"the",
"view",
"in",
"one",
"zoom",
"step",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L923-L929 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.zoom_out | def zoom_out(self):
"""Zoom the view out one zoom step.
"""
viewer = self.getfocus_viewer()
if hasattr(viewer, 'zoom_out'):
viewer.zoom_out()
return True | python | def zoom_out(self):
"""Zoom the view out one zoom step.
"""
viewer = self.getfocus_viewer()
if hasattr(viewer, 'zoom_out'):
viewer.zoom_out()
return True | [
"def",
"zoom_out",
"(",
"self",
")",
":",
"viewer",
"=",
"self",
".",
"getfocus_viewer",
"(",
")",
"if",
"hasattr",
"(",
"viewer",
",",
"'zoom_out'",
")",
":",
"viewer",
".",
"zoom_out",
"(",
")",
"return",
"True"
] | Zoom the view out one zoom step. | [
"Zoom",
"the",
"view",
"out",
"one",
"zoom",
"step",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L931-L937 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.zoom_fit | def zoom_fit(self):
"""Zoom the view to fit the image entirely in the window.
"""
viewer = self.getfocus_viewer()
if hasattr(viewer, 'zoom_fit'):
viewer.zoom_fit()
return True | python | def zoom_fit(self):
"""Zoom the view to fit the image entirely in the window.
"""
viewer = self.getfocus_viewer()
if hasattr(viewer, 'zoom_fit'):
viewer.zoom_fit()
return True | [
"def",
"zoom_fit",
"(",
"self",
")",
":",
"viewer",
"=",
"self",
".",
"getfocus_viewer",
"(",
")",
"if",
"hasattr",
"(",
"viewer",
",",
"'zoom_fit'",
")",
":",
"viewer",
".",
"zoom_fit",
"(",
")",
"return",
"True"
] | Zoom the view to fit the image entirely in the window. | [
"Zoom",
"the",
"view",
"to",
"fit",
"the",
"image",
"entirely",
"in",
"the",
"window",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L947-L953 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.prev_img_ws | def prev_img_ws(self, ws, loop=True):
"""Go to the previous image in the focused channel in the workspace.
"""
channel = self.get_active_channel_ws(ws)
if channel is None:
return
channel.prev_image()
return True | python | def prev_img_ws(self, ws, loop=True):
"""Go to the previous image in the focused channel in the workspace.
"""
channel = self.get_active_channel_ws(ws)
if channel is None:
return
channel.prev_image()
return True | [
"def",
"prev_img_ws",
"(",
"self",
",",
"ws",
",",
"loop",
"=",
"True",
")",
":",
"channel",
"=",
"self",
".",
"get_active_channel_ws",
"(",
"ws",
")",
"if",
"channel",
"is",
"None",
":",
"return",
"channel",
".",
"prev_image",
"(",
")",
"return",
"Tru... | Go to the previous image in the focused channel in the workspace. | [
"Go",
"to",
"the",
"previous",
"image",
"in",
"the",
"focused",
"channel",
"in",
"the",
"workspace",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L962-L969 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.next_img_ws | def next_img_ws(self, ws, loop=True):
"""Go to the next image in the focused channel in the workspace.
"""
channel = self.get_active_channel_ws(ws)
if channel is None:
return
channel.next_image()
return True | python | def next_img_ws(self, ws, loop=True):
"""Go to the next image in the focused channel in the workspace.
"""
channel = self.get_active_channel_ws(ws)
if channel is None:
return
channel.next_image()
return True | [
"def",
"next_img_ws",
"(",
"self",
",",
"ws",
",",
"loop",
"=",
"True",
")",
":",
"channel",
"=",
"self",
".",
"get_active_channel_ws",
"(",
"ws",
")",
"if",
"channel",
"is",
"None",
":",
"return",
"channel",
".",
"next_image",
"(",
")",
"return",
"Tru... | Go to the next image in the focused channel in the workspace. | [
"Go",
"to",
"the",
"next",
"image",
"in",
"the",
"focused",
"channel",
"in",
"the",
"workspace",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L971-L978 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.prev_img | def prev_img(self, loop=True):
"""Go to the previous image in the channel.
"""
channel = self.get_current_channel()
if channel is None:
self.show_error("Please create a channel.", raisetab=True)
return
channel.prev_image()
return True | python | def prev_img(self, loop=True):
"""Go to the previous image in the channel.
"""
channel = self.get_current_channel()
if channel is None:
self.show_error("Please create a channel.", raisetab=True)
return
channel.prev_image()
return True | [
"def",
"prev_img",
"(",
"self",
",",
"loop",
"=",
"True",
")",
":",
"channel",
"=",
"self",
".",
"get_current_channel",
"(",
")",
"if",
"channel",
"is",
"None",
":",
"self",
".",
"show_error",
"(",
"\"Please create a channel.\"",
",",
"raisetab",
"=",
"Tru... | Go to the previous image in the channel. | [
"Go",
"to",
"the",
"previous",
"image",
"in",
"the",
"channel",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L980-L988 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.next_img | def next_img(self, loop=True):
"""Go to the next image in the channel.
"""
channel = self.get_current_channel()
if channel is None:
self.show_error("Please create a channel.", raisetab=True)
return
channel.next_image()
return True | python | def next_img(self, loop=True):
"""Go to the next image in the channel.
"""
channel = self.get_current_channel()
if channel is None:
self.show_error("Please create a channel.", raisetab=True)
return
channel.next_image()
return True | [
"def",
"next_img",
"(",
"self",
",",
"loop",
"=",
"True",
")",
":",
"channel",
"=",
"self",
".",
"get_current_channel",
"(",
")",
"if",
"channel",
"is",
"None",
":",
"self",
".",
"show_error",
"(",
"\"Please create a channel.\"",
",",
"raisetab",
"=",
"Tru... | Go to the next image in the channel. | [
"Go",
"to",
"the",
"next",
"image",
"in",
"the",
"channel",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L990-L998 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.close_plugins | def close_plugins(self, channel):
"""Close all plugins associated with the channel."""
opmon = channel.opmon
for key in opmon.get_active():
obj = opmon.get_plugin(key)
try:
self.gui_call(obj.close)
except Exception as e:
self.l... | python | def close_plugins(self, channel):
"""Close all plugins associated with the channel."""
opmon = channel.opmon
for key in opmon.get_active():
obj = opmon.get_plugin(key)
try:
self.gui_call(obj.close)
except Exception as e:
self.l... | [
"def",
"close_plugins",
"(",
"self",
",",
"channel",
")",
":",
"opmon",
"=",
"channel",
".",
"opmon",
"for",
"key",
"in",
"opmon",
".",
"get_active",
"(",
")",
":",
"obj",
"=",
"opmon",
".",
"get_plugin",
"(",
"key",
")",
"try",
":",
"self",
".",
"... | Close all plugins associated with the channel. | [
"Close",
"all",
"plugins",
"associated",
"with",
"the",
"channel",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L1227-L1237 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.add_channel | def add_channel(self, chname, workspace=None,
num_images=None, settings=None,
settings_template=None,
settings_share=None, share_keylist=None):
"""Create a new Ginga channel.
Parameters
----------
chname : str
The n... | python | def add_channel(self, chname, workspace=None,
num_images=None, settings=None,
settings_template=None,
settings_share=None, share_keylist=None):
"""Create a new Ginga channel.
Parameters
----------
chname : str
The n... | [
"def",
"add_channel",
"(",
"self",
",",
"chname",
",",
"workspace",
"=",
"None",
",",
"num_images",
"=",
"None",
",",
"settings",
"=",
"None",
",",
"settings_template",
"=",
"None",
",",
"settings_share",
"=",
"None",
",",
"share_keylist",
"=",
"None",
")"... | Create a new Ginga channel.
Parameters
----------
chname : str
The name of the channel to create.
workspace : str or None
The name of the workspace in which to create the channel
num_images : int or None
The cache size for the number of imag... | [
"Create",
"a",
"new",
"Ginga",
"channel",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L1344-L1462 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.delete_channel | def delete_channel(self, chname):
"""Delete a given channel from viewer."""
name = chname.lower()
if len(self.channel_names) < 1:
self.logger.error('Delete channel={0} failed. '
'No channels left.'.format(chname))
return
with self.l... | python | def delete_channel(self, chname):
"""Delete a given channel from viewer."""
name = chname.lower()
if len(self.channel_names) < 1:
self.logger.error('Delete channel={0} failed. '
'No channels left.'.format(chname))
return
with self.l... | [
"def",
"delete_channel",
"(",
"self",
",",
"chname",
")",
":",
"name",
"=",
"chname",
".",
"lower",
"(",
")",
"if",
"len",
"(",
"self",
".",
"channel_names",
")",
"<",
"1",
":",
"self",
".",
"logger",
".",
"error",
"(",
"'Delete channel={0} failed. '",
... | Delete a given channel from viewer. | [
"Delete",
"a",
"given",
"channel",
"from",
"viewer",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L1464-L1501 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.add_menu | def add_menu(self, name):
"""Add a menu with name `name` to the global menu bar.
Returns a menu widget.
"""
if self.menubar is None:
raise ValueError("No menu bar configured")
return self.menubar.add_name(name) | python | def add_menu(self, name):
"""Add a menu with name `name` to the global menu bar.
Returns a menu widget.
"""
if self.menubar is None:
raise ValueError("No menu bar configured")
return self.menubar.add_name(name) | [
"def",
"add_menu",
"(",
"self",
",",
"name",
")",
":",
"if",
"self",
".",
"menubar",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"No menu bar configured\"",
")",
"return",
"self",
".",
"menubar",
".",
"add_name",
"(",
"name",
")"
] | Add a menu with name `name` to the global menu bar.
Returns a menu widget. | [
"Add",
"a",
"menu",
"with",
"name",
"name",
"to",
"the",
"global",
"menu",
"bar",
".",
"Returns",
"a",
"menu",
"widget",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L1750-L1756 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.get_menu | def get_menu(self, name):
"""Get the menu with name `name` from the global menu bar.
Returns a menu widget.
"""
if self.menubar is None:
raise ValueError("No menu bar configured")
return self.menubar.get_menu(name) | python | def get_menu(self, name):
"""Get the menu with name `name` from the global menu bar.
Returns a menu widget.
"""
if self.menubar is None:
raise ValueError("No menu bar configured")
return self.menubar.get_menu(name) | [
"def",
"get_menu",
"(",
"self",
",",
"name",
")",
":",
"if",
"self",
".",
"menubar",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"No menu bar configured\"",
")",
"return",
"self",
".",
"menubar",
".",
"get_menu",
"(",
"name",
")"
] | Get the menu with name `name` from the global menu bar.
Returns a menu widget. | [
"Get",
"the",
"menu",
"with",
"name",
"name",
"from",
"the",
"global",
"menu",
"bar",
".",
"Returns",
"a",
"menu",
"widget",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L1758-L1764 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.register_viewer | def register_viewer(self, vclass):
"""Register a channel viewer with the reference viewer.
`vclass` is the class of the viewer.
"""
self.viewer_db[vclass.vname] = Bunch.Bunch(vname=vclass.vname,
vclass=vclass,
... | python | def register_viewer(self, vclass):
"""Register a channel viewer with the reference viewer.
`vclass` is the class of the viewer.
"""
self.viewer_db[vclass.vname] = Bunch.Bunch(vname=vclass.vname,
vclass=vclass,
... | [
"def",
"register_viewer",
"(",
"self",
",",
"vclass",
")",
":",
"self",
".",
"viewer_db",
"[",
"vclass",
".",
"vname",
"]",
"=",
"Bunch",
".",
"Bunch",
"(",
"vname",
"=",
"vclass",
".",
"vname",
",",
"vclass",
"=",
"vclass",
",",
"vtypes",
"=",
"vcla... | Register a channel viewer with the reference viewer.
`vclass` is the class of the viewer. | [
"Register",
"a",
"channel",
"viewer",
"with",
"the",
"reference",
"viewer",
".",
"vclass",
"is",
"the",
"class",
"of",
"the",
"viewer",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L1848-L1854 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.get_viewer_names | def get_viewer_names(self, dataobj):
"""Returns a list of viewer names that are registered that
can view `dataobj`.
"""
res = []
for bnch in self.viewer_db.values():
for vtype in bnch.vtypes:
if isinstance(dataobj, vtype):
res.appen... | python | def get_viewer_names(self, dataobj):
"""Returns a list of viewer names that are registered that
can view `dataobj`.
"""
res = []
for bnch in self.viewer_db.values():
for vtype in bnch.vtypes:
if isinstance(dataobj, vtype):
res.appen... | [
"def",
"get_viewer_names",
"(",
"self",
",",
"dataobj",
")",
":",
"res",
"=",
"[",
"]",
"for",
"bnch",
"in",
"self",
".",
"viewer_db",
".",
"values",
"(",
")",
":",
"for",
"vtype",
"in",
"bnch",
".",
"vtypes",
":",
"if",
"isinstance",
"(",
"dataobj",... | Returns a list of viewer names that are registered that
can view `dataobj`. | [
"Returns",
"a",
"list",
"of",
"viewer",
"names",
"that",
"are",
"registered",
"that",
"can",
"view",
"dataobj",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L1856-L1865 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.make_viewer | def make_viewer(self, vname, channel):
"""Make a viewer whose type name is `vname` and add it to `channel`.
"""
if vname not in self.viewer_db:
raise ValueError("I don't know how to build a '%s' viewer" % (
vname))
stk_w = channel.widget
bnch = self.... | python | def make_viewer(self, vname, channel):
"""Make a viewer whose type name is `vname` and add it to `channel`.
"""
if vname not in self.viewer_db:
raise ValueError("I don't know how to build a '%s' viewer" % (
vname))
stk_w = channel.widget
bnch = self.... | [
"def",
"make_viewer",
"(",
"self",
",",
"vname",
",",
"channel",
")",
":",
"if",
"vname",
"not",
"in",
"self",
".",
"viewer_db",
":",
"raise",
"ValueError",
"(",
"\"I don't know how to build a '%s' viewer\"",
"%",
"(",
"vname",
")",
")",
"stk_w",
"=",
"chann... | Make a viewer whose type name is `vname` and add it to `channel`. | [
"Make",
"a",
"viewer",
"whose",
"type",
"name",
"is",
"vname",
"and",
"add",
"it",
"to",
"channel",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L1867-L1889 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.collapse_pane | def collapse_pane(self, side):
"""
Toggle collapsing the left or right panes.
"""
# TODO: this is too tied to one configuration, need to figure
# out how to generalize this
hsplit = self.w['hpnl']
sizes = hsplit.get_sizes()
lsize, msize, rsize = sizes
... | python | def collapse_pane(self, side):
"""
Toggle collapsing the left or right panes.
"""
# TODO: this is too tied to one configuration, need to figure
# out how to generalize this
hsplit = self.w['hpnl']
sizes = hsplit.get_sizes()
lsize, msize, rsize = sizes
... | [
"def",
"collapse_pane",
"(",
"self",
",",
"side",
")",
":",
"hsplit",
"=",
"self",
".",
"w",
"[",
"'hpnl'",
"]",
"sizes",
"=",
"hsplit",
".",
"get_sizes",
"(",
")",
"lsize",
",",
"msize",
",",
"rsize",
"=",
"sizes",
"if",
"self",
".",
"_lsize",
"is... | Toggle collapsing the left or right panes. | [
"Toggle",
"collapsing",
"the",
"left",
"or",
"right",
"panes",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L2214-L2247 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.quit | def quit(self, *args):
"""Quit the application.
"""
self.logger.info("Attempting to shut down the application...")
if self.layout_file is not None:
self.error_wrap(self.ds.write_layout_conf, self.layout_file)
self.stop()
self.w.root = None
while len(... | python | def quit(self, *args):
"""Quit the application.
"""
self.logger.info("Attempting to shut down the application...")
if self.layout_file is not None:
self.error_wrap(self.ds.write_layout_conf, self.layout_file)
self.stop()
self.w.root = None
while len(... | [
"def",
"quit",
"(",
"self",
",",
"*",
"args",
")",
":",
"self",
".",
"logger",
".",
"info",
"(",
"\"Attempting to shut down the application...\"",
")",
"if",
"self",
".",
"layout_file",
"is",
"not",
"None",
":",
"self",
".",
"error_wrap",
"(",
"self",
".",... | Quit the application. | [
"Quit",
"the",
"application",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L2266-L2278 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.showxy | def showxy(self, viewer, data_x, data_y):
"""Called by the mouse-tracking callback to handle reporting of
cursor position to various plugins that subscribe to the
'field-info' callback.
"""
# This is an optimization to get around slow coordinate
# transformation by astrop... | python | def showxy(self, viewer, data_x, data_y):
"""Called by the mouse-tracking callback to handle reporting of
cursor position to various plugins that subscribe to the
'field-info' callback.
"""
# This is an optimization to get around slow coordinate
# transformation by astrop... | [
"def",
"showxy",
"(",
"self",
",",
"viewer",
",",
"data_x",
",",
"data_y",
")",
":",
"cur_time",
"=",
"time",
".",
"time",
"(",
")",
"elapsed",
"=",
"cur_time",
"-",
"self",
".",
"_cursor_last_update",
"if",
"elapsed",
">",
"self",
".",
"cursor_interval"... | Called by the mouse-tracking callback to handle reporting of
cursor position to various plugins that subscribe to the
'field-info' callback. | [
"Called",
"by",
"the",
"mouse",
"-",
"tracking",
"callback",
"to",
"handle",
"reporting",
"of",
"cursor",
"position",
"to",
"various",
"plugins",
"that",
"subscribe",
"to",
"the",
"field",
"-",
"info",
"callback",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L2539-L2568 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell._cursor_timer_cb | def _cursor_timer_cb(self, timer):
"""Callback when the cursor timer expires.
"""
data = timer.data
self.gui_do_oneshot('field-info', self._showxy,
data.viewer, data.data_x, data.data_y) | python | def _cursor_timer_cb(self, timer):
"""Callback when the cursor timer expires.
"""
data = timer.data
self.gui_do_oneshot('field-info', self._showxy,
data.viewer, data.data_x, data.data_y) | [
"def",
"_cursor_timer_cb",
"(",
"self",
",",
"timer",
")",
":",
"data",
"=",
"timer",
".",
"data",
"self",
".",
"gui_do_oneshot",
"(",
"'field-info'",
",",
"self",
".",
"_showxy",
",",
"data",
".",
"viewer",
",",
"data",
".",
"data_x",
",",
"data",
"."... | Callback when the cursor timer expires. | [
"Callback",
"when",
"the",
"cursor",
"timer",
"expires",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L2570-L2575 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell._showxy | def _showxy(self, viewer, data_x, data_y):
"""Update the info from the last position recorded under the cursor.
"""
self._cursor_last_update = time.time()
try:
image = viewer.get_image()
if (image is None) or not isinstance(image, BaseImage.BaseImage):
... | python | def _showxy(self, viewer, data_x, data_y):
"""Update the info from the last position recorded under the cursor.
"""
self._cursor_last_update = time.time()
try:
image = viewer.get_image()
if (image is None) or not isinstance(image, BaseImage.BaseImage):
... | [
"def",
"_showxy",
"(",
"self",
",",
"viewer",
",",
"data_x",
",",
"data_y",
")",
":",
"self",
".",
"_cursor_last_update",
"=",
"time",
".",
"time",
"(",
")",
"try",
":",
"image",
"=",
"viewer",
".",
"get_image",
"(",
")",
"if",
"(",
"image",
"is",
... | Update the info from the last position recorded under the cursor. | [
"Update",
"the",
"info",
"from",
"the",
"last",
"position",
"recorded",
"under",
"the",
"cursor",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L2577-L2607 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.motion_cb | def motion_cb(self, viewer, button, data_x, data_y):
"""Motion event in the channel viewer window. Show the pointing
information under the cursor.
"""
self.showxy(viewer, data_x, data_y)
return True | python | def motion_cb(self, viewer, button, data_x, data_y):
"""Motion event in the channel viewer window. Show the pointing
information under the cursor.
"""
self.showxy(viewer, data_x, data_y)
return True | [
"def",
"motion_cb",
"(",
"self",
",",
"viewer",
",",
"button",
",",
"data_x",
",",
"data_y",
")",
":",
"self",
".",
"showxy",
"(",
"viewer",
",",
"data_x",
",",
"data_y",
")",
"return",
"True"
] | Motion event in the channel viewer window. Show the pointing
information under the cursor. | [
"Motion",
"event",
"in",
"the",
"channel",
"viewer",
"window",
".",
"Show",
"the",
"pointing",
"information",
"under",
"the",
"cursor",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L2609-L2614 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.keypress | def keypress(self, viewer, event, data_x, data_y):
"""Key press event in a channel window."""
keyname = event.key
chname = self.get_channel_name(viewer)
self.logger.debug("key press (%s) in channel %s" % (
keyname, chname))
# TODO: keyboard accelerators to raise tabs ... | python | def keypress(self, viewer, event, data_x, data_y):
"""Key press event in a channel window."""
keyname = event.key
chname = self.get_channel_name(viewer)
self.logger.debug("key press (%s) in channel %s" % (
keyname, chname))
# TODO: keyboard accelerators to raise tabs ... | [
"def",
"keypress",
"(",
"self",
",",
"viewer",
",",
"event",
",",
"data_x",
",",
"data_y",
")",
":",
"keyname",
"=",
"event",
".",
"key",
"chname",
"=",
"self",
".",
"get_channel_name",
"(",
"viewer",
")",
"self",
".",
"logger",
".",
"debug",
"(",
"\... | Key press event in a channel window. | [
"Key",
"press",
"event",
"in",
"a",
"channel",
"window",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L2616-L2666 | train |
ejeschke/ginga | ginga/rv/Control.py | GingaShell.show_channel_names | def show_channel_names(self):
"""Show each channel's name in its image viewer.
Useful in 'grid' or 'stack' workspace type to identify which window
is which.
"""
for name in self.get_channel_names():
channel = self.get_channel(name)
channel.fitsimage.onscre... | python | def show_channel_names(self):
"""Show each channel's name in its image viewer.
Useful in 'grid' or 'stack' workspace type to identify which window
is which.
"""
for name in self.get_channel_names():
channel = self.get_channel(name)
channel.fitsimage.onscre... | [
"def",
"show_channel_names",
"(",
"self",
")",
":",
"for",
"name",
"in",
"self",
".",
"get_channel_names",
"(",
")",
":",
"channel",
"=",
"self",
".",
"get_channel",
"(",
"name",
")",
"channel",
".",
"fitsimage",
".",
"onscreen_message",
"(",
"name",
",",
... | Show each channel's name in its image viewer.
Useful in 'grid' or 'stack' workspace type to identify which window
is which. | [
"Show",
"each",
"channel",
"s",
"name",
"in",
"its",
"image",
"viewer",
".",
"Useful",
"in",
"grid",
"or",
"stack",
"workspace",
"type",
"to",
"identify",
"which",
"window",
"is",
"which",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L2703-L2710 | train |
ejeschke/ginga | ginga/rv/plugins/TVMark.py | TVMark._short_color_list | def _short_color_list(self):
"""Color list is too long. Discard variations with numbers."""
return [c for c in colors.get_colors() if not re.search(r'\d', c)] | python | def _short_color_list(self):
"""Color list is too long. Discard variations with numbers."""
return [c for c in colors.get_colors() if not re.search(r'\d', c)] | [
"def",
"_short_color_list",
"(",
"self",
")",
":",
"return",
"[",
"c",
"for",
"c",
"in",
"colors",
".",
"get_colors",
"(",
")",
"if",
"not",
"re",
".",
"search",
"(",
"r'\\d'",
",",
"c",
")",
"]"
] | Color list is too long. Discard variations with numbers. | [
"Color",
"list",
"is",
"too",
"long",
".",
"Discard",
"variations",
"with",
"numbers",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/TVMark.py#L165-L167 | train |
ejeschke/ginga | ginga/rv/plugins/TVMark.py | TVMark._get_markobj | def _get_markobj(self, x, y, marktype, marksize, markcolor, markwidth):
"""Generate canvas object for given mark parameters."""
if marktype == 'circle':
obj = self.dc.Circle(
x=x, y=y, radius=marksize, color=markcolor, linewidth=markwidth)
elif marktype in ('cross', '... | python | def _get_markobj(self, x, y, marktype, marksize, markcolor, markwidth):
"""Generate canvas object for given mark parameters."""
if marktype == 'circle':
obj = self.dc.Circle(
x=x, y=y, radius=marksize, color=markcolor, linewidth=markwidth)
elif marktype in ('cross', '... | [
"def",
"_get_markobj",
"(",
"self",
",",
"x",
",",
"y",
",",
"marktype",
",",
"marksize",
",",
"markcolor",
",",
"markwidth",
")",
":",
"if",
"marktype",
"==",
"'circle'",
":",
"obj",
"=",
"self",
".",
"dc",
".",
"Circle",
"(",
"x",
"=",
"x",
",",
... | Generate canvas object for given mark parameters. | [
"Generate",
"canvas",
"object",
"for",
"given",
"mark",
"parameters",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/TVMark.py#L393-L411 | train |
ejeschke/ginga | ginga/rv/plugins/TVMark.py | TVMark.clear_marking | def clear_marking(self):
"""Clear marking from image.
This does not clear loaded coordinates from memory."""
if self.marktag:
try:
self.canvas.delete_object_by_tag(self.marktag, redraw=False)
except Exception:
pass
if self.markhlta... | python | def clear_marking(self):
"""Clear marking from image.
This does not clear loaded coordinates from memory."""
if self.marktag:
try:
self.canvas.delete_object_by_tag(self.marktag, redraw=False)
except Exception:
pass
if self.markhlta... | [
"def",
"clear_marking",
"(",
"self",
")",
":",
"if",
"self",
".",
"marktag",
":",
"try",
":",
"self",
".",
"canvas",
".",
"delete_object_by_tag",
"(",
"self",
".",
"marktag",
",",
"redraw",
"=",
"False",
")",
"except",
"Exception",
":",
"pass",
"if",
"... | Clear marking from image.
This does not clear loaded coordinates from memory. | [
"Clear",
"marking",
"from",
"image",
".",
"This",
"does",
"not",
"clear",
"loaded",
"coordinates",
"from",
"memory",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/TVMark.py#L413-L430 | train |
ejeschke/ginga | ginga/rv/plugins/TVMark.py | TVMark.load_file | def load_file(self, filename):
"""Load coordinates file.
Results are appended to previously loaded coordinates.
This can be used to load one file per color.
"""
if not os.path.isfile(filename):
return
self.logger.info('Loading coordinates from {0}'.format(f... | python | def load_file(self, filename):
"""Load coordinates file.
Results are appended to previously loaded coordinates.
This can be used to load one file per color.
"""
if not os.path.isfile(filename):
return
self.logger.info('Loading coordinates from {0}'.format(f... | [
"def",
"load_file",
"(",
"self",
",",
"filename",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"filename",
")",
":",
"return",
"self",
".",
"logger",
".",
"info",
"(",
"'Loading coordinates from {0}'",
".",
"format",
"(",
"filename",
")"... | Load coordinates file.
Results are appended to previously loaded coordinates.
This can be used to load one file per color. | [
"Load",
"coordinates",
"file",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/TVMark.py#L439-L514 | train |
ejeschke/ginga | ginga/rv/plugins/TVMark.py | TVMark._convert_radec | def _convert_radec(self, val):
"""Convert RA or DEC table column to degrees and extract data.
Assume already in degrees if cannot convert.
"""
try:
ans = val.to('deg')
except Exception as e:
self.logger.error('Cannot convert, assume already in degrees')
... | python | def _convert_radec(self, val):
"""Convert RA or DEC table column to degrees and extract data.
Assume already in degrees if cannot convert.
"""
try:
ans = val.to('deg')
except Exception as e:
self.logger.error('Cannot convert, assume already in degrees')
... | [
"def",
"_convert_radec",
"(",
"self",
",",
"val",
")",
":",
"try",
":",
"ans",
"=",
"val",
".",
"to",
"(",
"'deg'",
")",
"except",
"Exception",
"as",
"e",
":",
"self",
".",
"logger",
".",
"error",
"(",
"'Cannot convert, assume already in degrees'",
")",
... | Convert RA or DEC table column to degrees and extract data.
Assume already in degrees if cannot convert. | [
"Convert",
"RA",
"or",
"DEC",
"table",
"column",
"to",
"degrees",
"and",
"extract",
"data",
".",
"Assume",
"already",
"in",
"degrees",
"if",
"cannot",
"convert",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/TVMark.py#L526-L539 | train |
ejeschke/ginga | ginga/rv/plugins/TVMark.py | TVMark.hl_table2canvas | def hl_table2canvas(self, w, res_dict):
"""Highlight marking on canvas when user click on table."""
objlist = []
width = self.markwidth + self._dwidth
# Remove existing highlight
if self.markhltag:
try:
self.canvas.delete_object_by_tag(self.markhltag,... | python | def hl_table2canvas(self, w, res_dict):
"""Highlight marking on canvas when user click on table."""
objlist = []
width = self.markwidth + self._dwidth
# Remove existing highlight
if self.markhltag:
try:
self.canvas.delete_object_by_tag(self.markhltag,... | [
"def",
"hl_table2canvas",
"(",
"self",
",",
"w",
",",
"res_dict",
")",
":",
"objlist",
"=",
"[",
"]",
"width",
"=",
"self",
".",
"markwidth",
"+",
"self",
".",
"_dwidth",
"if",
"self",
".",
"markhltag",
":",
"try",
":",
"self",
".",
"canvas",
".",
... | Highlight marking on canvas when user click on table. | [
"Highlight",
"marking",
"on",
"canvas",
"when",
"user",
"click",
"on",
"table",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/TVMark.py#L562-L596 | train |
ejeschke/ginga | ginga/rv/plugins/TVMark.py | TVMark.hl_canvas2table_box | def hl_canvas2table_box(self, canvas, tag):
"""Highlight all markings inside user drawn box on table."""
self.treeview.clear_selection()
# Remove existing box
cobj = canvas.get_object_by_tag(tag)
if cobj.kind != 'rectangle':
return
canvas.delete_object_by_tag... | python | def hl_canvas2table_box(self, canvas, tag):
"""Highlight all markings inside user drawn box on table."""
self.treeview.clear_selection()
# Remove existing box
cobj = canvas.get_object_by_tag(tag)
if cobj.kind != 'rectangle':
return
canvas.delete_object_by_tag... | [
"def",
"hl_canvas2table_box",
"(",
"self",
",",
"canvas",
",",
"tag",
")",
":",
"self",
".",
"treeview",
".",
"clear_selection",
"(",
")",
"cobj",
"=",
"canvas",
".",
"get_object_by_tag",
"(",
"tag",
")",
"if",
"cobj",
".",
"kind",
"!=",
"'rectangle'",
"... | Highlight all markings inside user drawn box on table. | [
"Highlight",
"all",
"markings",
"inside",
"user",
"drawn",
"box",
"on",
"table",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/TVMark.py#L598-L633 | train |
ejeschke/ginga | ginga/rv/plugins/TVMark.py | TVMark.hl_canvas2table | def hl_canvas2table(self, canvas, button, data_x, data_y):
"""Highlight marking on table when user click on canvas."""
self.treeview.clear_selection()
# Remove existing highlight
if self.markhltag:
try:
canvas.delete_object_by_tag(self.markhltag, redraw=True)... | python | def hl_canvas2table(self, canvas, button, data_x, data_y):
"""Highlight marking on table when user click on canvas."""
self.treeview.clear_selection()
# Remove existing highlight
if self.markhltag:
try:
canvas.delete_object_by_tag(self.markhltag, redraw=True)... | [
"def",
"hl_canvas2table",
"(",
"self",
",",
"canvas",
",",
"button",
",",
"data_x",
",",
"data_y",
")",
":",
"self",
".",
"treeview",
".",
"clear_selection",
"(",
")",
"if",
"self",
".",
"markhltag",
":",
"try",
":",
"canvas",
".",
"delete_object_by_tag",
... | Highlight marking on table when user click on canvas. | [
"Highlight",
"marking",
"on",
"table",
"when",
"user",
"click",
"on",
"canvas",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/TVMark.py#L636-L668 | train |
ejeschke/ginga | ginga/rv/plugins/TVMark.py | TVMark._highlight_path | def _highlight_path(self, hlpath):
"""Highlight an entry in the table and associated marking."""
self.logger.debug('Highlighting {0}'.format(hlpath))
self.treeview.select_path(hlpath)
# TODO: Does not work in Qt. This is known issue in Ginga.
self.treeview.scroll_to_path(hlpath) | python | def _highlight_path(self, hlpath):
"""Highlight an entry in the table and associated marking."""
self.logger.debug('Highlighting {0}'.format(hlpath))
self.treeview.select_path(hlpath)
# TODO: Does not work in Qt. This is known issue in Ginga.
self.treeview.scroll_to_path(hlpath) | [
"def",
"_highlight_path",
"(",
"self",
",",
"hlpath",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"'Highlighting {0}'",
".",
"format",
"(",
"hlpath",
")",
")",
"self",
".",
"treeview",
".",
"select_path",
"(",
"hlpath",
")",
"self",
".",
"treevie... | Highlight an entry in the table and associated marking. | [
"Highlight",
"an",
"entry",
"in",
"the",
"table",
"and",
"associated",
"marking",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/TVMark.py#L670-L676 | train |
ejeschke/ginga | ginga/rv/plugins/TVMark.py | TVMark.set_marktype_cb | def set_marktype_cb(self, w, index):
"""Set type of marking."""
self.marktype = self._mark_options[index]
# Mark size is not used for point
if self.marktype != 'point':
self.w.mark_size.set_enabled(True)
else:
self.w.mark_size.set_enabled(False) | python | def set_marktype_cb(self, w, index):
"""Set type of marking."""
self.marktype = self._mark_options[index]
# Mark size is not used for point
if self.marktype != 'point':
self.w.mark_size.set_enabled(True)
else:
self.w.mark_size.set_enabled(False) | [
"def",
"set_marktype_cb",
"(",
"self",
",",
"w",
",",
"index",
")",
":",
"self",
".",
"marktype",
"=",
"self",
".",
"_mark_options",
"[",
"index",
"]",
"if",
"self",
".",
"marktype",
"!=",
"'point'",
":",
"self",
".",
"w",
".",
"mark_size",
".",
"set... | Set type of marking. | [
"Set",
"type",
"of",
"marking",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/TVMark.py#L678-L686 | train |
ejeschke/ginga | ginga/rv/plugins/TVMark.py | TVMark.set_markwidth | def set_markwidth(self):
"""Set width of marking."""
try:
sz = int(self.w.mark_width.get_text())
except ValueError:
self.logger.error('Cannot set mark width')
self.w.mark_width.set_text(str(self.markwidth))
else:
self.markwidth = sz | python | def set_markwidth(self):
"""Set width of marking."""
try:
sz = int(self.w.mark_width.get_text())
except ValueError:
self.logger.error('Cannot set mark width')
self.w.mark_width.set_text(str(self.markwidth))
else:
self.markwidth = sz | [
"def",
"set_markwidth",
"(",
"self",
")",
":",
"try",
":",
"sz",
"=",
"int",
"(",
"self",
".",
"w",
".",
"mark_width",
".",
"get_text",
"(",
")",
")",
"except",
"ValueError",
":",
"self",
".",
"logger",
".",
"error",
"(",
"'Cannot set mark width'",
")"... | Set width of marking. | [
"Set",
"width",
"of",
"marking",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/TVMark.py#L702-L710 | train |
ejeschke/ginga | ginga/rv/plugins/Header.py | Header.redo | def redo(self, channel, image):
"""This is called when image changes."""
self._image = None # Skip cache checking in set_header()
info = channel.extdata._header_info
self.set_header(info, image) | python | def redo(self, channel, image):
"""This is called when image changes."""
self._image = None # Skip cache checking in set_header()
info = channel.extdata._header_info
self.set_header(info, image) | [
"def",
"redo",
"(",
"self",
",",
"channel",
",",
"image",
")",
":",
"self",
".",
"_image",
"=",
"None",
"info",
"=",
"channel",
".",
"extdata",
".",
"_header_info",
"self",
".",
"set_header",
"(",
"info",
",",
"image",
")"
] | This is called when image changes. | [
"This",
"is",
"called",
"when",
"image",
"changes",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/Header.py#L225-L230 | train |
ejeschke/ginga | ginga/rv/plugins/Header.py | Header.blank | def blank(self, channel):
"""This is called when image is cleared."""
self._image = None
info = channel.extdata._header_info
info.table.clear() | python | def blank(self, channel):
"""This is called when image is cleared."""
self._image = None
info = channel.extdata._header_info
info.table.clear() | [
"def",
"blank",
"(",
"self",
",",
"channel",
")",
":",
"self",
".",
"_image",
"=",
"None",
"info",
"=",
"channel",
".",
"extdata",
".",
"_header_info",
"info",
".",
"table",
".",
"clear",
"(",
")"
] | This is called when image is cleared. | [
"This",
"is",
"called",
"when",
"image",
"is",
"cleared",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/Header.py#L232-L236 | train |
ejeschke/ginga | ginga/examples/gw/clocks.py | Clock.clock_resized_cb | def clock_resized_cb(self, viewer, width, height):
"""This method is called when an individual clock is resized.
It deletes and reconstructs the placement of the text objects
in the canvas.
"""
self.logger.info("resized canvas to %dx%d" % (width, height))
# add text objec... | python | def clock_resized_cb(self, viewer, width, height):
"""This method is called when an individual clock is resized.
It deletes and reconstructs the placement of the text objects
in the canvas.
"""
self.logger.info("resized canvas to %dx%d" % (width, height))
# add text objec... | [
"def",
"clock_resized_cb",
"(",
"self",
",",
"viewer",
",",
"width",
",",
"height",
")",
":",
"self",
".",
"logger",
".",
"info",
"(",
"\"resized canvas to %dx%d\"",
"%",
"(",
"width",
",",
"height",
")",
")",
"self",
".",
"canvas",
".",
"delete_all_object... | This method is called when an individual clock is resized.
It deletes and reconstructs the placement of the text objects
in the canvas. | [
"This",
"method",
"is",
"called",
"when",
"an",
"individual",
"clock",
"is",
"resized",
".",
"It",
"deletes",
"and",
"reconstructs",
"the",
"placement",
"of",
"the",
"text",
"objects",
"in",
"the",
"canvas",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/examples/gw/clocks.py#L82-L106 | train |
ejeschke/ginga | ginga/examples/gw/clocks.py | Clock.update_clock | def update_clock(self, dt):
"""This method is called by the ClockApp whenever the timer fires
to update the clock. `dt` is a timezone-aware datetime object.
"""
dt = dt.astimezone(self.tzinfo)
fmt = "%H:%M"
if self.show_seconds:
fmt = "%H:%M:%S"
self... | python | def update_clock(self, dt):
"""This method is called by the ClockApp whenever the timer fires
to update the clock. `dt` is a timezone-aware datetime object.
"""
dt = dt.astimezone(self.tzinfo)
fmt = "%H:%M"
if self.show_seconds:
fmt = "%H:%M:%S"
self... | [
"def",
"update_clock",
"(",
"self",
",",
"dt",
")",
":",
"dt",
"=",
"dt",
".",
"astimezone",
"(",
"self",
".",
"tzinfo",
")",
"fmt",
"=",
"\"%H:%M\"",
"if",
"self",
".",
"show_seconds",
":",
"fmt",
"=",
"\"%H:%M:%S\"",
"self",
".",
"time_txt",
".",
"... | This method is called by the ClockApp whenever the timer fires
to update the clock. `dt` is a timezone-aware datetime object. | [
"This",
"method",
"is",
"called",
"by",
"the",
"ClockApp",
"whenever",
"the",
"timer",
"fires",
"to",
"update",
"the",
"clock",
".",
"dt",
"is",
"a",
"timezone",
"-",
"aware",
"datetime",
"object",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/examples/gw/clocks.py#L108-L122 | train |
ejeschke/ginga | ginga/examples/gw/clocks.py | ClockApp.add_clock | def add_clock(self, timezone, color='lightgreen', show_seconds=None):
"""Add a clock to the grid. `timezone` is a string representing
a valid timezone.
"""
if show_seconds is None:
show_seconds = self.options.show_seconds
clock = Clock(self.app, self.logger, timezon... | python | def add_clock(self, timezone, color='lightgreen', show_seconds=None):
"""Add a clock to the grid. `timezone` is a string representing
a valid timezone.
"""
if show_seconds is None:
show_seconds = self.options.show_seconds
clock = Clock(self.app, self.logger, timezon... | [
"def",
"add_clock",
"(",
"self",
",",
"timezone",
",",
"color",
"=",
"'lightgreen'",
",",
"show_seconds",
"=",
"None",
")",
":",
"if",
"show_seconds",
"is",
"None",
":",
"show_seconds",
"=",
"self",
".",
"options",
".",
"show_seconds",
"clock",
"=",
"Clock... | Add a clock to the grid. `timezone` is a string representing
a valid timezone. | [
"Add",
"a",
"clock",
"to",
"the",
"grid",
".",
"timezone",
"is",
"a",
"string",
"representing",
"a",
"valid",
"timezone",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/examples/gw/clocks.py#L232-L249 | train |
ejeschke/ginga | ginga/examples/gw/clocks.py | ClockApp.timer_cb | def timer_cb(self, timer):
"""Timer callback. Update all our clocks."""
dt_now = datetime.utcnow().replace(tzinfo=pytz.utc)
self.logger.debug("timer fired. utc time is '%s'" % (str(dt_now)))
for clock in self.clocks.values():
clock.update_clock(dt_now)
# update clo... | python | def timer_cb(self, timer):
"""Timer callback. Update all our clocks."""
dt_now = datetime.utcnow().replace(tzinfo=pytz.utc)
self.logger.debug("timer fired. utc time is '%s'" % (str(dt_now)))
for clock in self.clocks.values():
clock.update_clock(dt_now)
# update clo... | [
"def",
"timer_cb",
"(",
"self",
",",
"timer",
")",
":",
"dt_now",
"=",
"datetime",
".",
"utcnow",
"(",
")",
".",
"replace",
"(",
"tzinfo",
"=",
"pytz",
".",
"utc",
")",
"self",
".",
"logger",
".",
"debug",
"(",
"\"timer fired. utc time is '%s'\"",
"%",
... | Timer callback. Update all our clocks. | [
"Timer",
"callback",
".",
"Update",
"all",
"our",
"clocks",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/examples/gw/clocks.py#L251-L260 | train |
ejeschke/ginga | ginga/table/TableView.py | TableViewGw.set_table_cb | def set_table_cb(self, viewer, table):
"""Display the given table object."""
self.clear()
tree_dict = OrderedDict()
# Extract data as astropy table
a_tab = table.get_data()
# Fill masked values, if applicable
try:
a_tab = a_tab.filled()
excep... | python | def set_table_cb(self, viewer, table):
"""Display the given table object."""
self.clear()
tree_dict = OrderedDict()
# Extract data as astropy table
a_tab = table.get_data()
# Fill masked values, if applicable
try:
a_tab = a_tab.filled()
excep... | [
"def",
"set_table_cb",
"(",
"self",
",",
"viewer",
",",
"table",
")",
":",
"self",
".",
"clear",
"(",
")",
"tree_dict",
"=",
"OrderedDict",
"(",
")",
"a_tab",
"=",
"table",
".",
"get_data",
"(",
")",
"try",
":",
"a_tab",
"=",
"a_tab",
".",
"filled",
... | Display the given table object. | [
"Display",
"the",
"given",
"table",
"object",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/table/TableView.py#L118-L159 | train |
ejeschke/ginga | ginga/rv/plugins/ChangeHistory.py | ChangeHistory.build_gui | def build_gui(self, container):
"""This method is called when the plugin is invoked. It builds the
GUI used by the plugin into the widget layout passed as
``container``.
This method could be called several times if the plugin is opened
and closed.
"""
vbox, sw,... | python | def build_gui(self, container):
"""This method is called when the plugin is invoked. It builds the
GUI used by the plugin into the widget layout passed as
``container``.
This method could be called several times if the plugin is opened
and closed.
"""
vbox, sw,... | [
"def",
"build_gui",
"(",
"self",
",",
"container",
")",
":",
"vbox",
",",
"sw",
",",
"self",
".",
"orientation",
"=",
"Widgets",
".",
"get_oriented_box",
"(",
"container",
")",
"vbox",
".",
"set_border_width",
"(",
"4",
")",
"vbox",
".",
"set_spacing",
"... | This method is called when the plugin is invoked. It builds the
GUI used by the plugin into the widget layout passed as
``container``.
This method could be called several times if the plugin is opened
and closed. | [
"This",
"method",
"is",
"called",
"when",
"the",
"plugin",
"is",
"invoked",
".",
"It",
"builds",
"the",
"GUI",
"used",
"by",
"the",
"plugin",
"into",
"the",
"widget",
"layout",
"passed",
"as",
"container",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/ChangeHistory.py#L75-L149 | train |
ejeschke/ginga | ginga/rv/plugins/ChangeHistory.py | ChangeHistory.redo | def redo(self, channel, image):
"""Add an entry with image modification info."""
chname = channel.name
if image is None:
# shouldn't happen, but let's play it safe
return
imname = image.get('name', 'none')
iminfo = channel.get_image_info(imname)
t... | python | def redo(self, channel, image):
"""Add an entry with image modification info."""
chname = channel.name
if image is None:
# shouldn't happen, but let's play it safe
return
imname = image.get('name', 'none')
iminfo = channel.get_image_info(imname)
t... | [
"def",
"redo",
"(",
"self",
",",
"channel",
",",
"image",
")",
":",
"chname",
"=",
"channel",
".",
"name",
"if",
"image",
"is",
"None",
":",
"return",
"imname",
"=",
"image",
".",
"get",
"(",
"'name'",
",",
"'none'",
")",
"iminfo",
"=",
"channel",
... | Add an entry with image modification info. | [
"Add",
"an",
"entry",
"with",
"image",
"modification",
"info",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/ChangeHistory.py#L181-L207 | train |
ejeschke/ginga | ginga/rv/plugins/ChangeHistory.py | ChangeHistory.remove_image_info_cb | def remove_image_info_cb(self, gshell, channel, iminfo):
"""Delete entries related to deleted image."""
chname = channel.name
if chname not in self.name_dict:
return
fileDict = self.name_dict[chname]
name = iminfo.name
if name not in fileDict:
re... | python | def remove_image_info_cb(self, gshell, channel, iminfo):
"""Delete entries related to deleted image."""
chname = channel.name
if chname not in self.name_dict:
return
fileDict = self.name_dict[chname]
name = iminfo.name
if name not in fileDict:
re... | [
"def",
"remove_image_info_cb",
"(",
"self",
",",
"gshell",
",",
"channel",
",",
"iminfo",
")",
":",
"chname",
"=",
"channel",
".",
"name",
"if",
"chname",
"not",
"in",
"self",
".",
"name_dict",
":",
"return",
"fileDict",
"=",
"self",
".",
"name_dict",
"[... | Delete entries related to deleted image. | [
"Delete",
"entries",
"related",
"to",
"deleted",
"image",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/ChangeHistory.py#L238-L257 | train |
ejeschke/ginga | ginga/rv/plugins/ChangeHistory.py | ChangeHistory.add_image_info_cb | def add_image_info_cb(self, gshell, channel, iminfo):
"""Add entries related to an added image."""
timestamp = iminfo.time_modified
if timestamp is None:
# Not an image we are interested in tracking
return
self.add_entry(channel.name, iminfo) | python | def add_image_info_cb(self, gshell, channel, iminfo):
"""Add entries related to an added image."""
timestamp = iminfo.time_modified
if timestamp is None:
# Not an image we are interested in tracking
return
self.add_entry(channel.name, iminfo) | [
"def",
"add_image_info_cb",
"(",
"self",
",",
"gshell",
",",
"channel",
",",
"iminfo",
")",
":",
"timestamp",
"=",
"iminfo",
".",
"time_modified",
"if",
"timestamp",
"is",
"None",
":",
"return",
"self",
".",
"add_entry",
"(",
"channel",
".",
"name",
",",
... | Add entries related to an added image. | [
"Add",
"entries",
"related",
"to",
"an",
"added",
"image",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/ChangeHistory.py#L259-L267 | train |
ejeschke/ginga | ginga/rv/plugins/Thumbs.py | Thumbs.drag_drop_cb | def drag_drop_cb(self, viewer, urls):
"""Punt drag-drops to the ginga shell.
"""
channel = self.fv.get_current_channel()
if channel is None:
return
self.fv.open_uris(urls, chname=channel.name, bulk_add=True)
return True | python | def drag_drop_cb(self, viewer, urls):
"""Punt drag-drops to the ginga shell.
"""
channel = self.fv.get_current_channel()
if channel is None:
return
self.fv.open_uris(urls, chname=channel.name, bulk_add=True)
return True | [
"def",
"drag_drop_cb",
"(",
"self",
",",
"viewer",
",",
"urls",
")",
":",
"channel",
"=",
"self",
".",
"fv",
".",
"get_current_channel",
"(",
")",
"if",
"channel",
"is",
"None",
":",
"return",
"self",
".",
"fv",
".",
"open_uris",
"(",
"urls",
",",
"c... | Punt drag-drops to the ginga shell. | [
"Punt",
"drag",
"-",
"drops",
"to",
"the",
"ginga",
"shell",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/Thumbs.py#L223-L230 | train |
ejeschke/ginga | ginga/rv/plugins/Thumbs.py | Thumbs.update_highlights | def update_highlights(self, old_highlight_set, new_highlight_set):
"""Unhighlight the thumbnails represented by `old_highlight_set`
and highlight the ones represented by new_highlight_set.
Both are sets of thumbkeys.
"""
with self.thmblock:
un_hilite_set = old_highl... | python | def update_highlights(self, old_highlight_set, new_highlight_set):
"""Unhighlight the thumbnails represented by `old_highlight_set`
and highlight the ones represented by new_highlight_set.
Both are sets of thumbkeys.
"""
with self.thmblock:
un_hilite_set = old_highl... | [
"def",
"update_highlights",
"(",
"self",
",",
"old_highlight_set",
",",
"new_highlight_set",
")",
":",
"with",
"self",
".",
"thmblock",
":",
"un_hilite_set",
"=",
"old_highlight_set",
"-",
"new_highlight_set",
"re_hilite_set",
"=",
"new_highlight_set",
"-",
"old_highl... | Unhighlight the thumbnails represented by `old_highlight_set`
and highlight the ones represented by new_highlight_set.
Both are sets of thumbkeys. | [
"Unhighlight",
"the",
"thumbnails",
"represented",
"by",
"old_highlight_set",
"and",
"highlight",
"the",
"ones",
"represented",
"by",
"new_highlight_set",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/Thumbs.py#L483-L510 | train |
ejeschke/ginga | ginga/rv/plugins/Thumbs.py | Thumbs.have_thumbnail | def have_thumbnail(self, fitsimage, image):
"""Returns True if we already have a thumbnail version of this image
cached, False otherwise.
"""
chname = self.fv.get_channel_name(fitsimage)
# Look up our version of the thumb
idx = image.get('idx', None)
path = image... | python | def have_thumbnail(self, fitsimage, image):
"""Returns True if we already have a thumbnail version of this image
cached, False otherwise.
"""
chname = self.fv.get_channel_name(fitsimage)
# Look up our version of the thumb
idx = image.get('idx', None)
path = image... | [
"def",
"have_thumbnail",
"(",
"self",
",",
"fitsimage",
",",
"image",
")",
":",
"chname",
"=",
"self",
".",
"fv",
".",
"get_channel_name",
"(",
"fitsimage",
")",
"idx",
"=",
"image",
".",
"get",
"(",
"'idx'",
",",
"None",
")",
"path",
"=",
"image",
"... | Returns True if we already have a thumbnail version of this image
cached, False otherwise. | [
"Returns",
"True",
"if",
"we",
"already",
"have",
"a",
"thumbnail",
"version",
"of",
"this",
"image",
"cached",
"False",
"otherwise",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/Thumbs.py#L546-L566 | train |
ejeschke/ginga | ginga/rv/plugins/Thumbs.py | Thumbs.auto_scroll | def auto_scroll(self, thumbkey):
"""Scroll the window to the thumb."""
if not self.gui_up:
return
# force scroll to bottom of thumbs, if checkbox is set
scrollp = self.w.auto_scroll.get_state()
if not scrollp:
return
bnch = self.thumb_dict[thumbke... | python | def auto_scroll(self, thumbkey):
"""Scroll the window to the thumb."""
if not self.gui_up:
return
# force scroll to bottom of thumbs, if checkbox is set
scrollp = self.w.auto_scroll.get_state()
if not scrollp:
return
bnch = self.thumb_dict[thumbke... | [
"def",
"auto_scroll",
"(",
"self",
",",
"thumbkey",
")",
":",
"if",
"not",
"self",
".",
"gui_up",
":",
"return",
"scrollp",
"=",
"self",
".",
"w",
".",
"auto_scroll",
".",
"get_state",
"(",
")",
"if",
"not",
"scrollp",
":",
"return",
"bnch",
"=",
"se... | Scroll the window to the thumb. | [
"Scroll",
"the",
"window",
"to",
"the",
"thumb",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/Thumbs.py#L1011-L1024 | train |
ejeschke/ginga | ginga/rv/plugins/Thumbs.py | Thumbs.clear_widget | def clear_widget(self):
"""
Clears the thumbnail display widget of all thumbnails, but does
not remove them from the thumb_dict or thumb_list.
"""
if not self.gui_up:
return
canvas = self.c_view.get_canvas()
canvas.delete_all_objects()
self.c_v... | python | def clear_widget(self):
"""
Clears the thumbnail display widget of all thumbnails, but does
not remove them from the thumb_dict or thumb_list.
"""
if not self.gui_up:
return
canvas = self.c_view.get_canvas()
canvas.delete_all_objects()
self.c_v... | [
"def",
"clear_widget",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"gui_up",
":",
"return",
"canvas",
"=",
"self",
".",
"c_view",
".",
"get_canvas",
"(",
")",
"canvas",
".",
"delete_all_objects",
"(",
")",
"self",
".",
"c_view",
".",
"redraw",
"("... | Clears the thumbnail display widget of all thumbnails, but does
not remove them from the thumb_dict or thumb_list. | [
"Clears",
"the",
"thumbnail",
"display",
"widget",
"of",
"all",
"thumbnails",
"but",
"does",
"not",
"remove",
"them",
"from",
"the",
"thumb_dict",
"or",
"thumb_list",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/Thumbs.py#L1026-L1035 | train |
ejeschke/ginga | ginga/AstroImage.py | AstroImage.load_nddata | def load_nddata(self, ndd, naxispath=None):
"""Load from an astropy.nddata.NDData object.
"""
self.clear_metadata()
# Make a header based on any NDData metadata
ahdr = self.get_header()
ahdr.update(ndd.meta)
self.setup_data(ndd.data, naxispath=naxispath)
... | python | def load_nddata(self, ndd, naxispath=None):
"""Load from an astropy.nddata.NDData object.
"""
self.clear_metadata()
# Make a header based on any NDData metadata
ahdr = self.get_header()
ahdr.update(ndd.meta)
self.setup_data(ndd.data, naxispath=naxispath)
... | [
"def",
"load_nddata",
"(",
"self",
",",
"ndd",
",",
"naxispath",
"=",
"None",
")",
":",
"self",
".",
"clear_metadata",
"(",
")",
"ahdr",
"=",
"self",
".",
"get_header",
"(",
")",
"ahdr",
".",
"update",
"(",
"ndd",
".",
"meta",
")",
"self",
".",
"se... | Load from an astropy.nddata.NDData object. | [
"Load",
"from",
"an",
"astropy",
".",
"nddata",
".",
"NDData",
"object",
"."
] | a78c893ec6f37a837de851947e9bb4625c597915 | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/AstroImage.py#L146-L166 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.