text
stringlengths
0
828
""""""
if plotname is None:
plotname = self.responsePlots.keys()[0]
self.responsePlots[plotname].updateData(axeskey='stim', x=xdata, y=ydata)"
116,"def setXlimits(self, lims):
""""""Sets the X axis limits of the trace plot
:param lims: (min, max) of x axis, in same units as data
:type lims: (float, float)
""""""
# update all ""linked"", plots
self.specPlot.setXlim(lims)
for plot in self.responsePlots.values():
plot.setXlim(lims)
# ridiculous...
sizes = self.splittersw.sizes()
if len(sizes) > 1:
if self.badbadbad:
sizes[0] +=1
sizes[1] -=1
else:
sizes[0] -=1
sizes[1] +=1
self.badbadbad = not self.badbadbad
self.splittersw.setSizes(sizes)
self._ignore_range_signal = False"
117,"def setNreps(self, nreps):
""""""Sets the number of reps before the raster plot resets""""""
for plot in self.responsePlots.values():
plot.setNreps(nreps)"
118,"def specAutoRange(self):
""""""Auto adjusts the visible range of the spectrogram""""""
trace_range = self.responsePlots.values()[0].viewRange()[0]
vb = self.specPlot.getViewBox()
vb.autoRange(padding=0)
self.specPlot.setXlim(trace_range)"
119,"def interpret_header(self):
""""""
Read pertinent information from the image headers,
especially location and radius of the Sun to calculate the default thematic map
:return: setes self.date, self.cy, self.cx, and self.sun_radius_pixel
""""""
# handle special cases since date-obs field changed names
if 'DATE_OBS' in self.header:
self.date = self.header['DATE_OBS']
elif 'DATE-OBS' in self.header:
self.date = self.header['DATE-OBS']
else:
raise Exception(""Image does not have a DATE_OBS or DATE-OBS field"")
self.cy, self.cx = self.header['CRPIX1'], self.header['CRPIX2']
sun_radius_angular = sun.solar_semidiameter_angular_size(t=time.parse_time(self.date)).arcsec
arcsec_per_pixel = self.header['CDELT1']
self.sun_radius_pixel = (sun_radius_angular / arcsec_per_pixel)"
120,"def save(self):
"""""" Save as a FITS file and attempt an upload if designated in the configuration file """"""
out = Outgest(self.output, self.selection_array.astype('uint8'), self.headers, self.config_path)
out.save()
out.upload()"
121,"def on_exit(self):
"""""" When you click to exit, this function is called, prompts whether to save""""""
answer = messagebox.askyesnocancel(""Exit"", ""Do you want to save as you quit the application?"")
if answer:
self.save()
self.quit()
self.destroy()
elif answer is None:
pass # the cancel action
else:
self.quit()
self.destroy()"
122,"def make_gui(self):
"""""" Setups the general structure of the gui, the first function called """"""
self.option_window = Toplevel()
self.option_window.protocol(""WM_DELETE_WINDOW"", self.on_exit)
self.canvas_frame = tk.Frame(self, height=500)
self.option_frame = tk.Frame(self.option_window, height=300)
self.canvas_frame.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
self.option_frame.pack(side=tk.RIGHT, fill=None, expand=False)
self.make_options_frame()
self.make_canvas_frame()
self.disable_singlecolor()"
123,"def configure_threecolor_image(self):
""""""
configures the three color image according to the requested parameters
:return: nothing, just updates self.image
""""""
order = {'red': 0, 'green': 1, 'blue': 2}
self.image = np.zeros((self.shape[0], self.shape[1], 3))
for color, var in self.multicolorvars.items():
channel = var.get() # determine which channel should be plotted as this color
self.image[:, :, order[color]] = self.data[channel]
# scale the image by the power
self.image[:, :, order[color]] = np.power(self.image[:, :, order[color]],
self.multicolorpower[color].get())
# adjust the percentile thresholds
lower = np.nanpercentile(self.image[:, :, order[color]], self.multicolormin[color].get())