INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Constrói uma: class: RespostaSAT para o retorno ( unicode ) da função: meth: ~satcfe. base. FuncoesSAT. bloquear_sat. | def bloquear_sat(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.bloquear_sat`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='BloquearSAT')
if resposta.EEEEE not in ('16000',):
... |
Constrói uma: class: RespostaSAT para o retorno ( unicode ) da função: meth: ~satcfe. base. FuncoesSAT. desbloquear_sat. | def desbloquear_sat(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.desbloquear_sat`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='DesbloquearSAT')
if resposta.EEEEE not in ('1700... |
Constrói uma: class: RespostaSAT para o retorno ( unicode ) da função: meth: ~satcfe. base. FuncoesSAT. trocar_codigo_de_ativacao. | def trocar_codigo_de_ativacao(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.trocar_codigo_de_ativacao`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='TrocarCodigoDeAtivacao')
if ... |
Load the specified variable from the ensemble files then close the files. | def load_data(self):
"""
Load the specified variable from the ensemble files, then close the files.
"""
if self.ensemble_name.upper() == "SSEF":
if self.variable[0:2] == "rh":
pressure_level = self.variable[2:]
relh_vars = ["sph", "tmp"]
... |
Load map projection information and create latitude longitude x y i and j grids for the projection. | def load_map_info(self, map_file):
"""
Load map projection information and create latitude, longitude, x, y, i, and j grids for the projection.
Args:
map_file: File specifying the projection information.
"""
if self.ensemble_name.upper() == "SSEF":
proj_d... |
Reads a geojson file containing an STObject and initializes a new STObject from the information in the file. | def read_geojson(filename):
"""
Reads a geojson file containing an STObject and initializes a new STObject from the information in the file.
Args:
filename: Name of the geojson file
Returns:
an STObject
"""
json_file = open(filename)
data = json.load(json_file)
json_fil... |
Calculate the center of mass at a given timestep. | def center_of_mass(self, time):
"""
Calculate the center of mass at a given timestep.
Args:
time: Time at which the center of mass calculation is performed
Returns:
The x- and y-coordinates of the center of mass.
"""
if self.start_time <= time <=... |
Calculates the center of mass for each time step and outputs an array | def trajectory(self):
"""
Calculates the center of mass for each time step and outputs an array
Returns:
"""
traj = np.zeros((2, self.times.size))
for t, time in enumerate(self.times):
traj[:, t] = self.center_of_mass(time)
return traj |
Gets the corner array indices of the STObject at a given time that corresponds to the upper left corner of the bounding box for the STObject. | def get_corner(self, time):
"""
Gets the corner array indices of the STObject at a given time that corresponds
to the upper left corner of the bounding box for the STObject.
Args:
time: time at which the corner is being extracted.
Returns:
corner inde... |
Gets the size of the object at a given time. | def size(self, time):
"""
Gets the size of the object at a given time.
Args:
time: Time value being queried.
Returns:
size of the object in pixels
"""
if self.start_time <= time <= self.end_time:
return self.masks[time - self.start_ti... |
Gets the largest size of the object over all timesteps. Returns: Maximum size of the object in pixels | def max_size(self):
"""
Gets the largest size of the object over all timesteps.
Returns:
Maximum size of the object in pixels
"""
sizes = np.array([m.sum() for m in self.masks])
return sizes.max() |
Calculate the maximum intensity found at a timestep. | def max_intensity(self, time):
"""
Calculate the maximum intensity found at a timestep.
"""
ti = np.where(time == self.times)[0][0]
return self.timesteps[ti].max() |
Adds the data from another STObject to this object. Args: step: another STObject being added after the current one in time. | def extend(self, step):
"""
Adds the data from another STObject to this object.
Args:
step: another STObject being added after the current one in time.
"""
self.timesteps.extend(step.timesteps)
self.masks.extend(step.masks)
self.x.extend(step.... |
Get coordinates of object boundary in counter - clockwise order | def boundary_polygon(self, time):
"""
Get coordinates of object boundary in counter-clockwise order
"""
ti = np.where(time == self.times)[0][0]
com_x, com_y = self.center_of_mass(time)
# If at least one point along perimeter of the mask rectangle is unmasked, find_boundar... |
Estimate the motion of the object with cross - correlation on the intensity values from the previous time step. | def estimate_motion(self, time, intensity_grid, max_u, max_v):
"""
Estimate the motion of the object with cross-correlation on the intensity values from the previous time step.
Args:
time: time being evaluated.
intensity_grid: 2D array of intensities used in cross correl... |
Counts the number of points that overlap between this STObject and another STObject. Used for tracking. | def count_overlap(self, time, other_object, other_time):
"""
Counts the number of points that overlap between this STObject and another STObject. Used for tracking.
"""
ti = np.where(time == self.times)[0][0]
ma = np.where(self.masks[ti].ravel() == 1)
oti = np.where(other... |
Extracts the data from a ModelOutput or ModelGrid object within the bounding box region of the STObject. Args: model_grid: A ModelGrid or ModelOutput Object potential: Extracts from the time before instead of the same time as the object | def extract_attribute_grid(self, model_grid, potential=False, future=False):
"""
Extracts the data from a ModelOutput or ModelGrid object within the bounding box region of the STObject.
Args:
model_grid: A ModelGrid or ModelOutput Object
potential: Extracts from ... |
Extracts data from a 2D array that has the same dimensions as the grid used to identify the object. | def extract_attribute_array(self, data_array, var_name):
"""
Extracts data from a 2D array that has the same dimensions as the grid used to identify the object.
Args:
data_array: 2D numpy array
"""
if var_name not in self.attributes.keys():
self.attribut... |
Extracts the difference in model outputs | def extract_tendency_grid(self, model_grid):
"""
Extracts the difference in model outputs
Args:
model_grid: ModelOutput or ModelGrid object.
"""
var_name = model_grid.variable + "-tendency"
self.attributes[var_name] = []
timesteps = np.arange(self.st... |
Calculates summary statistics over the domains of each attribute. Args: statistic_name ( string ): numpy statistic such as mean std max min | def calc_attribute_statistics(self, statistic_name):
"""
Calculates summary statistics over the domains of each attribute.
Args:
statistic_name (string): numpy statistic, such as mean, std, max, min
Returns:
dict of statistics from each attribute grid.
... |
Calculate statistics based on the values of an attribute. The following statistics are supported: mean max min std ptp ( range ) median skew ( mean - median ) and percentile_ ( percentile value ). | def calc_attribute_statistic(self, attribute, statistic, time):
"""
Calculate statistics based on the values of an attribute. The following statistics are supported:
mean, max, min, std, ptp (range), median, skew (mean - median), and percentile_(percentile value).
Args:
attr... |
Calculate statistics from the primary attribute of the StObject. | def calc_timestep_statistic(self, statistic, time):
"""
Calculate statistics from the primary attribute of the StObject.
Args:
statistic: statistic being calculated
time: Timestep being investigated
Returns:
Value of the statistic
"""
... |
Calculate shape statistics using regionprops applied to the object mask. Args: stat_names: List of statistics to be extracted from those calculated by regionprops. | def calc_shape_statistics(self, stat_names):
"""
Calculate shape statistics using regionprops applied to the object mask.
Args:
stat_names: List of statistics to be extracted from those calculated by regionprops.
Returns:
Dictionary of shape statistics
... |
Calculate shape statistics for a single time step | def calc_shape_step(self, stat_names, time):
"""
Calculate shape statistics for a single time step
Args:
stat_names: List of shape statistics calculated from region props
time: Time being investigated
Returns:
List of shape statistics
"""
... |
Output the data in the STObject to a geoJSON file. | def to_geojson(self, filename, proj, metadata=None):
"""
Output the data in the STObject to a geoJSON file.
Args:
filename: Name of the file
proj: PyProj object for converting the x and y coordinates back to latitude and longitue values.
metadata: Metadata de... |
Set the properties and write to disk. | def rewrite_properties(self, properties):
"""Set the properties and write to disk."""
with self.__library_storage_lock:
self.__library_storage = properties
self.__write_properties(None) |
Returns the model of node v | def model(self, v=None):
"Returns the model of node v"
if v is None:
v = self.estopping
hist = self.hist
trace = self.trace(v)
ins = None
if self._base._probability_calibration is not None:
node = hist[-1]
node.normalize()
X... |
Restore the position in the history of individual v s nodes | def trace(self, n):
"Restore the position in the history of individual v's nodes"
trace_map = {}
self._trace(n, trace_map)
s = list(trace_map.keys())
s.sort()
return s |
Tournament selection and when negative is True it performs negative tournament selection | def tournament(self, negative=False):
"""Tournament selection and when negative is True it performs negative
tournament selection"""
if self.generation <= self._random_generations and not negative:
return self.random_selection()
if not self._negative_selection and negative:
... |
Create the initial population | def create_population(self):
"Create the initial population"
base = self._base
if base._share_inputs:
used_inputs_var = SelectNumbers([x for x in range(base.nvar)])
used_inputs_naive = used_inputs_var
if base._pr_variable == 0:
used_inputs_var = Select... |
Add an individual to the population | def add(self, v):
"Add an individual to the population"
self.population.append(v)
self._current_popsize += 1
v.position = len(self._hist)
self._hist.append(v)
self.bsf = v
self.estopping = v
self._density += self.get_density(v) |
Replace an individual selected by negative tournament selection with individual v | def replace(self, v):
"""Replace an individual selected by negative tournament selection with
individual v"""
if self.popsize < self._popsize:
return self.add(v)
k = self.tournament(negative=True)
self.clean(self.population[k])
self.population[k] = v
v... |
Make the directory path if needed. | def make_directory_if_needed(directory_path):
"""
Make the directory path, if needed.
"""
if os.path.exists(directory_path):
if not os.path.isdir(directory_path):
raise OSError("Path is not a directory:", directory_path)
else:
os.makedirs(directory_path) |
Main entry point for the hatchery program | def hatchery():
""" Main entry point for the hatchery program """
args = docopt.docopt(__doc__)
task_list = args['<task>']
if not task_list or 'help' in task_list or args['--help']:
print(__doc__.format(version=_version.__version__, config_files=config.CONFIG_LOCATIONS))
return 0
l... |
Call an arbitary command and return the exit value stdout and stderr as a tuple | def call(cmd_args, suppress_output=False):
""" Call an arbitary command and return the exit value, stdout, and stderr as a tuple
Command can be passed in as either a string or iterable
>>> result = call('hatchery', suppress_output=True)
>>> result.exitval
0
>>> result = call(['hatchery', 'notr... |
Call a setup. py command or list of commands | def setup(cmd_args, suppress_output=False):
""" Call a setup.py command or list of commands
>>> result = setup('--name', suppress_output=True)
>>> result.exitval
0
>>> result = setup('notreal')
>>> result.exitval
1
"""
if not funcy.is_list(cmd_args) and not funcy.is_tuple(cmd_args):... |
Loads data files and stores the output in the data attribute. | def load_data(self):
"""
Loads data files and stores the output in the data attribute.
"""
data = []
valid_dates = []
mrms_files = np.array(sorted(os.listdir(self.path + self.variable + "/")))
mrms_file_dates = np.array([m_file.split("_")[-2].split("-")[0]
... |
Rescale your input data so that is ranges over integer values which will perform better in the watershed. | def rescale_data(data, data_min, data_max, out_min=0.0, out_max=100.0):
"""
Rescale your input data so that is ranges over integer values, which will perform better in the watershed.
Args:
data: 2D or 3D ndarray being rescaled
data_min: minimum value of input data for scaling purposes
... |
Labels input grid using enhanced watershed algorithm. | def label(self, input_grid):
"""
Labels input grid using enhanced watershed algorithm.
Args:
input_grid (numpy.ndarray): Grid to be labeled.
Returns:
Array of labeled pixels
"""
marked = self.find_local_maxima(input_grid)
marked = np.wher... |
Finds the local maxima in the inputGrid and perform region growing to identify objects. | def find_local_maxima(self, input_grid):
"""
Finds the local maxima in the inputGrid and perform region growing to identify objects.
Args:
input_grid: Raw input data.
Returns:
array with labeled objects.
"""
pixels, q_data = self.quantize(input_g... |
Grow a region at a certain bin level and check if the region has reached the maximum size. | def set_maximum(self, q_data, marked, center, bin_lower, foothills):
"""
Grow a region at a certain bin level and check if the region has reached the maximum size.
Args:
q_data: Quantized data array
marked: Array marking points that are objects
center: Coordi... |
Mark points determined to be foothills as globbed so that they are not included in future searches. Also searches neighboring points to foothill points to determine if they should also be considered foothills. | def remove_foothills(self, q_data, marked, bin_num, bin_lower, centers, foothills):
"""
Mark points determined to be foothills as globbed, so that they are not included in
future searches. Also searches neighboring points to foothill points to determine
if they should also be considered ... |
Quantize a grid into discrete steps based on input parameters. | def quantize(self, input_grid):
"""
Quantize a grid into discrete steps based on input parameters.
Args:
input_grid: 2-d array of values
Returns:
Dictionary of value pointing to pixel locations, and quantized 2-d array of data
"""
pixels = {}
... |
will display all the filenames. Result can be stored in an array for easy fetching of gistNames for future purposes. eg. a = Gist (). mygists (). listall () print a [ 0 ] #to fetch first gistName | def listall(self):
'''
will display all the filenames.
Result can be stored in an array for easy fetching of gistNames
for future purposes.
eg. a = Gist().mygists().listall()
print a[0] #to fetch first gistName
'''
file_name = []
r = requests.get(
'%s/users/%s/gists' % (BASE_URL, self.user),
... |
Doesn t require manual fetching of gistID of a gist passing gistName will return the content of gist. In case names are ambigious provide GistID or it will return the contents of recent ambigious gistname | def content(self, **args):
'''
Doesn't require manual fetching of gistID of a gist
passing gistName will return the content of gist. In case,
names are ambigious, provide GistID or it will return the contents
of recent ambigious gistname
'''
self.gist_name = ''
if 'name' in args:
self.gist_name = arg... |
Doesn t require manual fetching of gistID of a gist passing gistName will return edit the gist | def edit(self, **args):
'''
Doesn't require manual fetching of gistID of a gist
passing gistName will return edit the gist
'''
self.gist_name = ''
if 'description' in args:
self.description = args['description']
else:
self.description = ''
if 'name' in args and 'id' in args:
self.gist_name = ... |
Delete a gist by gistname/ gistID | def delete(self, **args):
'''
Delete a gist by gistname/gistID
'''
if 'name' in args:
self.gist_name = args['name']
self.gist_id = self.getMyID(self.gist_name)
elif 'id' in args:
self.gist_id = args['id']
else:
raise Exception('Provide GistName to delete')
url = 'gists'
if self.gist_id:
... |
List the authenticated user s starred gists | def starred(self, **args):
'''
List the authenticated user's starred gists
'''
ids =[]
r = requests.get(
'%s/gists/starred'%BASE_URL,
headers=self.gist.header
)
if 'limit' in args:
limit = args['limit']
else:
limit = len(r.json())
if (r.status_code == 200):
for g in range(0,limit ):
... |
Return Gist URL - Link Clone - Link and Script - Link to embed | def links(self,**args):
'''
Return Gist URL-Link, Clone-Link and Script-Link to embed
'''
if 'name' in args:
self.gist_name = args['name']
self.gist_id = self.getMyID(self.gist_name)
elif 'id' in args:
self.gist_id = args['id']
else:
raise Exception('Gist Name/ID must be provided')
if self.gis... |
Load neighborhood probability forecasts. | def load_forecasts(self):
"""
Load neighborhood probability forecasts.
"""
run_date_str = self.run_date.strftime("%Y%m%d")
forecast_file = self.forecast_path + "{0}/{1}_{2}_{3}_consensus_{0}.nc".format(run_date_str,
... |
Loads observations and masking grid ( if needed ). | def load_obs(self, mask_threshold=0.5):
"""
Loads observations and masking grid (if needed).
Args:
mask_threshold: Values greater than the threshold are kept, others are masked.
"""
print("Loading obs ", self.run_date, self.model_name, self.forecast_variable)
... |
Loads lat - lon coordinates from a netCDF file. | def load_coordinates(self):
"""
Loads lat-lon coordinates from a netCDF file.
"""
coord_file = Dataset(self.coordinate_file)
if "lon" in coord_file.variables.keys():
self.coordinates["lon"] = coord_file.variables["lon"][:]
self.coordinates["lat"] = coord_f... |
Calculates ROC curves and Reliability scores for each forecast hour. | def evaluate_hourly_forecasts(self):
"""
Calculates ROC curves and Reliability scores for each forecast hour.
Returns:
A pandas DataFrame containing forecast metadata as well as DistributedROC and Reliability objects.
"""
score_columns = ["Run_Date", "Forecast_Hour",... |
Evaluates ROC and Reliability scores for forecasts over the full period from start hour to end hour | def evaluate_period_forecasts(self):
"""
Evaluates ROC and Reliability scores for forecasts over the full period from start hour to end hour
Returns:
A pandas DataFrame with full-period metadata and verification statistics
"""
score_columns = ["Run_Date", "Ensemble N... |
Main function explicitly called from the C ++ code. Return the main application object. | def bootstrap_main(args):
"""
Main function explicitly called from the C++ code.
Return the main application object.
"""
version_info = sys.version_info
if version_info.major != 3 or version_info.minor < 6:
return None, "python36"
main_fn = load_module_as_package("nionui_app.nionswif... |
Migrate library to latest version. | def _migrate_library(workspace_dir: pathlib.Path, do_logging: bool=True) -> pathlib.Path:
""" Migrate library to latest version. """
library_path_11 = workspace_dir / "Nion Swift Workspace.nslib"
library_path_12 = workspace_dir / "Nion Swift Library 12.nslib"
library_path_13 = workspace_dir / "Nion Swi... |
Nome amigável do campo ESTADO_OPERACAO conforme a Tabela de Informações do Status do SAT. | def status(self):
"""Nome amigável do campo ``ESTADO_OPERACAO``, conforme a "Tabela de
Informações do Status do SAT".
"""
for valor, rotulo in ESTADOS_OPERACAO:
if self.ESTADO_OPERACAO == valor:
return rotulo
return u'(desconhecido: {})'.format(self.ES... |
Constrói uma: class: RespostaConsultarStatusOperacional a partir do retorno informado. | def analisar(retorno):
"""Constrói uma :class:`RespostaConsultarStatusOperacional` a partir do
retorno informado.
:param unicode retorno: Retorno da função ``ConsultarStatusOperacional``.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='ConsultarS... |
Reads forecasts from json files and merges them with the input data from the step csv files. | def merge_input_csv_forecast_json(input_csv_file, forecast_json_path, condition_models, dist_models):
"""
Reads forecasts from json files and merges them with the input data from the step csv files.
Args:
input_csv_file: Name of the input data csv file being processed
forecast_json_path: Pa... |
Called from item to indicate its data or metadata has changed. | def mark_data_dirty(self):
""" Called from item to indicate its data or metadata has changed."""
self.__cache.set_cached_value_dirty(self.__display_item, self.__cache_property_name)
self.__initialize_cache()
self.__cached_value_dirty = True |
Initialize the cache values ( cache values are used for optimization ). | def __initialize_cache(self):
"""Initialize the cache values (cache values are used for optimization)."""
if self.__cached_value_dirty is None:
self.__cached_value_dirty = self.__cache.is_cached_value_dirty(self.__display_item, self.__cache_property_name)
self.__cached_value = se... |
Recompute the data on a thread if necessary. | def recompute_if_necessary(self, ui):
"""Recompute the data on a thread, if necessary.
If the data has recently been computed, this call will be rescheduled for the future.
If the data is currently being computed, it do nothing."""
self.__initialize_cache()
if self.__cached_val... |
Compute the data associated with this processor. | def recompute_data(self, ui):
"""Compute the data associated with this processor.
This method is thread safe and may take a long time to return. It should not be called from
the UI thread. Upon return, the results will be calculated with the latest data available
and the cache will no... |
Returned ThumbnailSource must be closed. | def thumbnail_source_for_display_item(self, ui, display_item: DisplayItem.DisplayItem) -> ThumbnailSource:
"""Returned ThumbnailSource must be closed."""
with self.__lock:
thumbnail_source = self.__thumbnail_sources.get(display_item)
if not thumbnail_source:
thumb... |
Load plug - ins. | def load_plug_ins(app, root_dir):
"""Load plug-ins."""
global extensions
ui = app.ui
# a list of directories in which sub-directories PlugIns will be searched.
subdirectories = []
# the default location is where the directory main packages are located.
if root_dir:
subdirectories.... |
Getting gistID of a gist in order to make the workflow easy and uninterrupted. | def getMyID(self,gist_name):
'''
Getting gistID of a gist in order to make the workflow
easy and uninterrupted.
'''
r = requests.get(
'%s'%BASE_URL+'/users/%s/gists' % self.user,
headers=self.gist.header
)
if (r.status_code == 200):
r_text = json.loads(r.text)
limit = len(r.json())
for g,... |
Close the document controller. | def close(self):
"""Close the document controller.
This method must be called to shut down the document controller. There are several
paths by which it can be called, though.
* User quits application via menu item. The menu item will call back to Application.exit which will close ea... |
Add a listener function and return listener token. Token can be closed or deleted to unlisten. | def add_periodic(self, interval: float, listener_fn):
"""Add a listener function and return listener token. Token can be closed or deleted to unlisten."""
class PeriodicListener:
def __init__(self, interval: float, listener_fn):
self.interval = interval
self._... |
Update the data item model with a new container filter and sorting. | def __update_display_items_model(self, display_items_model: ListModel.FilteredListModel, data_group: typing.Optional[DataGroup.DataGroup], filter_id: typing.Optional[str]) -> None:
"""Update the data item model with a new container, filter, and sorting.
This is called when the data item model is create... |
Return the data item with keyboard focus. | def focused_data_item(self) -> typing.Optional[DataItem.DataItem]:
"""Return the data item with keyboard focus."""
return self.__focused_display_item.data_item if self.__focused_display_item else None |
Return the selected display item. | def selected_display_item(self) -> typing.Optional[DisplayItem.DisplayItem]:
"""Return the selected display item.
The selected display is the display ite that has keyboard focus in the data panel or a display panel.
"""
# first check for the [focused] data browser
display_item =... |
Get two sensible data sources which may be the same. | def _get_two_data_sources(self):
"""Get two sensible data sources, which may be the same."""
selected_display_items = self.selected_display_items
if len(selected_display_items) < 2:
selected_display_items = list()
display_item = self.selected_display_item
if d... |
Calculate origin and size for canvas size data shape and image display parameters. | def calculate_origin_and_size(canvas_size, data_shape, image_canvas_mode, image_zoom, image_position) -> typing.Tuple[typing.Any, typing.Any]:
"""Calculate origin and size for canvas size, data shape, and image display parameters."""
if data_shape is None:
return None, None
if image_canvas_mode == "... |
Read data items from the data reference handler and return as a list. | def read_library(persistent_storage_system, ignore_older_files) -> typing.Dict:
"""Read data items from the data reference handler and return as a list.
Data items will have persistent_object_context set upon return, but caller will need to call finish_reading
on each of the data items.
"""
data_it... |
Migrate items from the storage system to the object context. | def auto_migrate_storage_system(*, persistent_storage_system=None, new_persistent_storage_system=None, data_item_uuids=None, deletions: typing.List[uuid.UUID] = None, utilized_deletions: typing.Set[uuid.UUID] = None, ignore_older_files: bool = True):
"""Migrate items from the storage system to the object context.
... |
Set the properties and write to disk. | def rewrite_properties(self, properties):
"""Set the properties and write to disk."""
with self.__properties_lock:
self.__properties = properties
self.__write_properties(None) |
Constrói uma: class: RespostaAtivarSAT a partir do retorno informado. | def analisar(retorno):
"""Constrói uma :class:`RespostaAtivarSAT` a partir do retorno
informado.
:param unicode retorno: Retorno da função ``AtivarSAT``.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='AtivarSAT',
classe_resposta=... |
Create a view task for this hardware source. | def create_view_task(self, frame_parameters: dict=None, channels_enabled: typing.List[bool]=None, buffer_size: int=1) -> ViewTask:
"""Create a view task for this hardware source.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for the view. Pass None for defaults.
:... |
Load configuration from yaml source ( s ) cached to only run once | def from_yaml():
""" Load configuration from yaml source(s), cached to only run once """
default_yaml_str = snippets.get_snippet_content('hatchery.yml')
ret = yaml.load(default_yaml_str, Loader=yaml.RoundTripLoader)
for config_path in CONFIG_LOCATIONS:
config_path = os.path.expanduser(config_pat... |
Load configuration from. pypirc file cached to only run once | def from_pypirc(pypi_repository):
""" Load configuration from .pypirc file, cached to only run once """
ret = {}
pypirc_locations = PYPIRC_LOCATIONS
for pypirc_path in pypirc_locations:
pypirc_path = os.path.expanduser(pypirc_path)
if os.path.isfile(pypirc_path):
parser = con... |
Create a temporary pypirc file for interaction with twine | def pypirc_temp(index_url):
""" Create a temporary pypirc file for interaction with twine """
pypirc_file = tempfile.NamedTemporaryFile(suffix='.pypirc', delete=False)
print(pypirc_file.name)
with open(pypirc_file.name, 'w') as fh:
fh.write(PYPIRC_TEMPLATE.format(index_name=PYPIRC_TEMP_INDEX_NAM... |
Get a versioned interface matching the given version and ui_version. | def get_api(version: str, ui_version: str=None) -> API_1:
"""Get a versioned interface matching the given version and ui_version.
version is a string in the form "1.0.2".
"""
ui_version = ui_version if ui_version else "~1.0"
return _get_api_with_app(version, ui_version, ApplicationModule.app) |
Return the mask created by this graphic as extended data. | def mask_xdata_with_shape(self, shape: DataAndMetadata.ShapeType) -> DataAndMetadata.DataAndMetadata:
"""Return the mask created by this graphic as extended data.
.. versionadded:: 1.0
Scriptable: Yes
"""
mask = self._graphic.get_mask(shape)
return DataAndMetadata.DataA... |
Set the end property in relative coordinates. | def end(self, value: typing.Union[float, NormPointType]) -> None:
"""Set the end property in relative coordinates.
End may be a float when graphic is an Interval or a tuple (y, x) when graphic is a Line."""
self.set_property("end", value) |
Set the end property in relative coordinates. | def start(self, value: typing.Union[float, NormPointType]) -> None:
"""Set the end property in relative coordinates.
End may be a float when graphic is an Interval or a tuple (y, x) when graphic is a Line."""
self.set_property("start", value) |
Set the data. | def data(self, data: numpy.ndarray) -> None:
"""Set the data.
:param data: A numpy ndarray.
.. versionadded:: 1.0
Scriptable: Yes
"""
self.__data_item.set_data(numpy.copy(data)) |
Return the extended data of this data item display. | def display_xdata(self) -> DataAndMetadata.DataAndMetadata:
"""Return the extended data of this data item display.
Display data will always be 1d or 2d and either int, float, or RGB data type.
.. versionadded:: 1.0
Scriptable: Yes
"""
display_data_channel = self.__disp... |
Set the dimensional calibrations. | def set_dimensional_calibrations(self, dimensional_calibrations: typing.List[CalibrationModule.Calibration]) -> None:
"""Set the dimensional calibrations.
:param dimensional_calibrations: A list of calibrations, must match the dimensions of the data.
.. versionadded:: 1.0
Scriptable: ... |
Get the metadata value for the given key. | def get_metadata_value(self, key: str) -> typing.Any:
"""Get the metadata value for the given key.
There are a set of predefined keys that, when used, will be type checked and be interoperable with other
applications. Please consult reference documentation for valid keys.
If using a cu... |
Set the metadata value for the given key. | def set_metadata_value(self, key: str, value: typing.Any) -> None:
"""Set the metadata value for the given key.
There are a set of predefined keys that, when used, will be type checked and be interoperable with other
applications. Please consult reference documentation for valid keys.
... |
Return the graphics attached to this data item. | def graphics(self) -> typing.List[Graphic]:
"""Return the graphics attached to this data item.
.. versionadded:: 1.0
Scriptable: Yes
"""
return [Graphic(graphic) for graphic in self.__display_item.graphics] |
Add a point graphic to the data item. | def add_point_region(self, y: float, x: float) -> Graphic:
"""Add a point graphic to the data item.
:param x: The x coordinate, in relative units [0.0, 1.0]
:param y: The y coordinate, in relative units [0.0, 1.0]
:return: The :py:class:`nion.swift.Facade.Graphic` object that was added.... |
Return the mask by combining any mask graphics on this data item as extended data. | def mask_xdata(self) -> DataAndMetadata.DataAndMetadata:
"""Return the mask by combining any mask graphics on this data item as extended data.
.. versionadded:: 1.0
Scriptable: Yes
"""
display_data_channel = self.__display_item.display_data_channel
shape = display_data_... |
Return the data item associated with this display panel. | def data_item(self) -> DataItem:
"""Return the data item associated with this display panel.
.. versionadded:: 1.0
Scriptable: Yes
"""
display_panel = self.__display_panel
if not display_panel:
return None
data_item = display_panel.data_item
... |
Set the data item associated with this display panel. | def set_data_item(self, data_item: DataItem) -> None:
"""Set the data item associated with this display panel.
:param data_item: The :py:class:`nion.swift.Facade.DataItem` object to add.
This will replace whatever data item, browser, or controller is currently in the display panel with the sin... |
Add a data item to the group. | def add_data_item(self, data_item: DataItem) -> None:
"""Add a data item to the group.
:param data_item: The :py:class:`nion.swift.Facade.DataItem` object to add.
.. versionadded:: 1.0
Scriptable: Yes
"""
display_item = data_item._data_item.container.get_display_item_f... |
Close the task. | def close(self) -> None:
"""Close the task.
.. versionadded:: 1.0
This method must be called when the task is no longer needed.
"""
self.__data_channel_buffer.stop()
self.__data_channel_buffer.close()
self.__data_channel_buffer = None
if not self.__was_p... |
Record data and return a list of data_and_metadata objects. | def record(self, frame_parameters: dict=None, channels_enabled: typing.List[bool]=None, timeout: float=None) -> typing.List[DataAndMetadata.DataAndMetadata]:
"""Record data and return a list of data_and_metadata objects.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for t... |
Create a record task for this hardware source. | def create_record_task(self, frame_parameters: dict=None, channels_enabled: typing.List[bool]=None) -> RecordTask:
"""Create a record task for this hardware source.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for the record. Pass None for defaults.
:type frame_p... |
Create a view task for this hardware source. | def create_view_task(self, frame_parameters: dict=None, channels_enabled: typing.List[bool]=None, buffer_size: int=1) -> ViewTask:
"""Create a view task for this hardware source.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for the view. Pass None for defaults.
:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.