text
stringlengths 0
828
|
---|
raise ValueError(""draw_circle mode must be 'set' or 'add' but {} used"".format(mode)) |
return ri, ci, array[ri,ci]" |
140,"def draw_annulus(self, center, inner_radius, outer_radius, array, value, mode=""set""): |
"""""" |
Draws an annulus of specified radius on the input array and fills it with specified value |
:param center: a tuple for the center of the annulus |
:type center: tuple (x,y) |
:param inner_radius: how many pixels in radius the interior empty circle is, where the annulus begins |
:type inner_radius: int |
:param outer_radius: how many pixels in radius the larger outer circle is, where the annulus ends |
:typde outer_radius: int |
:param array: image to draw annulus on |
:type array: size (m,n) numpy array |
:param value: what value to fill the annulus with |
:type value: float |
:param mode: if ""set"" will assign the circle interior value, if ""add"" will add the value to the circle interior, |
throws exception otherwise |
:type mode: string, either ""set"" or ""add"" |
:return: updates input array and then returns it with the annulus coordinates as a tuple |
"""""" |
if mode == ""add"": |
self.draw_circle(center, outer_radius, array, value) |
self.draw_circle(center, inner_radius, array, -value) |
elif mode == ""set"": |
ri, ci, existing = self.draw_circle(center, inner_radius, array, -value) |
self.draw_circle(center, outer_radius, array, value) |
array[ri, ci] = existing |
else: |
raise ValueError(""draw_annulus mode must be 'set' or 'add' but {} used"".format(mode))" |
141,"def draw_default(self, inside=5, outside=15): |
"""""" |
Draw suggested sun disk, limb, and empty background |
:param inside: how many pixels from the calculated solar disk edge to go inward for the limb |
:param outside: how many pixels from the calculated solar disk edge to go outward for the limb |
:return: updates the self.selection_array |
"""""" |
# fill everything with empty outer space |
if 'outer_space' in self.config.solar_class_index: |
self.selection_array[:, :] = self.config.solar_class_index['outer_space'] |
elif 'empty_outer_space' in self.config.solar_class_index: |
self.selection_array[:, :] = self.config.solar_class_index['empty_outer_space'] |
else: |
raise ValueError(""outer_space or empty_outer_space must be classes with colors."") |
# draw the limb label in its location |
self.draw_annulus((self.cx, self.cy), |
self.sun_radius_pixel - inside, |
self.sun_radius_pixel + outside, |
self.selection_array, |
self.config.solar_class_index['limb']) |
# draw quiet sun in its location |
self.draw_circle((self.cx, self.cy), |
self.sun_radius_pixel - inside, |
self.selection_array, |
self.config.solar_class_index['quiet_sun'])" |
142,"def values(self): |
""""""Gets the parameter values |
:returns: dict of inputs: |
| *'nfft'*: int -- length, in samples, of FFT chunks |
| *'window'*: str -- name of window to apply to FFT chunks |
| *'overlap'*: float -- percent overlap of windows |
"""""" |
self.vals['nfft'] = self.ui.nfftSpnbx.value() |
self.vals['window'] = str(self.ui.windowCmbx.currentText()).lower() |
self.vals['overlap'] = self.ui.overlapSpnbx.value() |
return self.vals" |
143,"def main(): |
"""""" Parses the command-line args, and calls run. """""" |
parser = argparse.ArgumentParser( |
description='A pipeline that generates analysis pipelines.') |
parser.add_argument('input', nargs='?', |
help='A valid metapipe configuration file.') |
parser.add_argument('-o', '--output', |
help='An output destination. If none is provided, the ' |
'results will be printed to stdout.', |
default=sys.stdout) |
parser.add_argument('-t', '--temp', |
help='A desired metapipe binary file. This is used to store ' |
'temp data between generation and execution. ' |
'(Default: ""%(default)s"")', default='.metapipe') |
parser.add_argument('-s', '--shell', |
help='The path to the shell to be used when executing the ' |
'pipeline. (Default: ""%(default)s)""', |
default='/bin/bash') |
parser.add_argument('-r', '--run', |
help='Run the pipeline as soon as it\'s ready.', |
action='store_true') |
parser.add_argument('-n', '--name', |
help='A name for the pipeline.', |
default='') |
parser.add_argument('-j', '--job-type', |
help='The destination for calculations (i.e. local, a PBS ' |
'queue on a cluster, etc).\nOptions: {}. ' |
'(Default: ""%(default)s)""'.format(JOB_TYPES.keys()), |
default='local') |
parser.add_argument('-p', '--max-jobs', |
help='The maximum number of concurrent jobs allowed. ' |
'Defaults to maximum available cores.', |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.