partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | UDPRadio.send | Sends a message to the UDP receiver
Parameter
---------
message_type: monitoring.MessageType (enum)
In this case message type is RESOURCE_INFO most often
task_id: int
Task identifier of the task for which resource monitoring is being reported
message: ob... | parsl/monitoring/monitoring.py | def send(self, message_type, task_id, message):
""" Sends a message to the UDP receiver
Parameter
---------
message_type: monitoring.MessageType (enum)
In this case message type is RESOURCE_INFO most often
task_id: int
Task identifier of the task for whi... | def send(self, message_type, task_id, message):
""" Sends a message to the UDP receiver
Parameter
---------
message_type: monitoring.MessageType (enum)
In this case message type is RESOURCE_INFO most often
task_id: int
Task identifier of the task for whi... | [
"Sends",
"a",
"message",
"to",
"the",
"UDP",
"receiver"
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/monitoring/monitoring.py#L89-L120 | [
"def",
"send",
"(",
"self",
",",
"message_type",
",",
"task_id",
",",
"message",
")",
":",
"x",
"=",
"0",
"try",
":",
"buffer",
"=",
"pickle",
".",
"dumps",
"(",
"(",
"self",
".",
"source_id",
",",
"# Identifier for manager",
"int",
"(",
"time",
".",
... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | MonitoringHub.monitor_wrapper | Internal
Wrap the Parsl app with a function that will call the monitor function and point it at the correct pid when the task begins. | parsl/monitoring/monitoring.py | def monitor_wrapper(f, task_id, monitoring_hub_url, run_id, sleep_dur):
""" Internal
Wrap the Parsl app with a function that will call the monitor function and point it at the correct pid when the task begins.
"""
def wrapped(*args, **kwargs):
p = Process(target=monitor, args... | def monitor_wrapper(f, task_id, monitoring_hub_url, run_id, sleep_dur):
""" Internal
Wrap the Parsl app with a function that will call the monitor function and point it at the correct pid when the task begins.
"""
def wrapped(*args, **kwargs):
p = Process(target=monitor, args... | [
"Internal",
"Wrap",
"the",
"Parsl",
"app",
"with",
"a",
"function",
"that",
"will",
"call",
"the",
"monitor",
"function",
"and",
"point",
"it",
"at",
"the",
"correct",
"pid",
"when",
"the",
"task",
"begins",
"."
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/monitoring/monitoring.py#L251-L264 | [
"def",
"monitor_wrapper",
"(",
"f",
",",
"task_id",
",",
"monitoring_hub_url",
",",
"run_id",
",",
"sleep_dur",
")",
":",
"def",
"wrapped",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"p",
"=",
"Process",
"(",
"target",
"=",
"monitor",
",",
... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | SSHChannel.execute_wait | Synchronously execute a commandline string on the shell.
Args:
- cmd (string) : Commandline string to execute
- walltime (int) : walltime in seconds
Kwargs:
- envs (dict) : Dictionary of env variables
Returns:
- retcode : Return code from the ex... | parsl/channels/ssh/ssh.py | def execute_wait(self, cmd, walltime=2, envs={}):
''' Synchronously execute a commandline string on the shell.
Args:
- cmd (string) : Commandline string to execute
- walltime (int) : walltime in seconds
Kwargs:
- envs (dict) : Dictionary of env variables
... | def execute_wait(self, cmd, walltime=2, envs={}):
''' Synchronously execute a commandline string on the shell.
Args:
- cmd (string) : Commandline string to execute
- walltime (int) : walltime in seconds
Kwargs:
- envs (dict) : Dictionary of env variables
... | [
"Synchronously",
"execute",
"a",
"commandline",
"string",
"on",
"the",
"shell",
"."
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/channels/ssh/ssh.py#L97-L122 | [
"def",
"execute_wait",
"(",
"self",
",",
"cmd",
",",
"walltime",
"=",
"2",
",",
"envs",
"=",
"{",
"}",
")",
":",
"# Execute the command",
"stdin",
",",
"stdout",
",",
"stderr",
"=",
"self",
".",
"ssh_client",
".",
"exec_command",
"(",
"self",
".",
"pre... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | SSHChannel.execute_no_wait | Execute asynchronousely without waiting for exitcode
Args:
- cmd (string): Commandline string to be executed on the remote side
- walltime (int): timeout to exec_command
KWargs:
- envs (dict): A dictionary of env variables
Returns:
- None, stdou... | parsl/channels/ssh/ssh.py | def execute_no_wait(self, cmd, walltime=2, envs={}):
''' Execute asynchronousely without waiting for exitcode
Args:
- cmd (string): Commandline string to be executed on the remote side
- walltime (int): timeout to exec_command
KWargs:
- envs (dict): A dictio... | def execute_no_wait(self, cmd, walltime=2, envs={}):
''' Execute asynchronousely without waiting for exitcode
Args:
- cmd (string): Commandline string to be executed on the remote side
- walltime (int): timeout to exec_command
KWargs:
- envs (dict): A dictio... | [
"Execute",
"asynchronousely",
"without",
"waiting",
"for",
"exitcode"
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/channels/ssh/ssh.py#L124-L145 | [
"def",
"execute_no_wait",
"(",
"self",
",",
"cmd",
",",
"walltime",
"=",
"2",
",",
"envs",
"=",
"{",
"}",
")",
":",
"# Execute the command",
"stdin",
",",
"stdout",
",",
"stderr",
"=",
"self",
".",
"ssh_client",
".",
"exec_command",
"(",
"self",
".",
"... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | SSHChannel.push_file | Transport a local file to a directory on a remote machine
Args:
- local_source (string): Path
- remote_dir (string): Remote path
Returns:
- str: Path to copied file on remote machine
Raises:
- BadScriptPath : if script path on the remote side is... | parsl/channels/ssh/ssh.py | def push_file(self, local_source, remote_dir):
''' Transport a local file to a directory on a remote machine
Args:
- local_source (string): Path
- remote_dir (string): Remote path
Returns:
- str: Path to copied file on remote machine
Raises:
... | def push_file(self, local_source, remote_dir):
''' Transport a local file to a directory on a remote machine
Args:
- local_source (string): Path
- remote_dir (string): Remote path
Returns:
- str: Path to copied file on remote machine
Raises:
... | [
"Transport",
"a",
"local",
"file",
"to",
"a",
"directory",
"on",
"a",
"remote",
"machine"
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/channels/ssh/ssh.py#L147-L185 | [
"def",
"push_file",
"(",
"self",
",",
"local_source",
",",
"remote_dir",
")",
":",
"remote_dest",
"=",
"remote_dir",
"+",
"'/'",
"+",
"os",
".",
"path",
".",
"basename",
"(",
"local_source",
")",
"try",
":",
"self",
".",
"makedirs",
"(",
"remote_dir",
",... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | SSHChannel.pull_file | Transport file on the remote side to a local directory
Args:
- remote_source (string): remote_source
- local_dir (string): Local directory to copy to
Returns:
- str: Local path to file
Raises:
- FileExists : Name collision at local directory.
... | parsl/channels/ssh/ssh.py | def pull_file(self, remote_source, local_dir):
''' Transport file on the remote side to a local directory
Args:
- remote_source (string): remote_source
- local_dir (string): Local directory to copy to
Returns:
- str: Local path to file
Raises:
... | def pull_file(self, remote_source, local_dir):
''' Transport file on the remote side to a local directory
Args:
- remote_source (string): remote_source
- local_dir (string): Local directory to copy to
Returns:
- str: Local path to file
Raises:
... | [
"Transport",
"file",
"on",
"the",
"remote",
"side",
"to",
"a",
"local",
"directory"
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/channels/ssh/ssh.py#L187-L224 | [
"def",
"pull_file",
"(",
"self",
",",
"remote_source",
",",
"local_dir",
")",
":",
"local_dest",
"=",
"local_dir",
"+",
"'/'",
"+",
"os",
".",
"path",
".",
"basename",
"(",
"remote_source",
")",
"try",
":",
"os",
".",
"makedirs",
"(",
"local_dir",
")",
... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | SSHChannel.isdir | Return true if the path refers to an existing directory.
Parameters
----------
path : str
Path of directory on the remote side to check. | parsl/channels/ssh/ssh.py | def isdir(self, path):
"""Return true if the path refers to an existing directory.
Parameters
----------
path : str
Path of directory on the remote side to check.
"""
result = True
try:
self.sftp_client.lstat(path)
except FileNotFo... | def isdir(self, path):
"""Return true if the path refers to an existing directory.
Parameters
----------
path : str
Path of directory on the remote side to check.
"""
result = True
try:
self.sftp_client.lstat(path)
except FileNotFo... | [
"Return",
"true",
"if",
"the",
"path",
"refers",
"to",
"an",
"existing",
"directory",
"."
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/channels/ssh/ssh.py#L229-L243 | [
"def",
"isdir",
"(",
"self",
",",
"path",
")",
":",
"result",
"=",
"True",
"try",
":",
"self",
".",
"sftp_client",
".",
"lstat",
"(",
"path",
")",
"except",
"FileNotFoundError",
":",
"result",
"=",
"False",
"return",
"result"
] | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | SSHChannel.makedirs | Create a directory on the remote side.
If intermediate directories do not exist, they will be created.
Parameters
----------
path : str
Path of directory on the remote side to create.
mode : int
Permissions (posix-style) for the newly-created directory.
... | parsl/channels/ssh/ssh.py | def makedirs(self, path, mode=511, exist_ok=False):
"""Create a directory on the remote side.
If intermediate directories do not exist, they will be created.
Parameters
----------
path : str
Path of directory on the remote side to create.
mode : int
... | def makedirs(self, path, mode=511, exist_ok=False):
"""Create a directory on the remote side.
If intermediate directories do not exist, they will be created.
Parameters
----------
path : str
Path of directory on the remote side to create.
mode : int
... | [
"Create",
"a",
"directory",
"on",
"the",
"remote",
"side",
"."
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/channels/ssh/ssh.py#L245-L263 | [
"def",
"makedirs",
"(",
"self",
",",
"path",
",",
"mode",
"=",
"511",
",",
"exist_ok",
"=",
"False",
")",
":",
"if",
"exist_ok",
"is",
"False",
"and",
"self",
".",
"isdir",
"(",
"path",
")",
":",
"raise",
"OSError",
"(",
"'Target directory {} already exi... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | CommandClient.run | This function needs to be fast at the same time aware of the possibility of
ZMQ pipes overflowing.
The timeout increases slowly if contention is detected on ZMQ pipes.
We could set copy=False and get slightly better latency but this results
in ZMQ sockets reaching a broken state once th... | parsl/executors/high_throughput/zmq_pipes.py | def run(self, message):
""" This function needs to be fast at the same time aware of the possibility of
ZMQ pipes overflowing.
The timeout increases slowly if contention is detected on ZMQ pipes.
We could set copy=False and get slightly better latency but this results
in ZMQ soc... | def run(self, message):
""" This function needs to be fast at the same time aware of the possibility of
ZMQ pipes overflowing.
The timeout increases slowly if contention is detected on ZMQ pipes.
We could set copy=False and get slightly better latency but this results
in ZMQ soc... | [
"This",
"function",
"needs",
"to",
"be",
"fast",
"at",
"the",
"same",
"time",
"aware",
"of",
"the",
"possibility",
"of",
"ZMQ",
"pipes",
"overflowing",
"."
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/high_throughput/zmq_pipes.py#L31-L42 | [
"def",
"run",
"(",
"self",
",",
"message",
")",
":",
"self",
".",
"zmq_socket",
".",
"send_pyobj",
"(",
"message",
",",
"copy",
"=",
"True",
")",
"reply",
"=",
"self",
".",
"zmq_socket",
".",
"recv_pyobj",
"(",
")",
"return",
"reply"
] | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | TasksOutgoing.put | This function needs to be fast at the same time aware of the possibility of
ZMQ pipes overflowing.
The timeout increases slowly if contention is detected on ZMQ pipes.
We could set copy=False and get slightly better latency but this results
in ZMQ sockets reaching a broken state once th... | parsl/executors/high_throughput/zmq_pipes.py | def put(self, message):
""" This function needs to be fast at the same time aware of the possibility of
ZMQ pipes overflowing.
The timeout increases slowly if contention is detected on ZMQ pipes.
We could set copy=False and get slightly better latency but this results
in ZMQ soc... | def put(self, message):
""" This function needs to be fast at the same time aware of the possibility of
ZMQ pipes overflowing.
The timeout increases slowly if contention is detected on ZMQ pipes.
We could set copy=False and get slightly better latency but this results
in ZMQ soc... | [
"This",
"function",
"needs",
"to",
"be",
"fast",
"at",
"the",
"same",
"time",
"aware",
"of",
"the",
"possibility",
"of",
"ZMQ",
"pipes",
"overflowing",
"."
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/high_throughput/zmq_pipes.py#L72-L90 | [
"def",
"put",
"(",
"self",
",",
"message",
")",
":",
"timeout_ms",
"=",
"0",
"while",
"True",
":",
"socks",
"=",
"dict",
"(",
"self",
".",
"poller",
".",
"poll",
"(",
"timeout",
"=",
"timeout_ms",
")",
")",
"if",
"self",
".",
"zmq_socket",
"in",
"s... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | FlowControl._wake_up_timer | Internal. This is the function that the thread will execute.
waits on an event so that the thread can make a quick exit when close() is called
Args:
- kill_event (threading.Event) : Event to wait on | parsl/dataflow/flow_control.py | def _wake_up_timer(self, kill_event):
"""Internal. This is the function that the thread will execute.
waits on an event so that the thread can make a quick exit when close() is called
Args:
- kill_event (threading.Event) : Event to wait on
"""
while True:
... | def _wake_up_timer(self, kill_event):
"""Internal. This is the function that the thread will execute.
waits on an event so that the thread can make a quick exit when close() is called
Args:
- kill_event (threading.Event) : Event to wait on
"""
while True:
... | [
"Internal",
".",
"This",
"is",
"the",
"function",
"that",
"the",
"thread",
"will",
"execute",
".",
"waits",
"on",
"an",
"event",
"so",
"that",
"the",
"thread",
"can",
"make",
"a",
"quick",
"exit",
"when",
"close",
"()",
"is",
"called"
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/dataflow/flow_control.py#L100-L121 | [
"def",
"_wake_up_timer",
"(",
"self",
",",
"kill_event",
")",
":",
"while",
"True",
":",
"prev",
"=",
"self",
".",
"_wake_up_time",
"# Waiting for the event returns True only when the event",
"# is set, usually by the parent thread",
"time_to_die",
"=",
"kill_event",
".",
... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | FlowControl.notify | Let the FlowControl system know that there is an event. | parsl/dataflow/flow_control.py | def notify(self, event_id):
"""Let the FlowControl system know that there is an event."""
self._event_buffer.extend([event_id])
self._event_count += 1
if self._event_count >= self.threshold:
logger.debug("Eventcount >= threshold")
self.make_callback(kind="event") | def notify(self, event_id):
"""Let the FlowControl system know that there is an event."""
self._event_buffer.extend([event_id])
self._event_count += 1
if self._event_count >= self.threshold:
logger.debug("Eventcount >= threshold")
self.make_callback(kind="event") | [
"Let",
"the",
"FlowControl",
"system",
"know",
"that",
"there",
"is",
"an",
"event",
"."
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/dataflow/flow_control.py#L123-L129 | [
"def",
"notify",
"(",
"self",
",",
"event_id",
")",
":",
"self",
".",
"_event_buffer",
".",
"extend",
"(",
"[",
"event_id",
"]",
")",
"self",
".",
"_event_count",
"+=",
"1",
"if",
"self",
".",
"_event_count",
">=",
"self",
".",
"threshold",
":",
"logge... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | FlowControl.make_callback | Makes the callback and resets the timer.
KWargs:
- kind (str): Default=None, used to pass information on what
triggered the callback | parsl/dataflow/flow_control.py | def make_callback(self, kind=None):
"""Makes the callback and resets the timer.
KWargs:
- kind (str): Default=None, used to pass information on what
triggered the callback
"""
self._wake_up_time = time.time() + self.interval
self.callback(tasks=se... | def make_callback(self, kind=None):
"""Makes the callback and resets the timer.
KWargs:
- kind (str): Default=None, used to pass information on what
triggered the callback
"""
self._wake_up_time = time.time() + self.interval
self.callback(tasks=se... | [
"Makes",
"the",
"callback",
"and",
"resets",
"the",
"timer",
"."
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/dataflow/flow_control.py#L131-L140 | [
"def",
"make_callback",
"(",
"self",
",",
"kind",
"=",
"None",
")",
":",
"self",
".",
"_wake_up_time",
"=",
"time",
".",
"time",
"(",
")",
"+",
"self",
".",
"interval",
"self",
".",
"callback",
"(",
"tasks",
"=",
"self",
".",
"_event_buffer",
",",
"k... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | Timer.make_callback | Makes the callback and resets the timer. | parsl/dataflow/flow_control.py | def make_callback(self, kind=None):
"""Makes the callback and resets the timer.
"""
self._wake_up_time = time.time() + self.interval
self.callback(*self.cb_args) | def make_callback(self, kind=None):
"""Makes the callback and resets the timer.
"""
self._wake_up_time = time.time() + self.interval
self.callback(*self.cb_args) | [
"Makes",
"the",
"callback",
"and",
"resets",
"the",
"timer",
"."
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/dataflow/flow_control.py#L214-L218 | [
"def",
"make_callback",
"(",
"self",
",",
"kind",
"=",
"None",
")",
":",
"self",
".",
"_wake_up_time",
"=",
"time",
".",
"time",
"(",
")",
"+",
"self",
".",
"interval",
"self",
".",
"callback",
"(",
"*",
"self",
".",
"cb_args",
")"
] | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | address_by_interface | Returns the IP address of the given interface name, e.g. 'eth0'
Parameters
----------
ifname : str
Name of the interface whose address is to be returned. Required.
Taken from this Stack Overflow answer: https://stackoverflow.com/questions/24196932/how-can-i-get-the-ip-address-of-eth0-in-python... | parsl/addresses.py | def address_by_interface(ifname):
"""Returns the IP address of the given interface name, e.g. 'eth0'
Parameters
----------
ifname : str
Name of the interface whose address is to be returned. Required.
Taken from this Stack Overflow answer: https://stackoverflow.com/questions/24196932/how-c... | def address_by_interface(ifname):
"""Returns the IP address of the given interface name, e.g. 'eth0'
Parameters
----------
ifname : str
Name of the interface whose address is to be returned. Required.
Taken from this Stack Overflow answer: https://stackoverflow.com/questions/24196932/how-c... | [
"Returns",
"the",
"IP",
"address",
"of",
"the",
"given",
"interface",
"name",
"e",
".",
"g",
".",
"eth0"
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/addresses.py#L33-L48 | [
"def",
"address_by_interface",
"(",
"ifname",
")",
":",
"s",
"=",
"socket",
".",
"socket",
"(",
"socket",
".",
"AF_INET",
",",
"socket",
".",
"SOCK_DGRAM",
")",
"return",
"socket",
".",
"inet_ntoa",
"(",
"fcntl",
".",
"ioctl",
"(",
"s",
".",
"fileno",
... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | KubernetesProvider.submit | Submit a job
Args:
- cmd_string :(String) - Name of the container to initiate
- blocksize :(float) - Number of replicas
- tasks_per_node (int) : command invocations to be launched per node
Kwargs:
- job_name (String): Name for job, must be unique
... | parsl/providers/kubernetes/kube.py | def submit(self, cmd_string, blocksize, tasks_per_node, job_name="parsl"):
""" Submit a job
Args:
- cmd_string :(String) - Name of the container to initiate
- blocksize :(float) - Number of replicas
- tasks_per_node (int) : command invocations to be launched per... | def submit(self, cmd_string, blocksize, tasks_per_node, job_name="parsl"):
""" Submit a job
Args:
- cmd_string :(String) - Name of the container to initiate
- blocksize :(float) - Number of replicas
- tasks_per_node (int) : command invocations to be launched per... | [
"Submit",
"a",
"job",
"Args",
":",
"-",
"cmd_string",
":",
"(",
"String",
")",
"-",
"Name",
"of",
"the",
"container",
"to",
"initiate",
"-",
"blocksize",
":",
"(",
"float",
")",
"-",
"Number",
"of",
"replicas",
"-",
"tasks_per_node",
"(",
"int",
")",
... | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/providers/kubernetes/kube.py#L100-L137 | [
"def",
"submit",
"(",
"self",
",",
"cmd_string",
",",
"blocksize",
",",
"tasks_per_node",
",",
"job_name",
"=",
"\"parsl\"",
")",
":",
"if",
"not",
"self",
".",
"resources",
":",
"cur_timestamp",
"=",
"str",
"(",
"time",
".",
"time",
"(",
")",
"*",
"10... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | KubernetesProvider._create_deployment_object | Create a kubernetes deployment for the job.
Args:
- job_name (string) : Name of the job and deployment
- job_image (string) : Docker image to launch
KWargs:
- port (integer) : Container port
- replicas : Number of replica containers to maintain
... | parsl/providers/kubernetes/kube.py | def _create_deployment_object(self, job_name, job_image,
deployment_name, port=80,
replicas=1,
cmd_string=None,
engine_json_file='~/.ipython/profile_default/security/ipcontroller-engin... | def _create_deployment_object(self, job_name, job_image,
deployment_name, port=80,
replicas=1,
cmd_string=None,
engine_json_file='~/.ipython/profile_default/security/ipcontroller-engin... | [
"Create",
"a",
"kubernetes",
"deployment",
"for",
"the",
"job",
".",
"Args",
":",
"-",
"job_name",
"(",
"string",
")",
":",
"Name",
"of",
"the",
"job",
"and",
"deployment",
"-",
"job_image",
"(",
"string",
")",
":",
"Docker",
"image",
"to",
"launch",
"... | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/providers/kubernetes/kube.py#L184-L272 | [
"def",
"_create_deployment_object",
"(",
"self",
",",
"job_name",
",",
"job_image",
",",
"deployment_name",
",",
"port",
"=",
"80",
",",
"replicas",
"=",
"1",
",",
"cmd_string",
"=",
"None",
",",
"engine_json_file",
"=",
"'~/.ipython/profile_default/security/ipcontr... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | KubernetesProvider._create_deployment | Create the kubernetes deployment | parsl/providers/kubernetes/kube.py | def _create_deployment(self, deployment):
""" Create the kubernetes deployment """
api_response = self.kube_client.create_namespaced_deployment(
body=deployment,
namespace=self.namespace)
logger.debug("Deployment created. status='{0}'".format(str(api_response.status))) | def _create_deployment(self, deployment):
""" Create the kubernetes deployment """
api_response = self.kube_client.create_namespaced_deployment(
body=deployment,
namespace=self.namespace)
logger.debug("Deployment created. status='{0}'".format(str(api_response.status))) | [
"Create",
"the",
"kubernetes",
"deployment"
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/providers/kubernetes/kube.py#L274-L281 | [
"def",
"_create_deployment",
"(",
"self",
",",
"deployment",
")",
":",
"api_response",
"=",
"self",
".",
"kube_client",
".",
"create_namespaced_deployment",
"(",
"body",
"=",
"deployment",
",",
"namespace",
"=",
"self",
".",
"namespace",
")",
"logger",
".",
"d... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | KubernetesProvider._delete_deployment | Delete deployment | parsl/providers/kubernetes/kube.py | def _delete_deployment(self, deployment_name):
""" Delete deployment """
api_response = self.kube_client.delete_namespaced_deployment(
name=deployment_name,
namespace=self.namespace,
body=client.V1DeleteOptions(
propagation_policy='Foreground',
... | def _delete_deployment(self, deployment_name):
""" Delete deployment """
api_response = self.kube_client.delete_namespaced_deployment(
name=deployment_name,
namespace=self.namespace,
body=client.V1DeleteOptions(
propagation_policy='Foreground',
... | [
"Delete",
"deployment"
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/providers/kubernetes/kube.py#L283-L294 | [
"def",
"_delete_deployment",
"(",
"self",
",",
"deployment_name",
")",
":",
"api_response",
"=",
"self",
".",
"kube_client",
".",
"delete_namespaced_deployment",
"(",
"name",
"=",
"deployment_name",
",",
"namespace",
"=",
"self",
".",
"namespace",
",",
"body",
"... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | HighThroughputExecutor.initialize_scaling | Compose the launch command and call the scale_out
This should be implemented in the child classes to take care of
executor specific oddities. | parsl/executors/high_throughput/executor.py | def initialize_scaling(self):
""" Compose the launch command and call the scale_out
This should be implemented in the child classes to take care of
executor specific oddities.
"""
debug_opts = "--debug" if self.worker_debug else ""
max_workers = "" if self.max_workers ==... | def initialize_scaling(self):
""" Compose the launch command and call the scale_out
This should be implemented in the child classes to take care of
executor specific oddities.
"""
debug_opts = "--debug" if self.worker_debug else ""
max_workers = "" if self.max_workers ==... | [
"Compose",
"the",
"launch",
"command",
"and",
"call",
"the",
"scale_out"
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/high_throughput/executor.py#L205-L239 | [
"def",
"initialize_scaling",
"(",
"self",
")",
":",
"debug_opts",
"=",
"\"--debug\"",
"if",
"self",
".",
"worker_debug",
"else",
"\"\"",
"max_workers",
"=",
"\"\"",
"if",
"self",
".",
"max_workers",
"==",
"float",
"(",
"'inf'",
")",
"else",
"\"--max_workers={}... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | HighThroughputExecutor.start | Create the Interchange process and connect to it. | parsl/executors/high_throughput/executor.py | def start(self):
"""Create the Interchange process and connect to it.
"""
self.outgoing_q = zmq_pipes.TasksOutgoing("127.0.0.1", self.interchange_port_range)
self.incoming_q = zmq_pipes.ResultsIncoming("127.0.0.1", self.interchange_port_range)
self.command_client = zmq_pipes.Comm... | def start(self):
"""Create the Interchange process and connect to it.
"""
self.outgoing_q = zmq_pipes.TasksOutgoing("127.0.0.1", self.interchange_port_range)
self.incoming_q = zmq_pipes.ResultsIncoming("127.0.0.1", self.interchange_port_range)
self.command_client = zmq_pipes.Comm... | [
"Create",
"the",
"Interchange",
"process",
"and",
"connect",
"to",
"it",
"."
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/high_throughput/executor.py#L241-L262 | [
"def",
"start",
"(",
"self",
")",
":",
"self",
".",
"outgoing_q",
"=",
"zmq_pipes",
".",
"TasksOutgoing",
"(",
"\"127.0.0.1\"",
",",
"self",
".",
"interchange_port_range",
")",
"self",
".",
"incoming_q",
"=",
"zmq_pipes",
".",
"ResultsIncoming",
"(",
"\"127.0.... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | HighThroughputExecutor._queue_management_worker | Listen to the queue for task status messages and handle them.
Depending on the message, tasks will be updated with results, exceptions,
or updates. It expects the following messages:
.. code:: python
{
"task_id" : <task_id>
"result" : serialized resu... | parsl/executors/high_throughput/executor.py | def _queue_management_worker(self):
"""Listen to the queue for task status messages and handle them.
Depending on the message, tasks will be updated with results, exceptions,
or updates. It expects the following messages:
.. code:: python
{
"task_id" : <task... | def _queue_management_worker(self):
"""Listen to the queue for task status messages and handle them.
Depending on the message, tasks will be updated with results, exceptions,
or updates. It expects the following messages:
.. code:: python
{
"task_id" : <task... | [
"Listen",
"to",
"the",
"queue",
"for",
"task",
"status",
"messages",
"and",
"handle",
"them",
"."
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/high_throughput/executor.py#L264-L369 | [
"def",
"_queue_management_worker",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"[MTHREAD] queue management worker starting\"",
")",
"while",
"not",
"self",
".",
"_executor_bad_state",
".",
"is_set",
"(",
")",
":",
"try",
":",
"msgs",
"=",
"self",
".",
... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | HighThroughputExecutor._start_local_queue_process | Starts the interchange process locally
Starts the interchange process locally and uses an internal command queue to
get the worker task and result ports that the interchange has bound to. | parsl/executors/high_throughput/executor.py | def _start_local_queue_process(self):
""" Starts the interchange process locally
Starts the interchange process locally and uses an internal command queue to
get the worker task and result ports that the interchange has bound to.
"""
comm_q = Queue(maxsize=10)
self.queue... | def _start_local_queue_process(self):
""" Starts the interchange process locally
Starts the interchange process locally and uses an internal command queue to
get the worker task and result ports that the interchange has bound to.
"""
comm_q = Queue(maxsize=10)
self.queue... | [
"Starts",
"the",
"interchange",
"process",
"locally"
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/high_throughput/executor.py#L377-L406 | [
"def",
"_start_local_queue_process",
"(",
"self",
")",
":",
"comm_q",
"=",
"Queue",
"(",
"maxsize",
"=",
"10",
")",
"self",
".",
"queue_proc",
"=",
"Process",
"(",
"target",
"=",
"interchange",
".",
"starter",
",",
"args",
"=",
"(",
"comm_q",
",",
")",
... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | HighThroughputExecutor.hold_worker | Puts a worker on hold, preventing scheduling of additional tasks to it.
This is called "hold" mostly because this only stops scheduling of tasks,
and does not actually kill the worker.
Parameters
----------
worker_id : str
Worker id to be put on hold | parsl/executors/high_throughput/executor.py | def hold_worker(self, worker_id):
"""Puts a worker on hold, preventing scheduling of additional tasks to it.
This is called "hold" mostly because this only stops scheduling of tasks,
and does not actually kill the worker.
Parameters
----------
worker_id : str
... | def hold_worker(self, worker_id):
"""Puts a worker on hold, preventing scheduling of additional tasks to it.
This is called "hold" mostly because this only stops scheduling of tasks,
and does not actually kill the worker.
Parameters
----------
worker_id : str
... | [
"Puts",
"a",
"worker",
"on",
"hold",
"preventing",
"scheduling",
"of",
"additional",
"tasks",
"to",
"it",
"."
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/high_throughput/executor.py#L424-L438 | [
"def",
"hold_worker",
"(",
"self",
",",
"worker_id",
")",
":",
"c",
"=",
"self",
".",
"command_client",
".",
"run",
"(",
"\"HOLD_WORKER;{}\"",
".",
"format",
"(",
"worker_id",
")",
")",
"logger",
".",
"debug",
"(",
"\"Sent hold request to worker: {}\"",
".",
... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | HighThroughputExecutor._hold_block | Sends hold command to all managers which are in a specific block
Parameters
----------
block_id : str
Block identifier of the block to be put on hold | parsl/executors/high_throughput/executor.py | def _hold_block(self, block_id):
""" Sends hold command to all managers which are in a specific block
Parameters
----------
block_id : str
Block identifier of the block to be put on hold
"""
managers = self.connected_managers
for manager in manager... | def _hold_block(self, block_id):
""" Sends hold command to all managers which are in a specific block
Parameters
----------
block_id : str
Block identifier of the block to be put on hold
"""
managers = self.connected_managers
for manager in manager... | [
"Sends",
"hold",
"command",
"to",
"all",
"managers",
"which",
"are",
"in",
"a",
"specific",
"block"
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/high_throughput/executor.py#L456-L470 | [
"def",
"_hold_block",
"(",
"self",
",",
"block_id",
")",
":",
"managers",
"=",
"self",
".",
"connected_managers",
"for",
"manager",
"in",
"managers",
":",
"if",
"manager",
"[",
"'block_id'",
"]",
"==",
"block_id",
":",
"logger",
".",
"debug",
"(",
"\"[HOLD... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | HighThroughputExecutor.scale_out | Scales out the number of blocks by "blocks"
Raises:
NotImplementedError | parsl/executors/high_throughput/executor.py | def scale_out(self, blocks=1):
"""Scales out the number of blocks by "blocks"
Raises:
NotImplementedError
"""
r = []
for i in range(blocks):
if self.provider:
external_block_id = str(len(self.blocks))
launch_cmd = self.lau... | def scale_out(self, blocks=1):
"""Scales out the number of blocks by "blocks"
Raises:
NotImplementedError
"""
r = []
for i in range(blocks):
if self.provider:
external_block_id = str(len(self.blocks))
launch_cmd = self.lau... | [
"Scales",
"out",
"the",
"number",
"of",
"blocks",
"by",
"blocks"
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/high_throughput/executor.py#L516-L537 | [
"def",
"scale_out",
"(",
"self",
",",
"blocks",
"=",
"1",
")",
":",
"r",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"blocks",
")",
":",
"if",
"self",
".",
"provider",
":",
"external_block_id",
"=",
"str",
"(",
"len",
"(",
"self",
".",
"blocks... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | HighThroughputExecutor.scale_in | Scale in the number of active blocks by specified amount.
The scale in method here is very rude. It doesn't give the workers
the opportunity to finish current tasks or cleanup. This is tracked
in issue #530
Parameters
----------
blocks : int
Number of bloc... | parsl/executors/high_throughput/executor.py | def scale_in(self, blocks=None, block_ids=[]):
"""Scale in the number of active blocks by specified amount.
The scale in method here is very rude. It doesn't give the workers
the opportunity to finish current tasks or cleanup. This is tracked
in issue #530
Parameters
--... | def scale_in(self, blocks=None, block_ids=[]):
"""Scale in the number of active blocks by specified amount.
The scale in method here is very rude. It doesn't give the workers
the opportunity to finish current tasks or cleanup. This is tracked
in issue #530
Parameters
--... | [
"Scale",
"in",
"the",
"number",
"of",
"active",
"blocks",
"by",
"specified",
"amount",
"."
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/high_throughput/executor.py#L539-L574 | [
"def",
"scale_in",
"(",
"self",
",",
"blocks",
"=",
"None",
",",
"block_ids",
"=",
"[",
"]",
")",
":",
"if",
"block_ids",
":",
"block_ids_to_kill",
"=",
"block_ids",
"else",
":",
"block_ids_to_kill",
"=",
"list",
"(",
"self",
".",
"blocks",
".",
"keys",
... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | HighThroughputExecutor.status | Return status of all blocks. | parsl/executors/high_throughput/executor.py | def status(self):
"""Return status of all blocks."""
status = []
if self.provider:
status = self.provider.status(self.blocks.values())
return status | def status(self):
"""Return status of all blocks."""
status = []
if self.provider:
status = self.provider.status(self.blocks.values())
return status | [
"Return",
"status",
"of",
"all",
"blocks",
"."
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/high_throughput/executor.py#L576-L583 | [
"def",
"status",
"(",
"self",
")",
":",
"status",
"=",
"[",
"]",
"if",
"self",
".",
"provider",
":",
"status",
"=",
"self",
".",
"provider",
".",
"status",
"(",
"self",
".",
"blocks",
".",
"values",
"(",
")",
")",
"return",
"status"
] | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | HighThroughputExecutor.shutdown | Shutdown the executor, including all workers and controllers.
This is not implemented.
Kwargs:
- hub (Bool): Whether the hub should be shutdown, Default:True,
- targets (list of ints| 'all'): List of block id's to kill, Default:'all'
- block (Bool): To block for con... | parsl/executors/high_throughput/executor.py | def shutdown(self, hub=True, targets='all', block=False):
"""Shutdown the executor, including all workers and controllers.
This is not implemented.
Kwargs:
- hub (Bool): Whether the hub should be shutdown, Default:True,
- targets (list of ints| 'all'): List of block id'... | def shutdown(self, hub=True, targets='all', block=False):
"""Shutdown the executor, including all workers and controllers.
This is not implemented.
Kwargs:
- hub (Bool): Whether the hub should be shutdown, Default:True,
- targets (list of ints| 'all'): List of block id'... | [
"Shutdown",
"the",
"executor",
"including",
"all",
"workers",
"and",
"controllers",
"."
] | Parsl/parsl | python | https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/high_throughput/executor.py#L585-L604 | [
"def",
"shutdown",
"(",
"self",
",",
"hub",
"=",
"True",
",",
"targets",
"=",
"'all'",
",",
"block",
"=",
"False",
")",
":",
"logger",
".",
"info",
"(",
"\"Attempting HighThroughputExecutor shutdown\"",
")",
"# self.outgoing_q.close()",
"# self.incoming_q.close()",
... | d7afb3bc37f50dcf224ae78637944172edb35dac |
valid | I2CDevice.readinto | Read into ``buf`` from the device. The number of bytes read will be the
length of ``buf``.
If ``start`` or ``end`` is provided, then the buffer will be sliced
as if ``buf[start:end]``. This will not cause an allocation like
``buf[start:end]`` will so it saves memory.
:param byt... | adafruit_bus_device/i2c_device.py | def readinto(self, buf, **kwargs):
"""
Read into ``buf`` from the device. The number of bytes read will be the
length of ``buf``.
If ``start`` or ``end`` is provided, then the buffer will be sliced
as if ``buf[start:end]``. This will not cause an allocation like
``buf[st... | def readinto(self, buf, **kwargs):
"""
Read into ``buf`` from the device. The number of bytes read will be the
length of ``buf``.
If ``start`` or ``end`` is provided, then the buffer will be sliced
as if ``buf[start:end]``. This will not cause an allocation like
``buf[st... | [
"Read",
"into",
"buf",
"from",
"the",
"device",
".",
"The",
"number",
"of",
"bytes",
"read",
"will",
"be",
"the",
"length",
"of",
"buf",
"."
] | adafruit/Adafruit_CircuitPython_BusDevice | python | https://github.com/adafruit/Adafruit_CircuitPython_BusDevice/blob/8a5b9974cda321771941f2e69513c9cee13e07fb/adafruit_bus_device/i2c_device.py#L84-L99 | [
"def",
"readinto",
"(",
"self",
",",
"buf",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"i2c",
".",
"readfrom_into",
"(",
"self",
".",
"device_address",
",",
"buf",
",",
"*",
"*",
"kwargs",
")",
"if",
"self",
".",
"_debug",
":",
"print",
"(",
... | 8a5b9974cda321771941f2e69513c9cee13e07fb |
valid | I2CDevice.write | Write the bytes from ``buffer`` to the device. Transmits a stop bit if
``stop`` is set.
If ``start`` or ``end`` is provided, then the buffer will be sliced
as if ``buffer[start:end]``. This will not cause an allocation like
``buffer[start:end]`` will so it saves memory.
:param ... | adafruit_bus_device/i2c_device.py | def write(self, buf, **kwargs):
"""
Write the bytes from ``buffer`` to the device. Transmits a stop bit if
``stop`` is set.
If ``start`` or ``end`` is provided, then the buffer will be sliced
as if ``buffer[start:end]``. This will not cause an allocation like
``buffer[st... | def write(self, buf, **kwargs):
"""
Write the bytes from ``buffer`` to the device. Transmits a stop bit if
``stop`` is set.
If ``start`` or ``end`` is provided, then the buffer will be sliced
as if ``buffer[start:end]``. This will not cause an allocation like
``buffer[st... | [
"Write",
"the",
"bytes",
"from",
"buffer",
"to",
"the",
"device",
".",
"Transmits",
"a",
"stop",
"bit",
"if",
"stop",
"is",
"set",
"."
] | adafruit/Adafruit_CircuitPython_BusDevice | python | https://github.com/adafruit/Adafruit_CircuitPython_BusDevice/blob/8a5b9974cda321771941f2e69513c9cee13e07fb/adafruit_bus_device/i2c_device.py#L101-L117 | [
"def",
"write",
"(",
"self",
",",
"buf",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"i2c",
".",
"writeto",
"(",
"self",
".",
"device_address",
",",
"buf",
",",
"*",
"*",
"kwargs",
")",
"if",
"self",
".",
"_debug",
":",
"print",
"(",
"\"i2c_d... | 8a5b9974cda321771941f2e69513c9cee13e07fb |
valid | I2CDevice.write_then_readinto | Write the bytes from ``out_buffer`` to the device, then immediately
reads into ``in_buffer`` from the device. The number of bytes read
will be the length of ``in_buffer``.
Transmits a stop bit after the write, if ``stop`` is set.
If ``out_start`` or ``out_end`` is provided, then the out... | adafruit_bus_device/i2c_device.py | def write_then_readinto(self, out_buffer, in_buffer, *,
out_start=0, out_end=None, in_start=0, in_end=None, stop=True):
"""
Write the bytes from ``out_buffer`` to the device, then immediately
reads into ``in_buffer`` from the device. The number of bytes read
w... | def write_then_readinto(self, out_buffer, in_buffer, *,
out_start=0, out_end=None, in_start=0, in_end=None, stop=True):
"""
Write the bytes from ``out_buffer`` to the device, then immediately
reads into ``in_buffer`` from the device. The number of bytes read
w... | [
"Write",
"the",
"bytes",
"from",
"out_buffer",
"to",
"the",
"device",
"then",
"immediately",
"reads",
"into",
"in_buffer",
"from",
"the",
"device",
".",
"The",
"number",
"of",
"bytes",
"read",
"will",
"be",
"the",
"length",
"of",
"in_buffer",
".",
"Transmits... | adafruit/Adafruit_CircuitPython_BusDevice | python | https://github.com/adafruit/Adafruit_CircuitPython_BusDevice/blob/8a5b9974cda321771941f2e69513c9cee13e07fb/adafruit_bus_device/i2c_device.py#L120-L170 | [
"def",
"write_then_readinto",
"(",
"self",
",",
"out_buffer",
",",
"in_buffer",
",",
"*",
",",
"out_start",
"=",
"0",
",",
"out_end",
"=",
"None",
",",
"in_start",
"=",
"0",
",",
"in_end",
"=",
"None",
",",
"stop",
"=",
"True",
")",
":",
"if",
"out_e... | 8a5b9974cda321771941f2e69513c9cee13e07fb |
valid | read_sample | !
@brief Returns data sample from simple text file.
@details This function should be used for text file with following format:
@code
point_1_coord_1 point_1_coord_2 ... point_1_coord_n
point_2_coord_1 point_2_coord_2 ... point_2_coord_n
... ...
@endcode
@param[in] filename ... | pyclustering/utils/__init__.py | def read_sample(filename):
"""!
@brief Returns data sample from simple text file.
@details This function should be used for text file with following format:
@code
point_1_coord_1 point_1_coord_2 ... point_1_coord_n
point_2_coord_1 point_2_coord_2 ... point_2_coord_n
... ...
@endc... | def read_sample(filename):
"""!
@brief Returns data sample from simple text file.
@details This function should be used for text file with following format:
@code
point_1_coord_1 point_1_coord_2 ... point_1_coord_n
point_2_coord_1 point_2_coord_2 ... point_2_coord_n
... ...
@endc... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L54-L75 | [
"def",
"read_sample",
"(",
"filename",
")",
":",
"file",
"=",
"open",
"(",
"filename",
",",
"'r'",
")",
"sample",
"=",
"[",
"[",
"float",
"(",
"val",
")",
"for",
"val",
"in",
"line",
".",
"split",
"(",
")",
"]",
"for",
"line",
"in",
"file",
"if",... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | calculate_distance_matrix | !
@brief Calculates distance matrix for data sample (sequence of points) using Euclidean distance as a metric.
@param[in] sample (array_like): Data points that are used for distance calculation.
@return (list) Matrix distance between data points. | pyclustering/utils/__init__.py | def calculate_distance_matrix(sample):
"""!
@brief Calculates distance matrix for data sample (sequence of points) using Euclidean distance as a metric.
@param[in] sample (array_like): Data points that are used for distance calculation.
@return (list) Matrix distance between data points.
... | def calculate_distance_matrix(sample):
"""!
@brief Calculates distance matrix for data sample (sequence of points) using Euclidean distance as a metric.
@param[in] sample (array_like): Data points that are used for distance calculation.
@return (list) Matrix distance between data points.
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L78-L89 | [
"def",
"calculate_distance_matrix",
"(",
"sample",
")",
":",
"amount_rows",
"=",
"len",
"(",
"sample",
")",
"return",
"[",
"[",
"euclidean_distance",
"(",
"sample",
"[",
"i",
"]",
",",
"sample",
"[",
"j",
"]",
")",
"for",
"j",
"in",
"range",
"(",
"amou... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | read_image | !
@brief Returns image as N-dimension (depends on the input image) matrix, where one element of list describes pixel.
@param[in] filename (string): Path to image.
@return (list) Pixels where each pixel described by list of RGB-values. | pyclustering/utils/__init__.py | def read_image(filename):
"""!
@brief Returns image as N-dimension (depends on the input image) matrix, where one element of list describes pixel.
@param[in] filename (string): Path to image.
@return (list) Pixels where each pixel described by list of RGB-values.
"""
... | def read_image(filename):
"""!
@brief Returns image as N-dimension (depends on the input image) matrix, where one element of list describes pixel.
@param[in] filename (string): Path to image.
@return (list) Pixels where each pixel described by list of RGB-values.
"""
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L92-L104 | [
"def",
"read_image",
"(",
"filename",
")",
":",
"with",
"Image",
".",
"open",
"(",
"filename",
")",
"as",
"image_source",
":",
"data",
"=",
"[",
"list",
"(",
"pixel",
")",
"for",
"pixel",
"in",
"image_source",
".",
"getdata",
"(",
")",
"]",
"return",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | rgb2gray | !
@brief Returns image as 1-dimension (gray colored) matrix, where one element of list describes pixel.
@details Luma coding is used for transformation and that is calculated directly from gamma-compressed primary intensities as a weighted sum:
\f[Y = 0.2989R + 0.587G + 0.114B\f]
@param[... | pyclustering/utils/__init__.py | def rgb2gray(image_rgb_array):
"""!
@brief Returns image as 1-dimension (gray colored) matrix, where one element of list describes pixel.
@details Luma coding is used for transformation and that is calculated directly from gamma-compressed primary intensities as a weighted sum:
\f[Y = 0.2989R ... | def rgb2gray(image_rgb_array):
"""!
@brief Returns image as 1-dimension (gray colored) matrix, where one element of list describes pixel.
@details Luma coding is used for transformation and that is calculated directly from gamma-compressed primary intensities as a weighted sum:
\f[Y = 0.2989R ... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L107-L131 | [
"def",
"rgb2gray",
"(",
"image_rgb_array",
")",
":",
"image_gray_array",
"=",
"[",
"0.0",
"]",
"*",
"len",
"(",
"image_rgb_array",
")",
"for",
"index",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"image_rgb_array",
")",
",",
"1",
")",
":",
"image_gray_arra... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | stretch_pattern | !
@brief Returns stretched content as 1-dimension (gray colored) matrix with size of input image.
@param[in] image_source (Image): PIL Image instance.
@return (list, Image) Stretched image as gray colored matrix and source image. | pyclustering/utils/__init__.py | def stretch_pattern(image_source):
"""!
@brief Returns stretched content as 1-dimension (gray colored) matrix with size of input image.
@param[in] image_source (Image): PIL Image instance.
@return (list, Image) Stretched image as gray colored matrix and source image.
"""
... | def stretch_pattern(image_source):
"""!
@brief Returns stretched content as 1-dimension (gray colored) matrix with size of input image.
@param[in] image_source (Image): PIL Image instance.
@return (list, Image) Stretched image as gray colored matrix and source image.
"""
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L134-L156 | [
"def",
"stretch_pattern",
"(",
"image_source",
")",
":",
"wsize",
",",
"hsize",
"=",
"image_source",
".",
"size",
"# Crop digit exactly\r",
"(",
"ws",
",",
"hs",
",",
"we",
",",
"he",
")",
"=",
"gray_pattern_borders",
"(",
"image_source",
")",
"image_source",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | gray_pattern_borders | !
@brief Returns coordinates of gray image content on the input image.
@param[in] image (Image): PIL Image instance that is processed.
@return (tuple) Returns coordinates of gray image content as (width_start, height_start, width_end, height_end). | pyclustering/utils/__init__.py | def gray_pattern_borders(image):
"""!
@brief Returns coordinates of gray image content on the input image.
@param[in] image (Image): PIL Image instance that is processed.
@return (tuple) Returns coordinates of gray image content as (width_start, height_start, width_end, height_end).
... | def gray_pattern_borders(image):
"""!
@brief Returns coordinates of gray image content on the input image.
@param[in] image (Image): PIL Image instance that is processed.
@return (tuple) Returns coordinates of gray image content as (width_start, height_start, width_end, height_end).
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L159-L198 | [
"def",
"gray_pattern_borders",
"(",
"image",
")",
":",
"width",
",",
"height",
"=",
"image",
".",
"size",
"width_start",
"=",
"width",
"width_end",
"=",
"0",
"height_start",
"=",
"height",
"height_end",
"=",
"0",
"row",
",",
"col",
"=",
"0",
",",
"0",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | average_neighbor_distance | !
@brief Returns average distance for establish links between specified number of nearest neighbors.
@param[in] points (list): Input data, list of points where each point represented by list.
@param[in] num_neigh (uint): Number of neighbors that should be used for distance calculation.
@... | pyclustering/utils/__init__.py | def average_neighbor_distance(points, num_neigh):
"""!
@brief Returns average distance for establish links between specified number of nearest neighbors.
@param[in] points (list): Input data, list of points where each point represented by list.
@param[in] num_neigh (uint): Number of neighbors ... | def average_neighbor_distance(points, num_neigh):
"""!
@brief Returns average distance for establish links between specified number of nearest neighbors.
@param[in] points (list): Input data, list of points where each point represented by list.
@param[in] num_neigh (uint): Number of neighbors ... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L201-L230 | [
"def",
"average_neighbor_distance",
"(",
"points",
",",
"num_neigh",
")",
":",
"if",
"num_neigh",
">",
"len",
"(",
"points",
")",
"-",
"1",
":",
"raise",
"NameError",
"(",
"'Impossible to calculate average distance to neighbors when number of object is less than number of n... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | medoid | !
@brief Calculate medoid for input points using Euclidean distance.
@param[in] data (list): Set of points for that median should be calculated.
@param[in] indexes (list): Indexes of input set of points that will be taken into account during median calculation.
@param[in] **kwargs: Arbitrary k... | pyclustering/utils/__init__.py | def medoid(data, indexes=None, **kwargs):
"""!
@brief Calculate medoid for input points using Euclidean distance.
@param[in] data (list): Set of points for that median should be calculated.
@param[in] indexes (list): Indexes of input set of points that will be taken into account during median ... | def medoid(data, indexes=None, **kwargs):
"""!
@brief Calculate medoid for input points using Euclidean distance.
@param[in] data (list): Set of points for that median should be calculated.
@param[in] indexes (list): Indexes of input set of points that will be taken into account during median ... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L233-L280 | [
"def",
"medoid",
"(",
"data",
",",
"indexes",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"index_median",
"=",
"None",
"distance",
"=",
"float",
"(",
"'Inf'",
")",
"metric",
"=",
"kwargs",
".",
"get",
"(",
"'metric'",
",",
"type_metric",
".",
"EU... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | euclidean_distance_square | !
@brief Calculate square Euclidian distance between vector a and b.
@param[in] a (list): The first vector.
@param[in] b (list): The second vector.
@return (double) Square Euclidian distance between two vectors. | pyclustering/utils/__init__.py | def euclidean_distance_square(a, b):
"""!
@brief Calculate square Euclidian distance between vector a and b.
@param[in] a (list): The first vector.
@param[in] b (list): The second vector.
@return (double) Square Euclidian distance between two vectors.
"""
if ... | def euclidean_distance_square(a, b):
"""!
@brief Calculate square Euclidian distance between vector a and b.
@param[in] a (list): The first vector.
@param[in] b (list): The second vector.
@return (double) Square Euclidian distance between two vectors.
"""
if ... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L307-L325 | [
"def",
"euclidean_distance_square",
"(",
"a",
",",
"b",
")",
":",
"if",
"(",
"(",
"(",
"type",
"(",
"a",
")",
"==",
"float",
")",
"and",
"(",
"type",
"(",
"b",
")",
"==",
"float",
")",
")",
"or",
"(",
"(",
"type",
"(",
"a",
")",
"==",
"int",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | manhattan_distance | !
@brief Calculate Manhattan distance between vector a and b.
@param[in] a (list): The first cluster.
@param[in] b (list): The second cluster.
@return (double) Manhattan distance between two vectors. | pyclustering/utils/__init__.py | def manhattan_distance(a, b):
"""!
@brief Calculate Manhattan distance between vector a and b.
@param[in] a (list): The first cluster.
@param[in] b (list): The second cluster.
@return (double) Manhattan distance between two vectors.
"""
if ( ((type(a) == float)... | def manhattan_distance(a, b):
"""!
@brief Calculate Manhattan distance between vector a and b.
@param[in] a (list): The first cluster.
@param[in] b (list): The second cluster.
@return (double) Manhattan distance between two vectors.
"""
if ( ((type(a) == float)... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L328-L348 | [
"def",
"manhattan_distance",
"(",
"a",
",",
"b",
")",
":",
"if",
"(",
"(",
"(",
"type",
"(",
"a",
")",
"==",
"float",
")",
"and",
"(",
"type",
"(",
"b",
")",
"==",
"float",
")",
")",
"or",
"(",
"(",
"type",
"(",
"a",
")",
"==",
"int",
")",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | average_inter_cluster_distance | !
@brief Calculates average inter-cluster distance between two clusters.
@details Clusters can be represented by list of coordinates (in this case data shouldn't be specified),
or by list of indexes of points from the data (represented by list of points), in this case
data should ... | pyclustering/utils/__init__.py | def average_inter_cluster_distance(cluster1, cluster2, data = None):
"""!
@brief Calculates average inter-cluster distance between two clusters.
@details Clusters can be represented by list of coordinates (in this case data shouldn't be specified),
or by list of indexes of points from the d... | def average_inter_cluster_distance(cluster1, cluster2, data = None):
"""!
@brief Calculates average inter-cluster distance between two clusters.
@details Clusters can be represented by list of coordinates (in this case data shouldn't be specified),
or by list of indexes of points from the d... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L351-L379 | [
"def",
"average_inter_cluster_distance",
"(",
"cluster1",
",",
"cluster2",
",",
"data",
"=",
"None",
")",
":",
"distance",
"=",
"0.0",
"if",
"(",
"data",
"is",
"None",
")",
":",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"cluster1",
")",
")",
":",
"... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | average_intra_cluster_distance | !
@brief Calculates average intra-cluster distance between two clusters.
@details Clusters can be represented by list of coordinates (in this case data shouldn't be specified),
or by list of indexes of points from the data (represented by list of points), in this case
data should ... | pyclustering/utils/__init__.py | def average_intra_cluster_distance(cluster1, cluster2, data=None):
"""!
@brief Calculates average intra-cluster distance between two clusters.
@details Clusters can be represented by list of coordinates (in this case data shouldn't be specified),
or by list of indexes of points from the dat... | def average_intra_cluster_distance(cluster1, cluster2, data=None):
"""!
@brief Calculates average intra-cluster distance between two clusters.
@details Clusters can be represented by list of coordinates (in this case data shouldn't be specified),
or by list of indexes of points from the dat... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L382-L430 | [
"def",
"average_intra_cluster_distance",
"(",
"cluster1",
",",
"cluster2",
",",
"data",
"=",
"None",
")",
":",
"distance",
"=",
"0.0",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"cluster1",
")",
"+",
"len",
"(",
"cluster2",
")",
")",
":",
"for",
"j",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | variance_increase_distance | !
@brief Calculates variance increase distance between two clusters.
@details Clusters can be represented by list of coordinates (in this case data shouldn't be specified),
or by list of indexes of points from the data (represented by list of points), in this case
data should be s... | pyclustering/utils/__init__.py | def variance_increase_distance(cluster1, cluster2, data = None):
"""!
@brief Calculates variance increase distance between two clusters.
@details Clusters can be represented by list of coordinates (in this case data shouldn't be specified),
or by list of indexes of points from the data (rep... | def variance_increase_distance(cluster1, cluster2, data = None):
"""!
@brief Calculates variance increase distance between two clusters.
@details Clusters can be represented by list of coordinates (in this case data shouldn't be specified),
or by list of indexes of points from the data (rep... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L433-L499 | [
"def",
"variance_increase_distance",
"(",
"cluster1",
",",
"cluster2",
",",
"data",
"=",
"None",
")",
":",
"# calculate local sum\r",
"if",
"data",
"is",
"None",
":",
"member_cluster1",
"=",
"[",
"0.0",
"]",
"*",
"len",
"(",
"cluster1",
"[",
"0",
"]",
")",... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | calculate_ellipse_description | !
@brief Calculates description of ellipse using covariance matrix.
@param[in] covariance (numpy.array): Covariance matrix for which ellipse area should be calculated.
@param[in] scale (float): Scale of the ellipse.
@return (float, float, float) Return ellipse description: angle, width, ... | pyclustering/utils/__init__.py | def calculate_ellipse_description(covariance, scale = 2.0):
"""!
@brief Calculates description of ellipse using covariance matrix.
@param[in] covariance (numpy.array): Covariance matrix for which ellipse area should be calculated.
@param[in] scale (float): Scale of the ellipse.
@ret... | def calculate_ellipse_description(covariance, scale = 2.0):
"""!
@brief Calculates description of ellipse using covariance matrix.
@param[in] covariance (numpy.array): Covariance matrix for which ellipse area should be calculated.
@param[in] scale (float): Scale of the ellipse.
@ret... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L502-L523 | [
"def",
"calculate_ellipse_description",
"(",
"covariance",
",",
"scale",
"=",
"2.0",
")",
":",
"eigh_values",
",",
"eigh_vectors",
"=",
"numpy",
".",
"linalg",
".",
"eigh",
"(",
"covariance",
")",
"order",
"=",
"eigh_values",
".",
"argsort",
"(",
")",
"[",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | data_corners | !
@brief Finds maximum and minimum corner in each dimension of the specified data.
@param[in] data (list): List of points that should be analysed.
@param[in] data_filter (list): List of indexes of the data that should be analysed,
if it is 'None' then whole 'data' is analysed to ob... | pyclustering/utils/__init__.py | def data_corners(data, data_filter = None):
"""!
@brief Finds maximum and minimum corner in each dimension of the specified data.
@param[in] data (list): List of points that should be analysed.
@param[in] data_filter (list): List of indexes of the data that should be analysed,
... | def data_corners(data, data_filter = None):
"""!
@brief Finds maximum and minimum corner in each dimension of the specified data.
@param[in] data (list): List of points that should be analysed.
@param[in] data_filter (list): List of indexes of the data that should be analysed,
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L526-L555 | [
"def",
"data_corners",
"(",
"data",
",",
"data_filter",
"=",
"None",
")",
":",
"dimensions",
"=",
"len",
"(",
"data",
"[",
"0",
"]",
")",
"bypass",
"=",
"data_filter",
"if",
"bypass",
"is",
"None",
":",
"bypass",
"=",
"range",
"(",
"len",
"(",
"data"... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | norm_vector | !
@brief Calculates norm of an input vector that is known as a vector length.
@param[in] vector (list): The input vector whose length is calculated.
@return (double) vector norm known as vector length. | pyclustering/utils/__init__.py | def norm_vector(vector):
"""!
@brief Calculates norm of an input vector that is known as a vector length.
@param[in] vector (list): The input vector whose length is calculated.
@return (double) vector norm known as vector length.
"""
length = 0.0
for component ... | def norm_vector(vector):
"""!
@brief Calculates norm of an input vector that is known as a vector length.
@param[in] vector (list): The input vector whose length is calculated.
@return (double) vector norm known as vector length.
"""
length = 0.0
for component ... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L558-L574 | [
"def",
"norm_vector",
"(",
"vector",
")",
":",
"length",
"=",
"0.0",
"for",
"component",
"in",
"vector",
":",
"length",
"+=",
"component",
"*",
"component",
"length",
"=",
"length",
"**",
"0.5",
"return",
"length"
] | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | timedcall | !
@brief Executes specified method or function with measuring of execution time.
@param[in] executable_function (pointer): Pointer to function or method.
@param[in] args (*): Arguments of called function or method.
@return (tuple) Execution time and result of execution of function or met... | pyclustering/utils/__init__.py | def timedcall(executable_function, *args):
"""!
@brief Executes specified method or function with measuring of execution time.
@param[in] executable_function (pointer): Pointer to function or method.
@param[in] args (*): Arguments of called function or method.
@return (tuple) Execut... | def timedcall(executable_function, *args):
"""!
@brief Executes specified method or function with measuring of execution time.
@param[in] executable_function (pointer): Pointer to function or method.
@param[in] args (*): Arguments of called function or method.
@return (tuple) Execut... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L593-L608 | [
"def",
"timedcall",
"(",
"executable_function",
",",
"*",
"args",
")",
":",
"time_start",
"=",
"time",
".",
"clock",
"(",
")",
"result",
"=",
"executable_function",
"(",
"*",
"args",
")",
"time_end",
"=",
"time",
".",
"clock",
"(",
")",
"return",
"(",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | extract_number_oscillations | !
@brief Extracts number of oscillations of specified oscillator.
@param[in] osc_dyn (list): Dynamic of oscillators.
@param[in] index (uint): Index of oscillator in dynamic.
@param[in] amplitude_threshold (double): Amplitude threshold when oscillation is taken into account, for example,
... | pyclustering/utils/__init__.py | def extract_number_oscillations(osc_dyn, index = 0, amplitude_threshold = 1.0):
"""!
@brief Extracts number of oscillations of specified oscillator.
@param[in] osc_dyn (list): Dynamic of oscillators.
@param[in] index (uint): Index of oscillator in dynamic.
@param[in] amplitude_threshold (... | def extract_number_oscillations(osc_dyn, index = 0, amplitude_threshold = 1.0):
"""!
@brief Extracts number of oscillations of specified oscillator.
@param[in] osc_dyn (list): Dynamic of oscillators.
@param[in] index (uint): Index of oscillator in dynamic.
@param[in] amplitude_threshold (... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L611-L647 | [
"def",
"extract_number_oscillations",
"(",
"osc_dyn",
",",
"index",
"=",
"0",
",",
"amplitude_threshold",
"=",
"1.0",
")",
":",
"number_oscillations",
"=",
"0",
"waiting_differential",
"=",
"False",
"threshold_passed",
"=",
"False",
"high_level_trigger",
"=",
"True"... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | allocate_sync_ensembles | !
@brief Allocate clusters in line with ensembles of synchronous oscillators where each
synchronous ensemble corresponds to only one cluster.
@param[in] dynamic (dynamic): Dynamic of each oscillator.
@param[in] tolerance (double): Maximum error for allocation of synchronous ensemble osc... | pyclustering/utils/__init__.py | def allocate_sync_ensembles(dynamic, tolerance = 0.1, threshold = 1.0, ignore = None):
"""!
@brief Allocate clusters in line with ensembles of synchronous oscillators where each
synchronous ensemble corresponds to only one cluster.
@param[in] dynamic (dynamic): Dynamic of each oscillato... | def allocate_sync_ensembles(dynamic, tolerance = 0.1, threshold = 1.0, ignore = None):
"""!
@brief Allocate clusters in line with ensembles of synchronous oscillators where each
synchronous ensemble corresponds to only one cluster.
@param[in] dynamic (dynamic): Dynamic of each oscillato... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L650-L743 | [
"def",
"allocate_sync_ensembles",
"(",
"dynamic",
",",
"tolerance",
"=",
"0.1",
",",
"threshold",
"=",
"1.0",
",",
"ignore",
"=",
"None",
")",
":",
"descriptors",
"=",
"[",
"[",
"]",
"for",
"_",
"in",
"range",
"(",
"len",
"(",
"dynamic",
"[",
"0",
"]... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | draw_clusters | !
@brief Displays clusters for data in 2D or 3D.
@param[in] data (list): Points that are described by coordinates represented.
@param[in] clusters (list): Clusters that are represented by lists of indexes where each index corresponds to point in data.
@param[in] noise (list): Points that are r... | pyclustering/utils/__init__.py | def draw_clusters(data, clusters, noise = [], marker_descr = '.', hide_axes = False, axes = None, display_result = True):
"""!
@brief Displays clusters for data in 2D or 3D.
@param[in] data (list): Points that are described by coordinates represented.
@param[in] clusters (list): Clusters that ... | def draw_clusters(data, clusters, noise = [], marker_descr = '.', hide_axes = False, axes = None, display_result = True):
"""!
@brief Displays clusters for data in 2D or 3D.
@param[in] data (list): Points that are described by coordinates represented.
@param[in] clusters (list): Clusters that ... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L746-L845 | [
"def",
"draw_clusters",
"(",
"data",
",",
"clusters",
",",
"noise",
"=",
"[",
"]",
",",
"marker_descr",
"=",
"'.'",
",",
"hide_axes",
"=",
"False",
",",
"axes",
"=",
"None",
",",
"display_result",
"=",
"True",
")",
":",
"# Get dimension\r",
"dimension",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | draw_dynamics | !
@brief Draw dynamics of neurons (oscillators) in the network.
@details It draws if matplotlib is not specified (None), othewise it should be performed manually.
@param[in] t (list): Values of time (used by x axis).
@param[in] dyn (list): Values of output of oscillators (used by y axis).
... | pyclustering/utils/__init__.py | def draw_dynamics(t, dyn, x_title = None, y_title = None, x_lim = None, y_lim = None, x_labels = True, y_labels = True, separate = False, axes = None):
"""!
@brief Draw dynamics of neurons (oscillators) in the network.
@details It draws if matplotlib is not specified (None), othewise it should be perform... | def draw_dynamics(t, dyn, x_title = None, y_title = None, x_lim = None, y_lim = None, x_labels = True, y_labels = True, separate = False, axes = None):
"""!
@brief Draw dynamics of neurons (oscillators) in the network.
@details It draws if matplotlib is not specified (None), othewise it should be perform... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L848-L929 | [
"def",
"draw_dynamics",
"(",
"t",
",",
"dyn",
",",
"x_title",
"=",
"None",
",",
"y_title",
"=",
"None",
",",
"x_lim",
"=",
"None",
",",
"y_lim",
"=",
"None",
",",
"x_labels",
"=",
"True",
",",
"y_labels",
"=",
"True",
",",
"separate",
"=",
"False",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | set_ax_param | !
@brief Sets parameters for matplotlib ax.
@param[in] ax (Axes): Axes for which parameters should applied.
@param[in] x_title (string): Title for Y.
@param[in] y_title (string): Title for X.
@param[in] x_lim (double): X limit.
@param[in] y_lim (double): Y limit.
@param[in] x_la... | pyclustering/utils/__init__.py | def set_ax_param(ax, x_title = None, y_title = None, x_lim = None, y_lim = None, x_labels = True, y_labels = True, grid = True):
"""!
@brief Sets parameters for matplotlib ax.
@param[in] ax (Axes): Axes for which parameters should applied.
@param[in] x_title (string): Title for Y.
@param[... | def set_ax_param(ax, x_title = None, y_title = None, x_lim = None, y_lim = None, x_labels = True, y_labels = True, grid = True):
"""!
@brief Sets parameters for matplotlib ax.
@param[in] ax (Axes): Axes for which parameters should applied.
@param[in] x_title (string): Title for Y.
@param[... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L932-L973 | [
"def",
"set_ax_param",
"(",
"ax",
",",
"x_title",
"=",
"None",
",",
"y_title",
"=",
"None",
",",
"x_lim",
"=",
"None",
",",
"y_lim",
"=",
"None",
",",
"x_labels",
"=",
"True",
",",
"y_labels",
"=",
"True",
",",
"grid",
"=",
"True",
")",
":",
"from"... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | draw_dynamics_set | !
@brief Draw lists of dynamics of neurons (oscillators) in the network.
@param[in] dynamics (list): List of network outputs that are represented by values of output of oscillators (used by y axis).
@param[in] xtitle (string): Title for Y.
@param[in] ytitle (string): Title for X.
@param[i... | pyclustering/utils/__init__.py | def draw_dynamics_set(dynamics, xtitle = None, ytitle = None, xlim = None, ylim = None, xlabels = False, ylabels = False):
"""!
@brief Draw lists of dynamics of neurons (oscillators) in the network.
@param[in] dynamics (list): List of network outputs that are represented by values of output of osci... | def draw_dynamics_set(dynamics, xtitle = None, ytitle = None, xlim = None, ylim = None, xlabels = False, ylabels = False):
"""!
@brief Draw lists of dynamics of neurons (oscillators) in the network.
@param[in] dynamics (list): List of network outputs that are represented by values of output of osci... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L976-L1018 | [
"def",
"draw_dynamics_set",
"(",
"dynamics",
",",
"xtitle",
"=",
"None",
",",
"ytitle",
"=",
"None",
",",
"xlim",
"=",
"None",
",",
"ylim",
"=",
"None",
",",
"xlabels",
"=",
"False",
",",
"ylabels",
"=",
"False",
")",
":",
"# Calculate edge for confortable... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | draw_image_color_segments | !
@brief Shows image segments using colored image.
@details Each color on result image represents allocated segment. The first image is initial and other is result of segmentation.
@param[in] source (string): Path to image.
@param[in] clusters (list): List of clusters (allocated segments of im... | pyclustering/utils/__init__.py | def draw_image_color_segments(source, clusters, hide_axes = True):
"""!
@brief Shows image segments using colored image.
@details Each color on result image represents allocated segment. The first image is initial and other is result of segmentation.
@param[in] source (string): Path to image.
... | def draw_image_color_segments(source, clusters, hide_axes = True):
"""!
@brief Shows image segments using colored image.
@details Each color on result image represents allocated segment. The first image is initial and other is result of segmentation.
@param[in] source (string): Path to image.
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L1021-L1070 | [
"def",
"draw_image_color_segments",
"(",
"source",
",",
"clusters",
",",
"hide_axes",
"=",
"True",
")",
":",
"image_source",
"=",
"Image",
".",
"open",
"(",
"source",
")",
"image_size",
"=",
"image_source",
".",
"size",
"(",
"fig",
",",
"axarr",
")",
"=",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | draw_image_mask_segments | !
@brief Shows image segments using black masks.
@details Each black mask of allocated segment is presented on separate plot.
The first image is initial and others are black masks of segments.
@param[in] source (string): Path to image.
@param[in] clusters (list): List of clusters... | pyclustering/utils/__init__.py | def draw_image_mask_segments(source, clusters, hide_axes = True):
"""!
@brief Shows image segments using black masks.
@details Each black mask of allocated segment is presented on separate plot.
The first image is initial and others are black masks of segments.
@param[in] source ... | def draw_image_mask_segments(source, clusters, hide_axes = True):
"""!
@brief Shows image segments using black masks.
@details Each black mask of allocated segment is presented on separate plot.
The first image is initial and others are black masks of segments.
@param[in] source ... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L1073-L1150 | [
"def",
"draw_image_mask_segments",
"(",
"source",
",",
"clusters",
",",
"hide_axes",
"=",
"True",
")",
":",
"if",
"(",
"len",
"(",
"clusters",
")",
"==",
"0",
")",
":",
"print",
"(",
"\"Warning: Nothing to draw - list of clusters is empty.\"",
")",
"return",
"im... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | linear_sum | !
@brief Calculates linear sum of vector that is represented by list, each element can be represented by list - multidimensional elements.
@param[in] list_vector (list): Input vector.
@return (list|double) Linear sum of vector that can be represented by list in case of multidimensional elemen... | pyclustering/utils/__init__.py | def linear_sum(list_vector):
"""!
@brief Calculates linear sum of vector that is represented by list, each element can be represented by list - multidimensional elements.
@param[in] list_vector (list): Input vector.
@return (list|double) Linear sum of vector that can be represented by li... | def linear_sum(list_vector):
"""!
@brief Calculates linear sum of vector that is represented by list, each element can be represented by list - multidimensional elements.
@param[in] list_vector (list): Input vector.
@return (list|double) Linear sum of vector that can be represented by li... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L1153-L1177 | [
"def",
"linear_sum",
"(",
"list_vector",
")",
":",
"dimension",
"=",
"1",
"linear_sum",
"=",
"0.0",
"list_representation",
"=",
"(",
"type",
"(",
"list_vector",
"[",
"0",
"]",
")",
"==",
"list",
")",
"if",
"(",
"list_representation",
"is",
"True",
")",
"... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | square_sum | !
@brief Calculates square sum of vector that is represented by list, each element can be represented by list - multidimensional elements.
@param[in] list_vector (list): Input vector.
@return (double) Square sum of vector. | pyclustering/utils/__init__.py | def square_sum(list_vector):
"""!
@brief Calculates square sum of vector that is represented by list, each element can be represented by list - multidimensional elements.
@param[in] list_vector (list): Input vector.
@return (double) Square sum of vector.
"""
square_... | def square_sum(list_vector):
"""!
@brief Calculates square sum of vector that is represented by list, each element can be represented by list - multidimensional elements.
@param[in] list_vector (list): Input vector.
@return (double) Square sum of vector.
"""
square_... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L1180-L1199 | [
"def",
"square_sum",
"(",
"list_vector",
")",
":",
"square_sum",
"=",
"0.0",
"list_representation",
"=",
"(",
"type",
"(",
"list_vector",
"[",
"0",
"]",
")",
"==",
"list",
")",
"for",
"index_element",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"list_vecto... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | list_math_subtraction | !
@brief Calculates subtraction of two lists.
@details Each element from list 'a' is subtracted by element from list 'b' accordingly.
@param[in] a (list): List of elements that supports mathematical subtraction.
@param[in] b (list): List of elements that supports mathematical subtraction.
... | pyclustering/utils/__init__.py | def list_math_subtraction(a, b):
"""!
@brief Calculates subtraction of two lists.
@details Each element from list 'a' is subtracted by element from list 'b' accordingly.
@param[in] a (list): List of elements that supports mathematical subtraction.
@param[in] b (list): List of elements tha... | def list_math_subtraction(a, b):
"""!
@brief Calculates subtraction of two lists.
@details Each element from list 'a' is subtracted by element from list 'b' accordingly.
@param[in] a (list): List of elements that supports mathematical subtraction.
@param[in] b (list): List of elements tha... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L1202-L1213 | [
"def",
"list_math_subtraction",
"(",
"a",
",",
"b",
")",
":",
"return",
"[",
"a",
"[",
"i",
"]",
"-",
"b",
"[",
"i",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"a",
")",
")",
"]"
] | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | list_math_substraction_number | !
@brief Calculates subtraction between list and number.
@details Each element from list 'a' is subtracted by number 'b'.
@param[in] a (list): List of elements that supports mathematical subtraction.
@param[in] b (list): Value that supports mathematical subtraction.
@return (list) R... | pyclustering/utils/__init__.py | def list_math_substraction_number(a, b):
"""!
@brief Calculates subtraction between list and number.
@details Each element from list 'a' is subtracted by number 'b'.
@param[in] a (list): List of elements that supports mathematical subtraction.
@param[in] b (list): Value that supports math... | def list_math_substraction_number(a, b):
"""!
@brief Calculates subtraction between list and number.
@details Each element from list 'a' is subtracted by number 'b'.
@param[in] a (list): List of elements that supports mathematical subtraction.
@param[in] b (list): Value that supports math... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L1216-L1227 | [
"def",
"list_math_substraction_number",
"(",
"a",
",",
"b",
")",
":",
"return",
"[",
"a",
"[",
"i",
"]",
"-",
"b",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"a",
")",
")",
"]"
] | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | list_math_addition | !
@brief Addition of two lists.
@details Each element from list 'a' is added to element from list 'b' accordingly.
@param[in] a (list): List of elements that supports mathematic addition..
@param[in] b (list): List of elements that supports mathematic addition..
@return (list) Resul... | pyclustering/utils/__init__.py | def list_math_addition(a, b):
"""!
@brief Addition of two lists.
@details Each element from list 'a' is added to element from list 'b' accordingly.
@param[in] a (list): List of elements that supports mathematic addition..
@param[in] b (list): List of elements that supports mathematic addi... | def list_math_addition(a, b):
"""!
@brief Addition of two lists.
@details Each element from list 'a' is added to element from list 'b' accordingly.
@param[in] a (list): List of elements that supports mathematic addition..
@param[in] b (list): List of elements that supports mathematic addi... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L1230-L1241 | [
"def",
"list_math_addition",
"(",
"a",
",",
"b",
")",
":",
"return",
"[",
"a",
"[",
"i",
"]",
"+",
"b",
"[",
"i",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"a",
")",
")",
"]"
] | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | list_math_addition_number | !
@brief Addition between list and number.
@details Each element from list 'a' is added to number 'b'.
@param[in] a (list): List of elements that supports mathematic addition.
@param[in] b (double): Value that supports mathematic addition.
@return (list) Result of addtion of two lis... | pyclustering/utils/__init__.py | def list_math_addition_number(a, b):
"""!
@brief Addition between list and number.
@details Each element from list 'a' is added to number 'b'.
@param[in] a (list): List of elements that supports mathematic addition.
@param[in] b (double): Value that supports mathematic addition.
... | def list_math_addition_number(a, b):
"""!
@brief Addition between list and number.
@details Each element from list 'a' is added to number 'b'.
@param[in] a (list): List of elements that supports mathematic addition.
@param[in] b (double): Value that supports mathematic addition.
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L1244-L1255 | [
"def",
"list_math_addition_number",
"(",
"a",
",",
"b",
")",
":",
"return",
"[",
"a",
"[",
"i",
"]",
"+",
"b",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"a",
")",
")",
"]"
] | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | list_math_division_number | !
@brief Division between list and number.
@details Each element from list 'a' is divided by number 'b'.
@param[in] a (list): List of elements that supports mathematic division.
@param[in] b (double): Value that supports mathematic division.
@return (list) Result of division between... | pyclustering/utils/__init__.py | def list_math_division_number(a, b):
"""!
@brief Division between list and number.
@details Each element from list 'a' is divided by number 'b'.
@param[in] a (list): List of elements that supports mathematic division.
@param[in] b (double): Value that supports mathematic division.
... | def list_math_division_number(a, b):
"""!
@brief Division between list and number.
@details Each element from list 'a' is divided by number 'b'.
@param[in] a (list): List of elements that supports mathematic division.
@param[in] b (double): Value that supports mathematic division.
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L1258-L1269 | [
"def",
"list_math_division_number",
"(",
"a",
",",
"b",
")",
":",
"return",
"[",
"a",
"[",
"i",
"]",
"/",
"b",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"a",
")",
")",
"]"
] | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | list_math_division | !
@brief Division of two lists.
@details Each element from list 'a' is divided by element from list 'b' accordingly.
@param[in] a (list): List of elements that supports mathematic division.
@param[in] b (list): List of elements that supports mathematic division.
@return (list) Resul... | pyclustering/utils/__init__.py | def list_math_division(a, b):
"""!
@brief Division of two lists.
@details Each element from list 'a' is divided by element from list 'b' accordingly.
@param[in] a (list): List of elements that supports mathematic division.
@param[in] b (list): List of elements that supports mathematic div... | def list_math_division(a, b):
"""!
@brief Division of two lists.
@details Each element from list 'a' is divided by element from list 'b' accordingly.
@param[in] a (list): List of elements that supports mathematic division.
@param[in] b (list): List of elements that supports mathematic div... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L1272-L1283 | [
"def",
"list_math_division",
"(",
"a",
",",
"b",
")",
":",
"return",
"[",
"a",
"[",
"i",
"]",
"/",
"b",
"[",
"i",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"a",
")",
")",
"]"
] | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | list_math_multiplication_number | !
@brief Multiplication between list and number.
@details Each element from list 'a' is multiplied by number 'b'.
@param[in] a (list): List of elements that supports mathematic division.
@param[in] b (double): Number that supports mathematic division.
@return (list) Result of divisi... | pyclustering/utils/__init__.py | def list_math_multiplication_number(a, b):
"""!
@brief Multiplication between list and number.
@details Each element from list 'a' is multiplied by number 'b'.
@param[in] a (list): List of elements that supports mathematic division.
@param[in] b (double): Number that supports mathematic d... | def list_math_multiplication_number(a, b):
"""!
@brief Multiplication between list and number.
@details Each element from list 'a' is multiplied by number 'b'.
@param[in] a (list): List of elements that supports mathematic division.
@param[in] b (double): Number that supports mathematic d... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L1286-L1297 | [
"def",
"list_math_multiplication_number",
"(",
"a",
",",
"b",
")",
":",
"return",
"[",
"a",
"[",
"i",
"]",
"*",
"b",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"a",
")",
")",
"]"
] | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | list_math_multiplication | !
@brief Multiplication of two lists.
@details Each element from list 'a' is multiplied by element from list 'b' accordingly.
@param[in] a (list): List of elements that supports mathematic multiplication.
@param[in] b (list): List of elements that supports mathematic multiplication.
... | pyclustering/utils/__init__.py | def list_math_multiplication(a, b):
"""!
@brief Multiplication of two lists.
@details Each element from list 'a' is multiplied by element from list 'b' accordingly.
@param[in] a (list): List of elements that supports mathematic multiplication.
@param[in] b (list): List of elements that su... | def list_math_multiplication(a, b):
"""!
@brief Multiplication of two lists.
@details Each element from list 'a' is multiplied by element from list 'b' accordingly.
@param[in] a (list): List of elements that supports mathematic multiplication.
@param[in] b (list): List of elements that su... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/__init__.py#L1300-L1311 | [
"def",
"list_math_multiplication",
"(",
"a",
",",
"b",
")",
":",
"return",
"[",
"a",
"[",
"i",
"]",
"*",
"b",
"[",
"i",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"a",
")",
")",
"]"
] | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | network.__create_all_to_all_connections | !
@brief Creates connections between all oscillators. | pyclustering/nnet/__init__.py | def __create_all_to_all_connections(self):
"""!
@brief Creates connections between all oscillators.
"""
if (self._conn_represent == conn_represent.MATRIX):
for index in range(0, self._num_osc, 1):
self._osc_conn.append([True] * self._... | def __create_all_to_all_connections(self):
"""!
@brief Creates connections between all oscillators.
"""
if (self._conn_represent == conn_represent.MATRIX):
for index in range(0, self._num_osc, 1):
self._osc_conn.append([True] * self._... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/__init__.py#L198-L211 | [
"def",
"__create_all_to_all_connections",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"_conn_represent",
"==",
"conn_represent",
".",
"MATRIX",
")",
":",
"for",
"index",
"in",
"range",
"(",
"0",
",",
"self",
".",
"_num_osc",
",",
"1",
")",
":",
"self"... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | network.__create_grid_four_connections | !
@brief Creates network with connections that make up four grid structure.
@details Each oscillator may be connected with four neighbors in line with 'grid' structure: right, upper, left, lower. | pyclustering/nnet/__init__.py | def __create_grid_four_connections(self):
"""!
@brief Creates network with connections that make up four grid structure.
@details Each oscillator may be connected with four neighbors in line with 'grid' structure: right, upper, left, lower.
"""
side_size ... | def __create_grid_four_connections(self):
"""!
@brief Creates network with connections that make up four grid structure.
@details Each oscillator may be connected with four neighbors in line with 'grid' structure: right, upper, left, lower.
"""
side_size ... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/__init__.py#L214-L246 | [
"def",
"__create_grid_four_connections",
"(",
"self",
")",
":",
"side_size",
"=",
"self",
".",
"__width",
"if",
"(",
"self",
".",
"_conn_represent",
"==",
"conn_represent",
".",
"MATRIX",
")",
":",
"self",
".",
"_osc_conn",
"=",
"[",
"[",
"0",
"]",
"*",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | network.__create_grid_eight_connections | !
@brief Creates network with connections that make up eight grid structure.
@details Each oscillator may be connected with eight neighbors in line with grid structure: right, right-upper, upper, upper-left, left, left-lower, lower, lower-right. | pyclustering/nnet/__init__.py | def __create_grid_eight_connections(self):
"""!
@brief Creates network with connections that make up eight grid structure.
@details Each oscillator may be connected with eight neighbors in line with grid structure: right, right-upper, upper, upper-left, left, left-lower, lower, lower-right.
... | def __create_grid_eight_connections(self):
"""!
@brief Creates network with connections that make up eight grid structure.
@details Each oscillator may be connected with eight neighbors in line with grid structure: right, right-upper, upper, upper-left, left, left-lower, lower, lower-right.
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/__init__.py#L249-L280 | [
"def",
"__create_grid_eight_connections",
"(",
"self",
")",
":",
"self",
".",
"__create_grid_four_connections",
"(",
")",
"# create connection with right, upper, left, lower.\r",
"side_size",
"=",
"self",
".",
"__width",
"for",
"index",
"in",
"range",
"(",
"0",
",",
"... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | network.__create_list_bidir_connections | !
@brief Creates network as bidirectional list.
@details Each oscillator may be conneted with two neighbors in line with classical list structure: right, left. | pyclustering/nnet/__init__.py | def __create_list_bidir_connections(self):
"""!
@brief Creates network as bidirectional list.
@details Each oscillator may be conneted with two neighbors in line with classical list structure: right, left.
"""
if (self._conn_represent == conn_represent.MA... | def __create_list_bidir_connections(self):
"""!
@brief Creates network as bidirectional list.
@details Each oscillator may be conneted with two neighbors in line with classical list structure: right, left.
"""
if (self._conn_represent == conn_represent.MA... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/__init__.py#L283-L307 | [
"def",
"__create_list_bidir_connections",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"_conn_represent",
"==",
"conn_represent",
".",
"MATRIX",
")",
":",
"for",
"index",
"in",
"range",
"(",
"0",
",",
"self",
".",
"_num_osc",
",",
"1",
")",
":",
"self"... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | network.__create_none_connections | !
@brief Creates network without connections. | pyclustering/nnet/__init__.py | def __create_none_connections(self):
"""!
@brief Creates network without connections.
"""
if (self._conn_represent == conn_represent.MATRIX):
for _ in range(0, self._num_osc, 1):
self._osc_conn.append([False] * self._num_osc);
elif (se... | def __create_none_connections(self):
"""!
@brief Creates network without connections.
"""
if (self._conn_represent == conn_represent.MATRIX):
for _ in range(0, self._num_osc, 1):
self._osc_conn.append([False] * self._num_osc);
elif (se... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/__init__.py#L310-L319 | [
"def",
"__create_none_connections",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"_conn_represent",
"==",
"conn_represent",
".",
"MATRIX",
")",
":",
"for",
"_",
"in",
"range",
"(",
"0",
",",
"self",
".",
"_num_osc",
",",
"1",
")",
":",
"self",
".",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | network._create_structure | !
@brief Creates connection in line with representation of matrix connections [NunOsc x NumOsc].
@param[in] type_conn (conn_type): Connection type (all-to-all, bidirectional list, grid structure, etc.) that is used by the network. | pyclustering/nnet/__init__.py | def _create_structure(self, type_conn = conn_type.ALL_TO_ALL):
"""!
@brief Creates connection in line with representation of matrix connections [NunOsc x NumOsc].
@param[in] type_conn (conn_type): Connection type (all-to-all, bidirectional list, grid structure, etc.) that is used by... | def _create_structure(self, type_conn = conn_type.ALL_TO_ALL):
"""!
@brief Creates connection in line with representation of matrix connections [NunOsc x NumOsc].
@param[in] type_conn (conn_type): Connection type (all-to-all, bidirectional list, grid structure, etc.) that is used by... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/__init__.py#L334-L363 | [
"def",
"_create_structure",
"(",
"self",
",",
"type_conn",
"=",
"conn_type",
".",
"ALL_TO_ALL",
")",
":",
"self",
".",
"_osc_conn",
"=",
"list",
"(",
")",
"if",
"(",
"type_conn",
"==",
"conn_type",
".",
"NONE",
")",
":",
"self",
".",
"__create_none_connect... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | network.has_connection | !
@brief Returns True if there is connection between i and j oscillators and False - if connection doesn't exist.
@param[in] i (uint): index of an oscillator in the network.
@param[in] j (uint): index of an oscillator in the network. | pyclustering/nnet/__init__.py | def has_connection(self, i, j):
"""!
@brief Returns True if there is connection between i and j oscillators and False - if connection doesn't exist.
@param[in] i (uint): index of an oscillator in the network.
@param[in] j (uint): index of an oscillator in the network.
... | def has_connection(self, i, j):
"""!
@brief Returns True if there is connection between i and j oscillators and False - if connection doesn't exist.
@param[in] i (uint): index of an oscillator in the network.
@param[in] j (uint): index of an oscillator in the network.
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/__init__.py#L366-L384 | [
"def",
"has_connection",
"(",
"self",
",",
"i",
",",
"j",
")",
":",
"if",
"(",
"self",
".",
"_conn_represent",
"==",
"conn_represent",
".",
"MATRIX",
")",
":",
"return",
"(",
"self",
".",
"_osc_conn",
"[",
"i",
"]",
"[",
"j",
"]",
")",
"elif",
"(",... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | network.set_connection | !
@brief Couples two specified oscillators in the network with dynamic connections.
@param[in] i (uint): index of an oscillator that should be coupled with oscillator 'j' in the network.
@param[in] j (uint): index of an oscillator that should be coupled with oscillator 'i' in the ne... | pyclustering/nnet/__init__.py | def set_connection(self, i, j):
"""!
@brief Couples two specified oscillators in the network with dynamic connections.
@param[in] i (uint): index of an oscillator that should be coupled with oscillator 'j' in the network.
@param[in] j (uint): index of an oscillator that sho... | def set_connection(self, i, j):
"""!
@brief Couples two specified oscillators in the network with dynamic connections.
@param[in] i (uint): index of an oscillator that should be coupled with oscillator 'j' in the network.
@param[in] j (uint): index of an oscillator that sho... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/__init__.py#L387-L406 | [
"def",
"set_connection",
"(",
"self",
",",
"i",
",",
"j",
")",
":",
"if",
"(",
"self",
".",
"structure",
"!=",
"conn_type",
".",
"DYNAMIC",
")",
":",
"raise",
"NameError",
"(",
"\"Connection between oscillators can be changed only in case of dynamic type.\"",
")",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | network.get_neighbors | !
@brief Finds neighbors of the oscillator with specified index.
@param[in] index (uint): index of oscillator for which neighbors should be found in the network.
@return (list) Indexes of neighbors of the specified oscillator. | pyclustering/nnet/__init__.py | def get_neighbors(self, index):
"""!
@brief Finds neighbors of the oscillator with specified index.
@param[in] index (uint): index of oscillator for which neighbors should be found in the network.
@return (list) Indexes of neighbors of the specified oscillator.
... | def get_neighbors(self, index):
"""!
@brief Finds neighbors of the oscillator with specified index.
@param[in] index (uint): index of oscillator for which neighbors should be found in the network.
@return (list) Indexes of neighbors of the specified oscillator.
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/__init__.py#L409-L424 | [
"def",
"get_neighbors",
"(",
"self",
",",
"index",
")",
":",
"if",
"(",
"self",
".",
"_conn_represent",
"==",
"conn_represent",
".",
"LIST",
")",
":",
"return",
"self",
".",
"_osc_conn",
"[",
"index",
"]",
"# connections are represented by list.\r",
"elif",
"(... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | clarans.process | !
@brief Performs cluster analysis in line with rules of CLARANS algorithm.
@see get_clusters()
@see get_medoids() | pyclustering/cluster/clarans.py | def process(self):
"""!
@brief Performs cluster analysis in line with rules of CLARANS algorithm.
@see get_clusters()
@see get_medoids()
"""
random.seed()
for _ in range(0, self.__numlocal):
# set (curren... | def process(self):
"""!
@brief Performs cluster analysis in line with rules of CLARANS algorithm.
@see get_clusters()
@see get_medoids()
"""
random.seed()
for _ in range(0, self.__numlocal):
# set (curren... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/clarans.py#L66-L93 | [
"def",
"process",
"(",
"self",
")",
":",
"random",
".",
"seed",
"(",
")",
"for",
"_",
"in",
"range",
"(",
"0",
",",
"self",
".",
"__numlocal",
")",
":",
"# set (current) random medoids\r",
"self",
".",
"__current",
"=",
"random",
".",
"sample",
"(",
"r... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | clarans.__update_clusters | !
@brief Forms cluster in line with specified medoids by calculation distance from each point to medoids. | pyclustering/cluster/clarans.py | def __update_clusters(self, medoids):
"""!
@brief Forms cluster in line with specified medoids by calculation distance from each point to medoids.
"""
self.__belong = [0] * len(self.__pointer_data)
self.__clusters = [[] for i in range(len(medoids))]
... | def __update_clusters(self, medoids):
"""!
@brief Forms cluster in line with specified medoids by calculation distance from each point to medoids.
"""
self.__belong = [0] * len(self.__pointer_data)
self.__clusters = [[] for i in range(len(medoids))]
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/clarans.py#L137-L160 | [
"def",
"__update_clusters",
"(",
"self",
",",
"medoids",
")",
":",
"self",
".",
"__belong",
"=",
"[",
"0",
"]",
"*",
"len",
"(",
"self",
".",
"__pointer_data",
")",
"self",
".",
"__clusters",
"=",
"[",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"len... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | clarans.__optimize_configuration | !
@brief Finds quasi-optimal medoids and updates in line with them clusters in line with algorithm's rules. | pyclustering/cluster/clarans.py | def __optimize_configuration(self):
"""!
@brief Finds quasi-optimal medoids and updates in line with them clusters in line with algorithm's rules.
"""
index_neighbor = 0
while (index_neighbor < self.__maxneighbor):
# get random current medoid that is ... | def __optimize_configuration(self):
"""!
@brief Finds quasi-optimal medoids and updates in line with them clusters in line with algorithm's rules.
"""
index_neighbor = 0
while (index_neighbor < self.__maxneighbor):
# get random current medoid that is ... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/clarans.py#L163-L233 | [
"def",
"__optimize_configuration",
"(",
"self",
")",
":",
"index_neighbor",
"=",
"0",
"while",
"(",
"index_neighbor",
"<",
"self",
".",
"__maxneighbor",
")",
":",
"# get random current medoid that is to be replaced\r",
"current_medoid_index",
"=",
"self",
".",
"__curren... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | clarans.__find_another_nearest_medoid | !
@brief Finds the another nearest medoid for the specified point that is differ from the specified medoid.
@param[in] point_index: index of point in dataspace for that searching of medoid in current list of medoids is perfomed.
@param[in] current_medoid_index: index of medoid that... | pyclustering/cluster/clarans.py | def __find_another_nearest_medoid(self, point_index, current_medoid_index):
"""!
@brief Finds the another nearest medoid for the specified point that is differ from the specified medoid.
@param[in] point_index: index of point in dataspace for that searching of medoid in current lis... | def __find_another_nearest_medoid(self, point_index, current_medoid_index):
"""!
@brief Finds the another nearest medoid for the specified point that is differ from the specified medoid.
@param[in] point_index: index of point in dataspace for that searching of medoid in current lis... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/clarans.py#L236-L256 | [
"def",
"__find_another_nearest_medoid",
"(",
"self",
",",
"point_index",
",",
"current_medoid_index",
")",
":",
"other_medoid_index",
"=",
"-",
"1",
"other_distance_nearest",
"=",
"float",
"(",
"'inf'",
")",
"for",
"index_medoid",
"in",
"self",
".",
"__current",
"... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | clarans.__calculate_estimation | !
@brief Calculates estimation (cost) of the current clusters. The lower the estimation,
the more optimally configuration of clusters.
@return (double) estimation of current clusters. | pyclustering/cluster/clarans.py | def __calculate_estimation(self):
"""!
@brief Calculates estimation (cost) of the current clusters. The lower the estimation,
the more optimally configuration of clusters.
@return (double) estimation of current clusters.
"""
estimation = 0... | def __calculate_estimation(self):
"""!
@brief Calculates estimation (cost) of the current clusters. The lower the estimation,
the more optimally configuration of clusters.
@return (double) estimation of current clusters.
"""
estimation = 0... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/clarans.py#L259-L274 | [
"def",
"__calculate_estimation",
"(",
"self",
")",
":",
"estimation",
"=",
"0.0",
"for",
"index_cluster",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"self",
".",
"__clusters",
")",
")",
":",
"cluster",
"=",
"self",
".",
"__clusters",
"[",
"index_cluster",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | thirteen_oscillator_three_stimulated_ensembles_list | Good example of three synchronous ensembels | pyclustering/nnet/examples/legion_examples.py | def thirteen_oscillator_three_stimulated_ensembles_list():
"Good example of three synchronous ensembels"
"Not accurate due to false skipes are observed"
parameters = legion_parameters();
parameters.Wt = 4.0;
parameters.fi = 10.0;
template_dynamic_legion(15, 1000, 1000, conn_type = conn_typ... | def thirteen_oscillator_three_stimulated_ensembles_list():
"Good example of three synchronous ensembels"
"Not accurate due to false skipes are observed"
parameters = legion_parameters();
parameters.Wt = 4.0;
parameters.fi = 10.0;
template_dynamic_legion(15, 1000, 1000, conn_type = conn_typ... | [
"Good",
"example",
"of",
"three",
"synchronous",
"ensembels"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/examples/legion_examples.py#L77-L83 | [
"def",
"thirteen_oscillator_three_stimulated_ensembles_list",
"(",
")",
":",
"\"Not accurate due to false skipes are observed\"",
"parameters",
"=",
"legion_parameters",
"(",
")",
"parameters",
".",
"Wt",
"=",
"4.0",
"parameters",
".",
"fi",
"=",
"10.0",
"template_dynamic_l... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | thirteen_simplify_oscillator_three_stimulated_ensembles_list | Good example of three synchronous ensembels | pyclustering/nnet/examples/legion_examples.py | def thirteen_simplify_oscillator_three_stimulated_ensembles_list():
"Good example of three synchronous ensembels"
"Not accurate due to false skipes are observed"
parameters = legion_parameters();
parameters.Wt = 4.0;
parameters.fi = 0.8;
parameters.ENABLE_POTENTIONAL = False;
template... | def thirteen_simplify_oscillator_three_stimulated_ensembles_list():
"Good example of three synchronous ensembels"
"Not accurate due to false skipes are observed"
parameters = legion_parameters();
parameters.Wt = 4.0;
parameters.fi = 0.8;
parameters.ENABLE_POTENTIONAL = False;
template... | [
"Good",
"example",
"of",
"three",
"synchronous",
"ensembels"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/examples/legion_examples.py#L86-L96 | [
"def",
"thirteen_simplify_oscillator_three_stimulated_ensembles_list",
"(",
")",
":",
"\"Not accurate due to false skipes are observed\"",
"parameters",
"=",
"legion_parameters",
"(",
")",
"parameters",
".",
"Wt",
"=",
"4.0",
"parameters",
".",
"fi",
"=",
"0.8",
"parameters... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | sixteen_oscillator_two_stimulated_ensembles_grid | Not accurate false due to spikes are observed | pyclustering/nnet/examples/legion_examples.py | def sixteen_oscillator_two_stimulated_ensembles_grid():
"Not accurate false due to spikes are observed"
parameters = legion_parameters();
parameters.teta_x = -1.1;
template_dynamic_legion(16, 2000, 1500, conn_type = conn_type.GRID_FOUR, params = parameters, stimulus = [1, 1, 1, 0,
... | def sixteen_oscillator_two_stimulated_ensembles_grid():
"Not accurate false due to spikes are observed"
parameters = legion_parameters();
parameters.teta_x = -1.1;
template_dynamic_legion(16, 2000, 1500, conn_type = conn_type.GRID_FOUR, params = parameters, stimulus = [1, 1, 1, 0,
... | [
"Not",
"accurate",
"false",
"due",
"to",
"spikes",
"are",
"observed"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/examples/legion_examples.py#L99-L106 | [
"def",
"sixteen_oscillator_two_stimulated_ensembles_grid",
"(",
")",
":",
"parameters",
"=",
"legion_parameters",
"(",
")",
"parameters",
".",
"teta_x",
"=",
"-",
"1.1",
"template_dynamic_legion",
"(",
"16",
",",
"2000",
",",
"1500",
",",
"conn_type",
"=",
"conn_t... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | simple_segmentation_example | Perfect results! | pyclustering/nnet/examples/legion_examples.py | def simple_segmentation_example():
"Perfect results!"
parameters = legion_parameters();
parameters.eps = 0.02;
parameters.alpha = 0.005;
parameters.betta = 0.1;
parameters.gamma = 7.0;
parameters.teta = 0.9;
parameters.lamda = 0.1;
parameters.teta_x = -0.5;
parameters.t... | def simple_segmentation_example():
"Perfect results!"
parameters = legion_parameters();
parameters.eps = 0.02;
parameters.alpha = 0.005;
parameters.betta = 0.1;
parameters.gamma = 7.0;
parameters.teta = 0.9;
parameters.lamda = 0.1;
parameters.teta_x = -0.5;
parameters.t... | [
"Perfect",
"results!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/examples/legion_examples.py#L109-L141 | [
"def",
"simple_segmentation_example",
"(",
")",
":",
"parameters",
"=",
"legion_parameters",
"(",
")",
"parameters",
".",
"eps",
"=",
"0.02",
"parameters",
".",
"alpha",
"=",
"0.005",
"parameters",
".",
"betta",
"=",
"0.1",
"parameters",
".",
"gamma",
"=",
"... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | kdtree_text_visualizer.visualize | !
@brief Display KD-tree to console.
@param[in] display (bool): If 'True' then tree will be shown in console.
@return (string) Text representation of the KD-tree. | pyclustering/container/kdtree.py | def visualize(self, display=True):
"""!
@brief Display KD-tree to console.
@param[in] display (bool): If 'True' then tree will be shown in console.
@return (string) Text representation of the KD-tree.
"""
kdnodes = self.__get_nodes()
... | def visualize(self, display=True):
"""!
@brief Display KD-tree to console.
@param[in] display (bool): If 'True' then tree will be shown in console.
@return (string) Text representation of the KD-tree.
"""
kdnodes = self.__get_nodes()
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/container/kdtree.py#L52-L72 | [
"def",
"visualize",
"(",
"self",
",",
"display",
"=",
"True",
")",
":",
"kdnodes",
"=",
"self",
".",
"__get_nodes",
"(",
")",
"level",
"=",
"kdnodes",
"[",
"0",
"]",
"for",
"kdnode",
"in",
"kdnodes",
":",
"self",
".",
"__print_node",
"(",
"level",
",... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | kdtree.insert | !
@brief Insert new point with payload to kd-tree.
@param[in] point (list): Coordinates of the point of inserted node.
@param[in] payload (any-type): Payload of inserted node. It can be identificator of the node or
some useful payload that belongs to the point.
... | pyclustering/container/kdtree.py | def insert(self, point, payload):
"""!
@brief Insert new point with payload to kd-tree.
@param[in] point (list): Coordinates of the point of inserted node.
@param[in] payload (any-type): Payload of inserted node. It can be identificator of the node or
s... | def insert(self, point, payload):
"""!
@brief Insert new point with payload to kd-tree.
@param[in] point (list): Coordinates of the point of inserted node.
@param[in] payload (any-type): Payload of inserted node. It can be identificator of the node or
s... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/container/kdtree.py#L204-L247 | [
"def",
"insert",
"(",
"self",
",",
"point",
",",
"payload",
")",
":",
"if",
"self",
".",
"__root",
"is",
"None",
":",
"self",
".",
"__dimension",
"=",
"len",
"(",
"point",
")",
"self",
".",
"__root",
"=",
"node",
"(",
"point",
",",
"payload",
",",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | kdtree.remove | !
@brief Remove specified point from kd-tree.
@details It removes the first found node that satisfy to the input parameters. Make sure that
pair (point, payload) is unique for each node, othewise the first found is removed.
@param[in] point (list): Coordinates of ... | pyclustering/container/kdtree.py | def remove(self, point, **kwargs):
"""!
@brief Remove specified point from kd-tree.
@details It removes the first found node that satisfy to the input parameters. Make sure that
pair (point, payload) is unique for each node, othewise the first found is removed.
... | def remove(self, point, **kwargs):
"""!
@brief Remove specified point from kd-tree.
@details It removes the first found node that satisfy to the input parameters. Make sure that
pair (point, payload) is unique for each node, othewise the first found is removed.
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/container/kdtree.py#L250-L290 | [
"def",
"remove",
"(",
"self",
",",
"point",
",",
"*",
"*",
"kwargs",
")",
":",
"# Get required node\r",
"node_for_remove",
"=",
"None",
"if",
"'payload'",
"in",
"kwargs",
":",
"node_for_remove",
"=",
"self",
".",
"find_node_with_payload",
"(",
"point",
",",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | kdtree.__recursive_remove | !
@brief Delete node and return root of subtree.
@param[in] node_removed (node): Node that should be removed.
@return (node) Minimal node in line with coordinate that is defined by descriminator. | pyclustering/container/kdtree.py | def __recursive_remove(self, node_removed):
"""!
@brief Delete node and return root of subtree.
@param[in] node_removed (node): Node that should be removed.
@return (node) Minimal node in line with coordinate that is defined by descriminator.
""... | def __recursive_remove(self, node_removed):
"""!
@brief Delete node and return root of subtree.
@param[in] node_removed (node): Node that should be removed.
@return (node) Minimal node in line with coordinate that is defined by descriminator.
""... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/container/kdtree.py#L293-L335 | [
"def",
"__recursive_remove",
"(",
"self",
",",
"node_removed",
")",
":",
"# Check if it is leaf\r",
"if",
"(",
"node_removed",
".",
"right",
"is",
"None",
")",
"and",
"(",
"node_removed",
".",
"left",
"is",
"None",
")",
":",
"return",
"None",
"discriminator",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | kdtree.find_minimal_node | !
@brief Find minimal node in line with coordinate that is defined by discriminator.
@param[in] node_head (node): Node of KD tree from that search should be started.
@param[in] discriminator (uint): Coordinate number that is used for comparison.
@return (node) Min... | pyclustering/container/kdtree.py | def find_minimal_node(self, node_head, discriminator):
"""!
@brief Find minimal node in line with coordinate that is defined by discriminator.
@param[in] node_head (node): Node of KD tree from that search should be started.
@param[in] discriminator (uint): Coordinate number... | def find_minimal_node(self, node_head, discriminator):
"""!
@brief Find minimal node in line with coordinate that is defined by discriminator.
@param[in] node_head (node): Node of KD tree from that search should be started.
@param[in] discriminator (uint): Coordinate number... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/container/kdtree.py#L338-L365 | [
"def",
"find_minimal_node",
"(",
"self",
",",
"node_head",
",",
"discriminator",
")",
":",
"min_key",
"=",
"lambda",
"cur_node",
":",
"cur_node",
".",
"data",
"[",
"discriminator",
"]",
"stack",
"=",
"[",
"]",
"candidates",
"=",
"[",
"]",
"isFinished",
"="... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | kdtree.__fill_tree | !
@brief Fill KD-tree by specified data and create point comparator in line with data type.
@param[in] data_list (array_like): Data points that should be inserted to the tree.
@param[in] payload_list (array_like): Data point payloads that follows data points inserted to the tree. | pyclustering/container/kdtree.py | def __fill_tree(self, data_list, payload_list):
"""!
@brief Fill KD-tree by specified data and create point comparator in line with data type.
@param[in] data_list (array_like): Data points that should be inserted to the tree.
@param[in] payload_list (array_like): Data point payloa... | def __fill_tree(self, data_list, payload_list):
"""!
@brief Fill KD-tree by specified data and create point comparator in line with data type.
@param[in] data_list (array_like): Data points that should be inserted to the tree.
@param[in] payload_list (array_like): Data point payloa... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/container/kdtree.py#L368-L388 | [
"def",
"__fill_tree",
"(",
"self",
",",
"data_list",
",",
"payload_list",
")",
":",
"if",
"data_list",
"is",
"None",
"or",
"len",
"(",
"data_list",
")",
"==",
"0",
":",
"return",
"# Just return from here, tree can be filled by insert method later\r",
"if",
"payload_... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | kdtree.__create_point_comparator | !
@brief Create point comparator.
@details In case of numpy.array specific comparator is required.
@param[in] type_point (data_type): Type of point that is stored in KD-node.
@return (callable) Callable point comparator to compare to points. | pyclustering/container/kdtree.py | def __create_point_comparator(self, type_point):
"""!
@brief Create point comparator.
@details In case of numpy.array specific comparator is required.
@param[in] type_point (data_type): Type of point that is stored in KD-node.
@return (callable) Callable point comparator... | def __create_point_comparator(self, type_point):
"""!
@brief Create point comparator.
@details In case of numpy.array specific comparator is required.
@param[in] type_point (data_type): Type of point that is stored in KD-node.
@return (callable) Callable point comparator... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/container/kdtree.py#L391-L404 | [
"def",
"__create_point_comparator",
"(",
"self",
",",
"type_point",
")",
":",
"if",
"type_point",
"==",
"numpy",
".",
"ndarray",
":",
"return",
"lambda",
"obj1",
",",
"obj2",
":",
"numpy",
".",
"array_equal",
"(",
"obj1",
",",
"obj2",
")",
"return",
"lambd... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | kdtree.__find_node_by_rule | !
@brief Search node that satisfy to parameters in search rule.
@details If node with specified parameters does not exist then None will be returned,
otherwise required node will be returned.
@param[in] point (list): Coordinates of the point whose node should be ... | pyclustering/container/kdtree.py | def __find_node_by_rule(self, point, search_rule, cur_node):
"""!
@brief Search node that satisfy to parameters in search rule.
@details If node with specified parameters does not exist then None will be returned,
otherwise required node will be returned.
... | def __find_node_by_rule(self, point, search_rule, cur_node):
"""!
@brief Search node that satisfy to parameters in search rule.
@details If node with specified parameters does not exist then None will be returned,
otherwise required node will be returned.
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/container/kdtree.py#L407-L438 | [
"def",
"__find_node_by_rule",
"(",
"self",
",",
"point",
",",
"search_rule",
",",
"cur_node",
")",
":",
"req_node",
"=",
"None",
"if",
"cur_node",
"is",
"None",
":",
"cur_node",
"=",
"self",
".",
"__root",
"while",
"cur_node",
":",
"if",
"cur_node",
".",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | kdtree.find_node_with_payload | !
@brief Find node with specified coordinates and payload.
@details If node with specified parameters does not exist then None will be returned,
otherwise required node will be returned.
@param[in] point (list): Coordinates of the point whose node should be found... | pyclustering/container/kdtree.py | def find_node_with_payload(self, point, point_payload, cur_node = None):
"""!
@brief Find node with specified coordinates and payload.
@details If node with specified parameters does not exist then None will be returned,
otherwise required node will be returned.
... | def find_node_with_payload(self, point, point_payload, cur_node = None):
"""!
@brief Find node with specified coordinates and payload.
@details If node with specified parameters does not exist then None will be returned,
otherwise required node will be returned.
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/container/kdtree.py#L441-L456 | [
"def",
"find_node_with_payload",
"(",
"self",
",",
"point",
",",
"point_payload",
",",
"cur_node",
"=",
"None",
")",
":",
"rule_search",
"=",
"lambda",
"node",
",",
"point",
"=",
"point",
",",
"payload",
"=",
"point_payload",
":",
"self",
".",
"__point_compa... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | kdtree.find_node | !
@brief Find node with coordinates that are defined by specified point.
@details If node with specified parameters does not exist then None will be returned,
otherwise required node will be returned.
@param[in] point (list): Coordinates of the point whose node s... | pyclustering/container/kdtree.py | def find_node(self, point, cur_node = None):
"""!
@brief Find node with coordinates that are defined by specified point.
@details If node with specified parameters does not exist then None will be returned,
otherwise required node will be returned.
@para... | def find_node(self, point, cur_node = None):
"""!
@brief Find node with coordinates that are defined by specified point.
@details If node with specified parameters does not exist then None will be returned,
otherwise required node will be returned.
@para... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/container/kdtree.py#L459-L473 | [
"def",
"find_node",
"(",
"self",
",",
"point",
",",
"cur_node",
"=",
"None",
")",
":",
"rule_search",
"=",
"lambda",
"node",
",",
"point",
"=",
"point",
":",
"self",
".",
"__point_comparator",
"(",
"node",
".",
"data",
",",
"point",
")",
"return",
"sel... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | kdtree.find_nearest_dist_node | !
@brief Find nearest neighbor in area with radius = distance.
@param[in] point (list): Maximum distance where neighbors are searched.
@param[in] distance (double): Maximum distance where neighbors are searched.
@param[in] retdistance (bool): If True - returns neighbors wit... | pyclustering/container/kdtree.py | def find_nearest_dist_node(self, point, distance, retdistance = False):
"""!
@brief Find nearest neighbor in area with radius = distance.
@param[in] point (list): Maximum distance where neighbors are searched.
@param[in] distance (double): Maximum distance where neighbors a... | def find_nearest_dist_node(self, point, distance, retdistance = False):
"""!
@brief Find nearest neighbor in area with radius = distance.
@param[in] point (list): Maximum distance where neighbors are searched.
@param[in] distance (double): Maximum distance where neighbors a... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/container/kdtree.py#L476-L499 | [
"def",
"find_nearest_dist_node",
"(",
"self",
",",
"point",
",",
"distance",
",",
"retdistance",
"=",
"False",
")",
":",
"best_nodes",
"=",
"self",
".",
"find_nearest_dist_nodes",
"(",
"point",
",",
"distance",
")",
"if",
"best_nodes",
"==",
"[",
"]",
":",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | kdtree.find_nearest_dist_nodes | !
@brief Find neighbors that are located in area that is covered by specified distance.
@param[in] point (list): Coordinates that is considered as centroind for searching.
@param[in] distance (double): Distance from the center where seaching is performed.
@return ... | pyclustering/container/kdtree.py | def find_nearest_dist_nodes(self, point, distance):
"""!
@brief Find neighbors that are located in area that is covered by specified distance.
@param[in] point (list): Coordinates that is considered as centroind for searching.
@param[in] distance (double): Distance from the... | def find_nearest_dist_nodes(self, point, distance):
"""!
@brief Find neighbors that are located in area that is covered by specified distance.
@param[in] point (list): Coordinates that is considered as centroind for searching.
@param[in] distance (double): Distance from the... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/container/kdtree.py#L502-L517 | [
"def",
"find_nearest_dist_nodes",
"(",
"self",
",",
"point",
",",
"distance",
")",
":",
"best_nodes",
"=",
"[",
"]",
"if",
"self",
".",
"__root",
"is",
"not",
"None",
":",
"self",
".",
"__recursive_nearest_nodes",
"(",
"point",
",",
"distance",
",",
"dista... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | kdtree.__recursive_nearest_nodes | !
@brief Returns list of neighbors such as tuple (distance, node) that is located in area that is covered by distance.
@param[in] point (list): Coordinates that is considered as centroind for searching
@param[in] distance (double): Distance from the center where seaching is performe... | pyclustering/container/kdtree.py | def __recursive_nearest_nodes(self, point, distance, sqrt_distance, node_head, best_nodes):
"""!
@brief Returns list of neighbors such as tuple (distance, node) that is located in area that is covered by distance.
@param[in] point (list): Coordinates that is considered as centroind ... | def __recursive_nearest_nodes(self, point, distance, sqrt_distance, node_head, best_nodes):
"""!
@brief Returns list of neighbors such as tuple (distance, node) that is located in area that is covered by distance.
@param[in] point (list): Coordinates that is considered as centroind ... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/container/kdtree.py#L520-L544 | [
"def",
"__recursive_nearest_nodes",
"(",
"self",
",",
"point",
",",
"distance",
",",
"sqrt_distance",
",",
"node_head",
",",
"best_nodes",
")",
":",
"if",
"node_head",
".",
"right",
"is",
"not",
"None",
":",
"minimum",
"=",
"node_head",
".",
"data",
"[",
"... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | kdtree.children | !
@brief Returns list of children of node.
@param[in] node_parent (node): Node whose children are required.
@return (list) Children of node. If node haven't got any child then None is returned. | pyclustering/container/kdtree.py | def children(self, node_parent):
"""!
@brief Returns list of children of node.
@param[in] node_parent (node): Node whose children are required.
@return (list) Children of node. If node haven't got any child then None is returned.
"""
... | def children(self, node_parent):
"""!
@brief Returns list of children of node.
@param[in] node_parent (node): Node whose children are required.
@return (list) Children of node. If node haven't got any child then None is returned.
"""
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/container/kdtree.py#L547-L560 | [
"def",
"children",
"(",
"self",
",",
"node_parent",
")",
":",
"if",
"node_parent",
".",
"left",
"is",
"not",
"None",
":",
"yield",
"node_parent",
".",
"left",
"if",
"node_parent",
".",
"right",
"is",
"not",
"None",
":",
"yield",
"node_parent",
".",
"righ... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | kdtree.traverse | !
@brief Traverses all nodes of subtree that is defined by node specified in input parameter.
@param[in] start_node (node): Node from that travering of subtree is performed.
@param[in, out] level (uint): Should be ignored by application.
@return (list) All nodes o... | pyclustering/container/kdtree.py | def traverse(self, start_node = None, level = None):
"""!
@brief Traverses all nodes of subtree that is defined by node specified in input parameter.
@param[in] start_node (node): Node from that travering of subtree is performed.
@param[in, out] level (uint): Should be igno... | def traverse(self, start_node = None, level = None):
"""!
@brief Traverses all nodes of subtree that is defined by node specified in input parameter.
@param[in] start_node (node): Node from that travering of subtree is performed.
@param[in, out] level (uint): Should be igno... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/container/kdtree.py#L563-L586 | [
"def",
"traverse",
"(",
"self",
",",
"start_node",
"=",
"None",
",",
"level",
"=",
"None",
")",
":",
"if",
"start_node",
"is",
"None",
":",
"start_node",
"=",
"self",
".",
"__root",
"level",
"=",
"0",
"if",
"start_node",
"is",
"None",
":",
"return",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.