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
Launcher._setup_launch
Method to be used by all launchers that prepares the root directory and generate basic launch information for command templates to use (including a registered timestamp).
lancet/launch.py
def _setup_launch(self): """ Method to be used by all launchers that prepares the root directory and generate basic launch information for command templates to use (including a registered timestamp). """ self.root_directory = self.get_root_directory() if not os.pa...
def _setup_launch(self): """ Method to be used by all launchers that prepares the root directory and generate basic launch information for command templates to use (including a registered timestamp). """ self.root_directory = self.get_root_directory() if not os.pa...
[ "Method", "to", "be", "used", "by", "all", "launchers", "that", "prepares", "the", "root", "directory", "and", "generate", "basic", "launch", "information", "for", "command", "templates", "to", "use", "(", "including", "a", "registered", "timestamp", ")", "." ...
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/launch.py#L514-L541
[ "def", "_setup_launch", "(", "self", ")", ":", "self", ".", "root_directory", "=", "self", ".", "get_root_directory", "(", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "self", ".", "root_directory", ")", ":", "os", ".", "makedirs", "(", "sel...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
Launcher._launch_process_group
Launches processes defined by process_commands, but only executes max_concurrency processes at a time; if a process completes and there are still outstanding processes to be executed, the next processes are run until max_concurrency is reached again.
lancet/launch.py
def _launch_process_group(self, process_commands, streams_path): """ Launches processes defined by process_commands, but only executes max_concurrency processes at a time; if a process completes and there are still outstanding processes to be executed, the next processes are run ...
def _launch_process_group(self, process_commands, streams_path): """ Launches processes defined by process_commands, but only executes max_concurrency processes at a time; if a process completes and there are still outstanding processes to be executed, the next processes are run ...
[ "Launches", "processes", "defined", "by", "process_commands", "but", "only", "executes", "max_concurrency", "processes", "at", "a", "time", ";", "if", "a", "process", "completes", "and", "there", "are", "still", "outstanding", "processes", "to", "be", "executed", ...
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/launch.py#L553-L604
[ "def", "_launch_process_group", "(", "self", ",", "process_commands", ",", "streams_path", ")", ":", "processes", "=", "{", "}", "def", "check_complete_processes", "(", "wait", "=", "False", ")", ":", "\"\"\"\n Returns True if a process completed, False otherwi...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
Launcher.summary
A succinct summary of the Launcher configuration. Unlike the repr, a summary does not have to be complete but must supply key information relevant to the user.
lancet/launch.py
def summary(self): """ A succinct summary of the Launcher configuration. Unlike the repr, a summary does not have to be complete but must supply key information relevant to the user. """ print("Type: %s" % self.__class__.__name__) print("Batch Name: %r" % self.ba...
def summary(self): """ A succinct summary of the Launcher configuration. Unlike the repr, a summary does not have to be complete but must supply key information relevant to the user. """ print("Type: %s" % self.__class__.__name__) print("Batch Name: %r" % self.ba...
[ "A", "succinct", "summary", "of", "the", "Launcher", "configuration", ".", "Unlike", "the", "repr", "a", "summary", "does", "not", "have", "to", "be", "complete", "but", "must", "supply", "key", "information", "relevant", "to", "the", "user", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/launch.py#L640-L653
[ "def", "summary", "(", "self", ")", ":", "print", "(", "\"Type: %s\"", "%", "self", ".", "__class__", ".", "__name__", ")", "print", "(", "\"Batch Name: %r\"", "%", "self", ".", "batch_name", ")", "if", "self", ".", "tag", ":", "print", "(", "\"Tag: %s\"...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
QLauncher._qsub_args
Method to generate Popen style argument list for qsub using the qsub_switches and qsub_flag_options parameters. Switches are returned first. The qsub_flag_options follow in keys() ordered if not a vanilla Python dictionary (ie. a Python 2.7+ or param.external OrderedDict). Otherwise the...
lancet/launch.py
def _qsub_args(self, override_options, cmd_args, append_options=[]): """ Method to generate Popen style argument list for qsub using the qsub_switches and qsub_flag_options parameters. Switches are returned first. The qsub_flag_options follow in keys() ordered if not a vanilla Py...
def _qsub_args(self, override_options, cmd_args, append_options=[]): """ Method to generate Popen style argument list for qsub using the qsub_switches and qsub_flag_options parameters. Switches are returned first. The qsub_flag_options follow in keys() ordered if not a vanilla Py...
[ "Method", "to", "generate", "Popen", "style", "argument", "list", "for", "qsub", "using", "the", "qsub_switches", "and", "qsub_flag_options", "parameters", ".", "Switches", "are", "returned", "first", ".", "The", "qsub_flag_options", "follow", "in", "keys", "()", ...
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/launch.py#L707-L739
[ "def", "_qsub_args", "(", "self", ",", "override_options", ",", "cmd_args", ",", "append_options", "=", "[", "]", ")", ":", "opt_dict", "=", "type", "(", "self", ".", "qsub_flag_options", ")", "(", ")", "opt_dict", ".", "update", "(", "self", ".", "qsub_...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
QLauncher.collate_and_launch
Method that collates the previous jobs and launches the next block of concurrent jobs when using DynamicArgs. This method is invoked on initial launch and then subsequently via a commandline call (to Python via qsub) to collate the previously run jobs and launch the next block of jobs.
lancet/launch.py
def collate_and_launch(self): """ Method that collates the previous jobs and launches the next block of concurrent jobs when using DynamicArgs. This method is invoked on initial launch and then subsequently via a commandline call (to Python via qsub) to collate the previo...
def collate_and_launch(self): """ Method that collates the previous jobs and launches the next block of concurrent jobs when using DynamicArgs. This method is invoked on initial launch and then subsequently via a commandline call (to Python via qsub) to collate the previo...
[ "Method", "that", "collates", "the", "previous", "jobs", "and", "launches", "the", "next", "block", "of", "concurrent", "jobs", "when", "using", "DynamicArgs", ".", "This", "method", "is", "invoked", "on", "initial", "launch", "and", "then", "subsequently", "v...
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/launch.py#L761-L794
[ "def", "collate_and_launch", "(", "self", ")", ":", "try", ":", "specs", "=", "next", "(", "self", ".", "spec_iter", ")", "except", "StopIteration", ":", "self", ".", "qdel_batch", "(", ")", "if", "self", ".", "reduction_fn", "is", "not", "None", ":", ...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
QLauncher._qsub_collate_and_launch
The method that actually runs qsub to invoke the python process with the necessary commands to trigger the next collation step and next block of jobs.
lancet/launch.py
def _qsub_collate_and_launch(self, output_dir, error_dir, job_names): """ The method that actually runs qsub to invoke the python process with the necessary commands to trigger the next collation step and next block of jobs. """ job_name = "%s_%s_collate_%d" % (self.batc...
def _qsub_collate_and_launch(self, output_dir, error_dir, job_names): """ The method that actually runs qsub to invoke the python process with the necessary commands to trigger the next collation step and next block of jobs. """ job_name = "%s_%s_collate_%d" % (self.batc...
[ "The", "method", "that", "actually", "runs", "qsub", "to", "invoke", "the", "python", "process", "with", "the", "necessary", "commands", "to", "trigger", "the", "next", "collation", "step", "and", "next", "block", "of", "jobs", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/launch.py#L796-L829
[ "def", "_qsub_collate_and_launch", "(", "self", ",", "output_dir", ",", "error_dir", ",", "job_names", ")", ":", "job_name", "=", "\"%s_%s_collate_%d\"", "%", "(", "self", ".", "batch_name", ",", "self", ".", "job_timestamp", ",", "self", ".", "collate_count", ...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
QLauncher._qsub_block
This method handles static argument specifiers and cases where the dynamic specifiers cannot be queued before the arguments are known.
lancet/launch.py
def _qsub_block(self, output_dir, error_dir, tid_specs): """ This method handles static argument specifiers and cases where the dynamic specifiers cannot be queued before the arguments are known. """ processes = [] job_names = [] for (tid, spec) in tid_sp...
def _qsub_block(self, output_dir, error_dir, tid_specs): """ This method handles static argument specifiers and cases where the dynamic specifiers cannot be queued before the arguments are known. """ processes = [] job_names = [] for (tid, spec) in tid_sp...
[ "This", "method", "handles", "static", "argument", "specifiers", "and", "cases", "where", "the", "dynamic", "specifiers", "cannot", "be", "queued", "before", "the", "arguments", "are", "known", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/launch.py#L831-L860
[ "def", "_qsub_block", "(", "self", ",", "output_dir", ",", "error_dir", ",", "tid_specs", ")", ":", "processes", "=", "[", "]", "job_names", "=", "[", "]", "for", "(", "tid", ",", "spec", ")", "in", "tid_specs", ":", "job_name", "=", "\"%s_%s_tid_%d\"", ...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
QLauncher.qdel_batch
Runs qdel command to remove all remaining queued jobs using the <batch_name>* pattern . Necessary when StopIteration is raised with scheduled jobs left on the queue. Returns exit-code of qdel.
lancet/launch.py
def qdel_batch(self): """ Runs qdel command to remove all remaining queued jobs using the <batch_name>* pattern . Necessary when StopIteration is raised with scheduled jobs left on the queue. Returns exit-code of qdel. """ p = subprocess.Popen(['qdel', '%s_%s*' % ...
def qdel_batch(self): """ Runs qdel command to remove all remaining queued jobs using the <batch_name>* pattern . Necessary when StopIteration is raised with scheduled jobs left on the queue. Returns exit-code of qdel. """ p = subprocess.Popen(['qdel', '%s_%s*' % ...
[ "Runs", "qdel", "command", "to", "remove", "all", "remaining", "queued", "jobs", "using", "the", "<batch_name", ">", "*", "pattern", ".", "Necessary", "when", "StopIteration", "is", "raised", "with", "scheduled", "jobs", "left", "on", "the", "queue", ".", "R...
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/launch.py#L863-L874
[ "def", "qdel_batch", "(", "self", ")", ":", "p", "=", "subprocess", ".", "Popen", "(", "[", "'qdel'", ",", "'%s_%s*'", "%", "(", "self", ".", "batch_name", ",", "self", ".", "job_timestamp", ")", "]", ",", "stdout", "=", "subprocess", ".", "PIPE", ")...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
ScriptLauncher._launch_process_group
Aggregates all process_commands and the designated output files into a list, and outputs it as JSON, after which the wrapper script is called.
lancet/launch.py
def _launch_process_group(self, process_commands, streams_path): """ Aggregates all process_commands and the designated output files into a list, and outputs it as JSON, after which the wrapper script is called. """ processes = [] for cmd, tid in process_commands: ...
def _launch_process_group(self, process_commands, streams_path): """ Aggregates all process_commands and the designated output files into a list, and outputs it as JSON, after which the wrapper script is called. """ processes = [] for cmd, tid in process_commands: ...
[ "Aggregates", "all", "process_commands", "and", "the", "designated", "output", "files", "into", "a", "list", "and", "outputs", "it", "as", "JSON", "after", "which", "the", "wrapper", "script", "is", "called", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/launch.py#L895-L921
[ "def", "_launch_process_group", "(", "self", ",", "process_commands", ",", "streams_path", ")", ":", "processes", "=", "[", "]", "for", "cmd", ",", "tid", "in", "process_commands", ":", "job_timestamp", "=", "time", ".", "strftime", "(", "'%H%M%S'", ")", "ba...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
review_and_launch.cross_check_launchers
Performs consistency checks across all the launchers.
lancet/launch.py
def cross_check_launchers(self, launchers): """ Performs consistency checks across all the launchers. """ if len(launchers) == 0: raise Exception('Empty launcher list') timestamps = [launcher.timestamp for launcher in launchers] if not all(timestamps[0] == tstamp for tst...
def cross_check_launchers(self, launchers): """ Performs consistency checks across all the launchers. """ if len(launchers) == 0: raise Exception('Empty launcher list') timestamps = [launcher.timestamp for launcher in launchers] if not all(timestamps[0] == tstamp for tst...
[ "Performs", "consistency", "checks", "across", "all", "the", "launchers", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/launch.py#L955-L976
[ "def", "cross_check_launchers", "(", "self", ",", "launchers", ")", ":", "if", "len", "(", "launchers", ")", "==", "0", ":", "raise", "Exception", "(", "'Empty launcher list'", ")", "timestamps", "=", "[", "launcher", ".", "timestamp", "for", "launcher", "in...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
review_and_launch._launch_all
Launches all available launchers.
lancet/launch.py
def _launch_all(self, launchers): """ Launches all available launchers. """ for launcher in launchers: print("== Launching %s ==" % launcher.batch_name) launcher() return True
def _launch_all(self, launchers): """ Launches all available launchers. """ for launcher in launchers: print("== Launching %s ==" % launcher.batch_name) launcher() return True
[ "Launches", "all", "available", "launchers", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/launch.py#L1010-L1017
[ "def", "_launch_all", "(", "self", ",", "launchers", ")", ":", "for", "launcher", "in", "launchers", ":", "print", "(", "\"== Launching %s ==\"", "%", "launcher", ".", "batch_name", ")", "launcher", "(", ")", "return", "True" ]
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
review_and_launch._review_all
Runs the review process for all the launchers.
lancet/launch.py
def _review_all(self, launchers): """ Runs the review process for all the launchers. """ # Run review of launch args if necessary if self.launch_args is not None: proceed = self.review_args(self.launch_args, show_repr=True, ...
def _review_all(self, launchers): """ Runs the review process for all the launchers. """ # Run review of launch args if necessary if self.launch_args is not None: proceed = self.review_args(self.launch_args, show_repr=True, ...
[ "Runs", "the", "review", "process", "for", "all", "the", "launchers", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/launch.py#L1019-L1051
[ "def", "_review_all", "(", "self", ",", "launchers", ")", ":", "# Run review of launch args if necessary", "if", "self", ".", "launch_args", "is", "not", "None", ":", "proceed", "=", "self", ".", "review_args", "(", "self", ".", "launch_args", ",", "show_repr", ...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
review_and_launch.review_args
Reviews the given argument specification. Can review the meta-arguments (launch_args) or the arguments themselves.
lancet/launch.py
def review_args(self, obj, show_repr=False, heading='Arguments'): """ Reviews the given argument specification. Can review the meta-arguments (launch_args) or the arguments themselves. """ args = obj.args if isinstance(obj, Launcher) else obj print('\n%s\n' % self.summary...
def review_args(self, obj, show_repr=False, heading='Arguments'): """ Reviews the given argument specification. Can review the meta-arguments (launch_args) or the arguments themselves. """ args = obj.args if isinstance(obj, Launcher) else obj print('\n%s\n' % self.summary...
[ "Reviews", "the", "given", "argument", "specification", ".", "Can", "review", "the", "meta", "-", "arguments", "(", "launch_args", ")", "or", "the", "arguments", "themselves", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/launch.py#L1063-L1077
[ "def", "review_args", "(", "self", ",", "obj", ",", "show_repr", "=", "False", ",", "heading", "=", "'Arguments'", ")", ":", "args", "=", "obj", ".", "args", "if", "isinstance", "(", "obj", ",", "Launcher", ")", "else", "obj", "print", "(", "'\\n%s\\n'...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
review_and_launch.input_options
Helper to prompt the user for input on the commandline.
lancet/launch.py
def input_options(self, options, prompt='Select option', default=None): """ Helper to prompt the user for input on the commandline. """ check_options = [x.lower() for x in options] while True: response = input('%s [%s]: ' % (prompt, ', '.join(options))).lower() ...
def input_options(self, options, prompt='Select option', default=None): """ Helper to prompt the user for input on the commandline. """ check_options = [x.lower() for x in options] while True: response = input('%s [%s]: ' % (prompt, ', '.join(options))).lower() ...
[ "Helper", "to", "prompt", "the", "user", "for", "input", "on", "the", "commandline", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/launch.py#L1107-L1116
[ "def", "input_options", "(", "self", ",", "options", ",", "prompt", "=", "'Select option'", ",", "default", "=", "None", ")", ":", "check_options", "=", "[", "x", ".", "lower", "(", ")", "for", "x", "in", "options", "]", "while", "True", ":", "response...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
FileType.save
The implementation in the base class simply checks there is no clash between the metadata and data keys.
lancet/filetypes.py
def save(self, filename, metadata={}, **data): """ The implementation in the base class simply checks there is no clash between the metadata and data keys. """ intersection = set(metadata.keys()) & set(data.keys()) if intersection: msg = 'Key(s) overlap betwe...
def save(self, filename, metadata={}, **data): """ The implementation in the base class simply checks there is no clash between the metadata and data keys. """ intersection = set(metadata.keys()) & set(data.keys()) if intersection: msg = 'Key(s) overlap betwe...
[ "The", "implementation", "in", "the", "base", "class", "simply", "checks", "there", "is", "no", "clash", "between", "the", "metadata", "and", "data", "keys", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/filetypes.py#L40-L48
[ "def", "save", "(", "self", ",", "filename", ",", "metadata", "=", "{", "}", ",", "*", "*", "data", ")", ":", "intersection", "=", "set", "(", "metadata", ".", "keys", "(", ")", ")", "&", "set", "(", "data", ".", "keys", "(", ")", ")", "if", ...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
FileType._savepath
Returns the full path for saving the file, adding an extension and making the filename unique as necessary.
lancet/filetypes.py
def _savepath(self, filename): """ Returns the full path for saving the file, adding an extension and making the filename unique as necessary. """ (basename, ext) = os.path.splitext(filename) basename = basename if (ext in self.extensions) else filename ext = ext ...
def _savepath(self, filename): """ Returns the full path for saving the file, adding an extension and making the filename unique as necessary. """ (basename, ext) = os.path.splitext(filename) basename = basename if (ext in self.extensions) else filename ext = ext ...
[ "Returns", "the", "full", "path", "for", "saving", "the", "file", "adding", "an", "extension", "and", "making", "the", "filename", "unique", "as", "necessary", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/filetypes.py#L69-L80
[ "def", "_savepath", "(", "self", ",", "filename", ")", ":", "(", "basename", ",", "ext", ")", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "basename", "=", "basename", "if", "(", "ext", "in", "self", ".", "extensions", ")", "else", ...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
FileType.file_supported
Returns a boolean indicating whether the filename has an appropriate extension for this class.
lancet/filetypes.py
def file_supported(cls, filename): """ Returns a boolean indicating whether the filename has an appropriate extension for this class. """ if not isinstance(filename, str): return False (_, ext) = os.path.splitext(filename) if ext not in cls.extensions:...
def file_supported(cls, filename): """ Returns a boolean indicating whether the filename has an appropriate extension for this class. """ if not isinstance(filename, str): return False (_, ext) = os.path.splitext(filename) if ext not in cls.extensions:...
[ "Returns", "a", "boolean", "indicating", "whether", "the", "filename", "has", "an", "appropriate", "extension", "for", "this", "class", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/filetypes.py#L83-L94
[ "def", "file_supported", "(", "cls", ",", "filename", ")", ":", "if", "not", "isinstance", "(", "filename", ",", "str", ")", ":", "return", "False", "(", "_", ",", "ext", ")", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "if", "ex...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
ImageFile.save
Data may be either a PIL Image object or a Numpy array.
lancet/filetypes.py
def save(self, filename, imdata, **data): """ Data may be either a PIL Image object or a Numpy array. """ if isinstance(imdata, numpy.ndarray): imdata = Image.fromarray(numpy.uint8(imdata)) elif isinstance(imdata, Image.Image): imdata.save(self._savepath(f...
def save(self, filename, imdata, **data): """ Data may be either a PIL Image object or a Numpy array. """ if isinstance(imdata, numpy.ndarray): imdata = Image.fromarray(numpy.uint8(imdata)) elif isinstance(imdata, Image.Image): imdata.save(self._savepath(f...
[ "Data", "may", "be", "either", "a", "PIL", "Image", "object", "or", "a", "Numpy", "array", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/filetypes.py#L321-L328
[ "def", "save", "(", "self", ",", "filename", ",", "imdata", ",", "*", "*", "data", ")", ":", "if", "isinstance", "(", "imdata", ",", "numpy", ".", "ndarray", ")", ":", "imdata", "=", "Image", ".", "fromarray", "(", "numpy", ".", "uint8", "(", "imda...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
fileModifiedTimestamp
return "YYYY-MM-DD" when the file was modified.
swhlab/tools/activeFolders/scan.py
def fileModifiedTimestamp(fname): """return "YYYY-MM-DD" when the file was modified.""" modifiedTime=os.path.getmtime(fname) stamp=time.strftime('%Y-%m-%d', time.localtime(modifiedTime)) return stamp
def fileModifiedTimestamp(fname): """return "YYYY-MM-DD" when the file was modified.""" modifiedTime=os.path.getmtime(fname) stamp=time.strftime('%Y-%m-%d', time.localtime(modifiedTime)) return stamp
[ "return", "YYYY", "-", "MM", "-", "DD", "when", "the", "file", "was", "modified", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/tools/activeFolders/scan.py#L13-L17
[ "def", "fileModifiedTimestamp", "(", "fname", ")", ":", "modifiedTime", "=", "os", ".", "path", ".", "getmtime", "(", "fname", ")", "stamp", "=", "time", ".", "strftime", "(", "'%Y-%m-%d'", ",", "time", ".", "localtime", "(", "modifiedTime", ")", ")", "r...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
loadResults
returns a dict of active folders with days as keys.
swhlab/tools/activeFolders/scan.py
def loadResults(resultsFile): """returns a dict of active folders with days as keys.""" with open(resultsFile) as f: raw=f.read().split("\n") foldersByDay={} for line in raw: folder=line.split('"')[1]+"\\" line=[]+line.split('"')[2].split(", ") for day in line[1:]...
def loadResults(resultsFile): """returns a dict of active folders with days as keys.""" with open(resultsFile) as f: raw=f.read().split("\n") foldersByDay={} for line in raw: folder=line.split('"')[1]+"\\" line=[]+line.split('"')[2].split(", ") for day in line[1:]...
[ "returns", "a", "dict", "of", "active", "folders", "with", "days", "as", "keys", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/tools/activeFolders/scan.py#L45-L72
[ "def", "loadResults", "(", "resultsFile", ")", ":", "with", "open", "(", "resultsFile", ")", "as", "f", ":", "raw", "=", "f", ".", "read", "(", ")", ".", "split", "(", "\"\\n\"", ")", "foldersByDay", "=", "{", "}", "for", "line", "in", "raw", ":", ...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
HTML_results
generates HTML report of active folders/days.
swhlab/tools/activeFolders/scan.py
def HTML_results(resultsFile): """generates HTML report of active folders/days.""" foldersByDay=loadResults(resultsFile) # optionally skip dates before a certain date # for day in sorted(list(foldersByDay.keys())): # if time.strptime(day,"%Y-%m-%d")<time.strptime("2016-05-01","%Y-%m-%d"): ...
def HTML_results(resultsFile): """generates HTML report of active folders/days.""" foldersByDay=loadResults(resultsFile) # optionally skip dates before a certain date # for day in sorted(list(foldersByDay.keys())): # if time.strptime(day,"%Y-%m-%d")<time.strptime("2016-05-01","%Y-%m-%d"): ...
[ "generates", "HTML", "report", "of", "active", "folders", "/", "days", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/tools/activeFolders/scan.py#L120-L188
[ "def", "HTML_results", "(", "resultsFile", ")", ":", "foldersByDay", "=", "loadResults", "(", "resultsFile", ")", "# optionally skip dates before a certain date\r", "# for day in sorted(list(foldersByDay.keys())):\r", "# if time.strptime(day,\"%Y-%m-%d\")<time.strptime(\"2016-0...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
quietParts
Given some data (Y) break it into chunks and return just the quiet ones. Returns data where the variance for its chunk size is below the given percentile. CHUNK_POINTS should be adjusted so it's about 10ms of data.
doc/uses/EPSCs-and-IPSCs/variance method/2016-12-16 tryout2.py
def quietParts(data,percentile=10): """ Given some data (Y) break it into chunks and return just the quiet ones. Returns data where the variance for its chunk size is below the given percentile. CHUNK_POINTS should be adjusted so it's about 10ms of data. """ nChunks=int(len(Y)/CHUNK_POINTS) ...
def quietParts(data,percentile=10): """ Given some data (Y) break it into chunks and return just the quiet ones. Returns data where the variance for its chunk size is below the given percentile. CHUNK_POINTS should be adjusted so it's about 10ms of data. """ nChunks=int(len(Y)/CHUNK_POINTS) ...
[ "Given", "some", "data", "(", "Y", ")", "break", "it", "into", "chunks", "and", "return", "just", "the", "quiet", "ones", ".", "Returns", "data", "where", "the", "variance", "for", "its", "chunk", "size", "is", "below", "the", "given", "percentile", ".",...
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/uses/EPSCs-and-IPSCs/variance method/2016-12-16 tryout2.py#L27-L40
[ "def", "quietParts", "(", "data", ",", "percentile", "=", "10", ")", ":", "nChunks", "=", "int", "(", "len", "(", "Y", ")", "/", "CHUNK_POINTS", ")", "chunks", "=", "np", ".", "reshape", "(", "Y", "[", ":", "nChunks", "*", "CHUNK_POINTS", "]", ",",...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
ndist
given some data and a list of X posistions, return the normal distribution curve as a Y point at each of those Xs.
doc/uses/EPSCs-and-IPSCs/variance method/2016-12-16 tryout2.py
def ndist(data,Xs): """ given some data and a list of X posistions, return the normal distribution curve as a Y point at each of those Xs. """ sigma=np.sqrt(np.var(data)) center=np.average(data) curve=mlab.normpdf(Xs,center,sigma) curve*=len(data)*HIST_RESOLUTION return curve
def ndist(data,Xs): """ given some data and a list of X posistions, return the normal distribution curve as a Y point at each of those Xs. """ sigma=np.sqrt(np.var(data)) center=np.average(data) curve=mlab.normpdf(Xs,center,sigma) curve*=len(data)*HIST_RESOLUTION return curve
[ "given", "some", "data", "and", "a", "list", "of", "X", "posistions", "return", "the", "normal", "distribution", "curve", "as", "a", "Y", "point", "at", "each", "of", "those", "Xs", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/uses/EPSCs-and-IPSCs/variance method/2016-12-16 tryout2.py#L42-L51
[ "def", "ndist", "(", "data", ",", "Xs", ")", ":", "sigma", "=", "np", ".", "sqrt", "(", "np", ".", "var", "(", "data", ")", ")", "center", "=", "np", ".", "average", "(", "data", ")", "curve", "=", "mlab", ".", "normpdf", "(", "Xs", ",", "cen...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
ABF.abfinfo
show basic info about ABF class variables.
doc/oldcode/swhlab/core/abf.py
def abfinfo(self,printToo=False,returnDict=False): """show basic info about ABF class variables.""" info="\n### ABF INFO ###\n" d={} for thingName in sorted(dir(self)): if thingName in ['cm','evIs','colormap','dataX','dataY', 'protoX','protoY']: ...
def abfinfo(self,printToo=False,returnDict=False): """show basic info about ABF class variables.""" info="\n### ABF INFO ###\n" d={} for thingName in sorted(dir(self)): if thingName in ['cm','evIs','colormap','dataX','dataY', 'protoX','protoY']: ...
[ "show", "basic", "info", "about", "ABF", "class", "variables", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/abf.py#L136-L165
[ "def", "abfinfo", "(", "self", ",", "printToo", "=", "False", ",", "returnDict", "=", "False", ")", ":", "info", "=", "\"\\n### ABF INFO ###\\n\"", "d", "=", "{", "}", "for", "thingName", "in", "sorted", "(", "dir", "(", "self", ")", ")", ":", "if", ...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
ABF.headerHTML
read the ABF header and save it HTML formatted.
doc/oldcode/swhlab/core/abf.py
def headerHTML(self,fname=None): """read the ABF header and save it HTML formatted.""" if fname is None: fname = self.fname.replace(".abf","_header.html") html="<html><body><code>" html+="<h2>abfinfo() for %s.abf</h2>"%self.ID html+=self.abfinfo().replace("<","&lt;")....
def headerHTML(self,fname=None): """read the ABF header and save it HTML formatted.""" if fname is None: fname = self.fname.replace(".abf","_header.html") html="<html><body><code>" html+="<h2>abfinfo() for %s.abf</h2>"%self.ID html+=self.abfinfo().replace("<","&lt;")....
[ "read", "the", "ABF", "header", "and", "save", "it", "HTML", "formatted", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/abf.py#L167-L183
[ "def", "headerHTML", "(", "self", ",", "fname", "=", "None", ")", ":", "if", "fname", "is", "None", ":", "fname", "=", "self", ".", "fname", ".", "replace", "(", "\".abf\"", ",", "\"_header.html\"", ")", "html", "=", "\"<html><body><code>\"", "html", "+=...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
ABF.generate_colormap
use 1 colormap for the whole abf. You can change it!.
doc/oldcode/swhlab/core/abf.py
def generate_colormap(self,colormap=None,reverse=False): """use 1 colormap for the whole abf. You can change it!.""" if colormap is None: colormap = pylab.cm.Dark2 self.cm=colormap self.colormap=[] for i in range(self.sweeps): #TODO: make this the only colormap ...
def generate_colormap(self,colormap=None,reverse=False): """use 1 colormap for the whole abf. You can change it!.""" if colormap is None: colormap = pylab.cm.Dark2 self.cm=colormap self.colormap=[] for i in range(self.sweeps): #TODO: make this the only colormap ...
[ "use", "1", "colormap", "for", "the", "whole", "abf", ".", "You", "can", "change", "it!", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/abf.py#L185-L194
[ "def", "generate_colormap", "(", "self", ",", "colormap", "=", "None", ",", "reverse", "=", "False", ")", ":", "if", "colormap", "is", "None", ":", "colormap", "=", "pylab", ".", "cm", ".", "Dark2", "self", ".", "cm", "=", "colormap", "self", ".", "c...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
ABF.setSweep
Load X/Y data for a particular sweep. determines if forced reload is needed, updates currentSweep, regenerates dataX (if not None),decimates,returns X/Y. Note that setSweep() takes 0.17ms to complete, so go for it!
doc/oldcode/swhlab/core/abf.py
def setSweep(self,sweep=0,force=False): """Load X/Y data for a particular sweep. determines if forced reload is needed, updates currentSweep, regenerates dataX (if not None),decimates,returns X/Y. Note that setSweep() takes 0.17ms to complete, so go for it! """ if sweep i...
def setSweep(self,sweep=0,force=False): """Load X/Y data for a particular sweep. determines if forced reload is needed, updates currentSweep, regenerates dataX (if not None),decimates,returns X/Y. Note that setSweep() takes 0.17ms to complete, so go for it! """ if sweep i...
[ "Load", "X", "/", "Y", "data", "for", "a", "particular", "sweep", ".", "determines", "if", "forced", "reload", "is", "needed", "updates", "currentSweep", "regenerates", "dataX", "(", "if", "not", "None", ")", "decimates", "returns", "X", "/", "Y", ".", "...
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/abf.py#L198-L238
[ "def", "setSweep", "(", "self", ",", "sweep", "=", "0", ",", "force", "=", "False", ")", ":", "if", "sweep", "is", "None", "or", "sweep", "is", "False", ":", "sweep", "=", "0", "if", "sweep", "<", "0", ":", "sweep", "=", "self", ".", "sweeps", ...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
ABF.sweep_genXs
generate sweepX (in seconds) to match sweepY
doc/oldcode/swhlab/core/abf.py
def sweep_genXs(self): """generate sweepX (in seconds) to match sweepY""" if self.decimateMethod: self.dataX=np.arange(len(self.dataY))/self.rate self.dataX*=self.decimateBy return if self.dataX is None or len(self.dataX)!=len(self.dataY): self.dat...
def sweep_genXs(self): """generate sweepX (in seconds) to match sweepY""" if self.decimateMethod: self.dataX=np.arange(len(self.dataY))/self.rate self.dataX*=self.decimateBy return if self.dataX is None or len(self.dataX)!=len(self.dataY): self.dat...
[ "generate", "sweepX", "(", "in", "seconds", ")", "to", "match", "sweepY" ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/abf.py#L240-L247
[ "def", "sweep_genXs", "(", "self", ")", ":", "if", "self", ".", "decimateMethod", ":", "self", ".", "dataX", "=", "np", ".", "arange", "(", "len", "(", "self", ".", "dataY", ")", ")", "/", "self", ".", "rate", "self", ".", "dataX", "*=", "self", ...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
ABF.sweep_decimate
decimate data using one of the following methods: 'avg','max','min','fast' They're self explainatory. 'fast' just plucks the n'th data point.
doc/oldcode/swhlab/core/abf.py
def sweep_decimate(self): """ decimate data using one of the following methods: 'avg','max','min','fast' They're self explainatory. 'fast' just plucks the n'th data point. """ if len(self.dataY)<self.decimateBy: return if self.decimateMethod: ...
def sweep_decimate(self): """ decimate data using one of the following methods: 'avg','max','min','fast' They're self explainatory. 'fast' just plucks the n'th data point. """ if len(self.dataY)<self.decimateBy: return if self.decimateMethod: ...
[ "decimate", "data", "using", "one", "of", "the", "following", "methods", ":", "avg", "max", "min", "fast", "They", "re", "self", "explainatory", ".", "fast", "just", "plucks", "the", "n", "th", "data", "point", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/abf.py#L249-L271
[ "def", "sweep_decimate", "(", "self", ")", ":", "if", "len", "(", "self", ".", "dataY", ")", "<", "self", ".", "decimateBy", ":", "return", "if", "self", ".", "decimateMethod", ":", "points", "=", "int", "(", "len", "(", "self", ".", "dataY", ")", ...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
ABF.get_data_around
return self.dataY around a time point. All units are seconds. if thisSweep==False, the time point is considered to be experiment time and an appropriate sweep may be selected. i.e., with 10 second sweeps and timePint=35, will select the 5s mark of the third sweep
doc/oldcode/swhlab/core/abf.py
def get_data_around(self,timePoints,thisSweep=False,padding=0.02,msDeriv=0): """ return self.dataY around a time point. All units are seconds. if thisSweep==False, the time point is considered to be experiment time and an appropriate sweep may be selected. i.e., with 10 second ...
def get_data_around(self,timePoints,thisSweep=False,padding=0.02,msDeriv=0): """ return self.dataY around a time point. All units are seconds. if thisSweep==False, the time point is considered to be experiment time and an appropriate sweep may be selected. i.e., with 10 second ...
[ "return", "self", ".", "dataY", "around", "a", "time", "point", ".", "All", "units", "are", "seconds", ".", "if", "thisSweep", "==", "False", "the", "time", "point", "is", "considered", "to", "be", "experiment", "time", "and", "an", "appropriate", "sweep",...
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/abf.py#L273-L306
[ "def", "get_data_around", "(", "self", ",", "timePoints", ",", "thisSweep", "=", "False", ",", "padding", "=", "0.02", ",", "msDeriv", "=", "0", ")", ":", "if", "not", "np", ".", "array", "(", "timePoints", ")", ".", "shape", ":", "timePoints", "=", ...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
ABF.generate_protocol
Create (x,y) points necessary to graph protocol for the current sweep.
doc/oldcode/swhlab/core/abf.py
def generate_protocol(self,sweep=None): """ Create (x,y) points necessary to graph protocol for the current sweep. """ #TODO: make a line protocol that's plottable if sweep is None: sweep = self.currentSweep if sweep is None: sweep = 0 if n...
def generate_protocol(self,sweep=None): """ Create (x,y) points necessary to graph protocol for the current sweep. """ #TODO: make a line protocol that's plottable if sweep is None: sweep = self.currentSweep if sweep is None: sweep = 0 if n...
[ "Create", "(", "x", "y", ")", "points", "necessary", "to", "graph", "protocol", "for", "the", "current", "sweep", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/abf.py#L310-L365
[ "def", "generate_protocol", "(", "self", ",", "sweep", "=", "None", ")", ":", "#TODO: make a line protocol that's plottable", "if", "sweep", "is", "None", ":", "sweep", "=", "self", ".", "currentSweep", "if", "sweep", "is", "None", ":", "sweep", "=", "0", "i...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
ABF.clampValues
return an array of command values at a time point (in sec). Useful for things like generating I/V curves.
doc/oldcode/swhlab/core/abf.py
def clampValues(self,timePoint=0): """ return an array of command values at a time point (in sec). Useful for things like generating I/V curves. """ Cs=np.zeros(self.sweeps) for i in range(self.sweeps): self.setSweep(i) #TODO: protocol only = True ...
def clampValues(self,timePoint=0): """ return an array of command values at a time point (in sec). Useful for things like generating I/V curves. """ Cs=np.zeros(self.sweeps) for i in range(self.sweeps): self.setSweep(i) #TODO: protocol only = True ...
[ "return", "an", "array", "of", "command", "values", "at", "a", "time", "point", "(", "in", "sec", ")", ".", "Useful", "for", "things", "like", "generating", "I", "/", "V", "curves", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/abf.py#L367-L378
[ "def", "clampValues", "(", "self", ",", "timePoint", "=", "0", ")", ":", "Cs", "=", "np", ".", "zeros", "(", "self", ".", "sweeps", ")", "for", "i", "in", "range", "(", "self", ".", "sweeps", ")", ":", "self", ".", "setSweep", "(", "i", ")", "#...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
ABF.guess_protocol
This just generates a string to define the nature of the ABF. The ultimate goal is to use info about the abf to guess what to do with it. [vc/ic]-[steps/fixed]-[notag/drugs]-[2ch/1ch] This represents 2^4 (18) combinations, but is easily expanded.
doc/oldcode/swhlab/core/abf.py
def guess_protocol(self): """ This just generates a string to define the nature of the ABF. The ultimate goal is to use info about the abf to guess what to do with it. [vc/ic]-[steps/fixed]-[notag/drugs]-[2ch/1ch] This represents 2^4 (18) combinations, but is easily expan...
def guess_protocol(self): """ This just generates a string to define the nature of the ABF. The ultimate goal is to use info about the abf to guess what to do with it. [vc/ic]-[steps/fixed]-[notag/drugs]-[2ch/1ch] This represents 2^4 (18) combinations, but is easily expan...
[ "This", "just", "generates", "a", "string", "to", "define", "the", "nature", "of", "the", "ABF", ".", "The", "ultimate", "goal", "is", "to", "use", "info", "about", "the", "abf", "to", "guess", "what", "to", "do", "with", "it", ".", "[", "vc", "/", ...
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/abf.py#L380-L405
[ "def", "guess_protocol", "(", "self", ")", ":", "clamp", "=", "\"ic\"", "if", "self", ".", "units", "==", "\"pA\"", ":", "clamp", "=", "\"vc\"", "command", "=", "\"fixed\"", "if", "self", ".", "sweeps", ">", "1", ":", "self", ".", "setSweep", "(", "0...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
ABF.average_sweep
given an array of sweeps, return X,Y,Err average. This returns *SWEEPS* of data, not just 1 data point.
doc/oldcode/swhlab/core/abf.py
def average_sweep(self,T1=0,T2=None,sweeps=None,stdErr=False): """ given an array of sweeps, return X,Y,Err average. This returns *SWEEPS* of data, not just 1 data point. """ T1=T1*self.rate if T2 is None: T2 = self.sweepSize-1 else: T2 = T...
def average_sweep(self,T1=0,T2=None,sweeps=None,stdErr=False): """ given an array of sweeps, return X,Y,Err average. This returns *SWEEPS* of data, not just 1 data point. """ T1=T1*self.rate if T2 is None: T2 = self.sweepSize-1 else: T2 = T...
[ "given", "an", "array", "of", "sweeps", "return", "X", "Y", "Err", "average", ".", "This", "returns", "*", "SWEEPS", "*", "of", "data", "not", "just", "1", "data", "point", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/abf.py#L409-L430
[ "def", "average_sweep", "(", "self", ",", "T1", "=", "0", ",", "T2", "=", "None", ",", "sweeps", "=", "None", ",", "stdErr", "=", "False", ")", ":", "T1", "=", "T1", "*", "self", ".", "rate", "if", "T2", "is", "None", ":", "T2", "=", "self", ...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
ABF.average_data
given a list of ranges, return single point averages for every sweep. Units are in seconds. Expects something like: ranges=[[1,2],[4,5],[7,7.5]] None values will be replaced with maximum/minimum bounds. For baseline subtraction, make a range baseline then sub it youtself. ...
doc/oldcode/swhlab/core/abf.py
def average_data(self,ranges=[[None,None]],percentile=None): """ given a list of ranges, return single point averages for every sweep. Units are in seconds. Expects something like: ranges=[[1,2],[4,5],[7,7.5]] None values will be replaced with maximum/minimum bounds. ...
def average_data(self,ranges=[[None,None]],percentile=None): """ given a list of ranges, return single point averages for every sweep. Units are in seconds. Expects something like: ranges=[[1,2],[4,5],[7,7.5]] None values will be replaced with maximum/minimum bounds. ...
[ "given", "a", "list", "of", "ranges", "return", "single", "point", "averages", "for", "every", "sweep", ".", "Units", "are", "in", "seconds", ".", "Expects", "something", "like", ":", "ranges", "=", "[[", "1", "2", "]", "[", "4", "5", "]", "[", "7", ...
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/abf.py#L432-L467
[ "def", "average_data", "(", "self", ",", "ranges", "=", "[", "[", "None", ",", "None", "]", "]", ",", "percentile", "=", "None", ")", ":", "ranges", "=", "copy", ".", "deepcopy", "(", "ranges", ")", "#TODO: make this cleaner. Why needed?", "# clean up ranges...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
ABF.filter_gaussian
RETURNS filtered trace. Desn't filter it in place.
doc/oldcode/swhlab/core/abf.py
def filter_gaussian(self,sigmaMs=100,applyFiltered=False,applyBaseline=False): """RETURNS filtered trace. Desn't filter it in place.""" if sigmaMs==0: return self.dataY filtered=cm.filter_gaussian(self.dataY,sigmaMs) if applyBaseline: self.dataY=self.dataY-filtere...
def filter_gaussian(self,sigmaMs=100,applyFiltered=False,applyBaseline=False): """RETURNS filtered trace. Desn't filter it in place.""" if sigmaMs==0: return self.dataY filtered=cm.filter_gaussian(self.dataY,sigmaMs) if applyBaseline: self.dataY=self.dataY-filtere...
[ "RETURNS", "filtered", "trace", ".", "Desn", "t", "filter", "it", "in", "place", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/abf.py#L471-L481
[ "def", "filter_gaussian", "(", "self", ",", "sigmaMs", "=", "100", ",", "applyFiltered", "=", "False", ",", "applyBaseline", "=", "False", ")", ":", "if", "sigmaMs", "==", "0", ":", "return", "self", ".", "dataY", "filtered", "=", "cm", ".", "filter_gaus...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
ABF.saveThing
save any object as /swhlab4/ID_[fname].pkl
doc/oldcode/swhlab/core/abf.py
def saveThing(self,thing,fname,overwrite=True,ext=".pkl"): """save any object as /swhlab4/ID_[fname].pkl""" if not os.path.exists(os.path.dirname(self.outpre)): os.mkdir(os.path.dirname(self.outpre)) if ext and not ext in fname: fname+=ext fname=self.outpre+fname ...
def saveThing(self,thing,fname,overwrite=True,ext=".pkl"): """save any object as /swhlab4/ID_[fname].pkl""" if not os.path.exists(os.path.dirname(self.outpre)): os.mkdir(os.path.dirname(self.outpre)) if ext and not ext in fname: fname+=ext fname=self.outpre+fname ...
[ "save", "any", "object", "as", "/", "swhlab4", "/", "ID_", "[", "fname", "]", ".", "pkl" ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/abf.py#L488-L504
[ "def", "saveThing", "(", "self", ",", "thing", ",", "fname", ",", "overwrite", "=", "True", ",", "ext", "=", "\".pkl\"", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "dirname", "(", "self", ".", "outpre", ...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
ABF.loadThing
save any object from /swhlab4/ID_[fname].pkl
doc/oldcode/swhlab/core/abf.py
def loadThing(self,fname,ext=".pkl"): """save any object from /swhlab4/ID_[fname].pkl""" if ext and not ext in fname: fname+=ext fname=self.outpre+fname time1=cm.timethis() thing = pickle.load(open(fname,"rb")) print(" -> loading [%s] (%.01f kB) took %.02f ms"...
def loadThing(self,fname,ext=".pkl"): """save any object from /swhlab4/ID_[fname].pkl""" if ext and not ext in fname: fname+=ext fname=self.outpre+fname time1=cm.timethis() thing = pickle.load(open(fname,"rb")) print(" -> loading [%s] (%.01f kB) took %.02f ms"...
[ "save", "any", "object", "from", "/", "swhlab4", "/", "ID_", "[", "fname", "]", ".", "pkl" ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/abf.py#L506-L517
[ "def", "loadThing", "(", "self", ",", "fname", ",", "ext", "=", "\".pkl\"", ")", ":", "if", "ext", "and", "not", "ext", "in", "fname", ":", "fname", "+=", "ext", "fname", "=", "self", ".", "outpre", "+", "fname", "time1", "=", "cm", ".", "timethis"...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
ABF.deleteStuff
delete /swhlab4/ID_*
doc/oldcode/swhlab/core/abf.py
def deleteStuff(self,ext="*",spareInfo=True,spare=["_info.pkl"]): """delete /swhlab4/ID_*""" print(" -- deleting /swhlab4/"+ext) for fname in sorted(glob.glob(self.outpre+ext)): reallyDelete=True for item in spare: if item in fname: rea...
def deleteStuff(self,ext="*",spareInfo=True,spare=["_info.pkl"]): """delete /swhlab4/ID_*""" print(" -- deleting /swhlab4/"+ext) for fname in sorted(glob.glob(self.outpre+ext)): reallyDelete=True for item in spare: if item in fname: rea...
[ "delete", "/", "swhlab4", "/", "ID_", "*" ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/abf.py#L519-L528
[ "def", "deleteStuff", "(", "self", ",", "ext", "=", "\"*\"", ",", "spareInfo", "=", "True", ",", "spare", "=", "[", "\"_info.pkl\"", "]", ")", ":", "print", "(", "\" -- deleting /swhlab4/\"", "+", "ext", ")", "for", "fname", "in", "sorted", "(", "glob", ...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
validate_activatable_models
Raises a ValidationError for any ActivatableModel that has ForeignKeys or OneToOneFields that will cause cascading deletions to occur. This function also raises a ValidationError if the activatable model has not defined a Boolean field with the field name defined by the ACTIVATABLE_FIELD_NAME variable on th...
activatable_model/validation.py
def validate_activatable_models(): """ Raises a ValidationError for any ActivatableModel that has ForeignKeys or OneToOneFields that will cause cascading deletions to occur. This function also raises a ValidationError if the activatable model has not defined a Boolean field with the field name defined b...
def validate_activatable_models(): """ Raises a ValidationError for any ActivatableModel that has ForeignKeys or OneToOneFields that will cause cascading deletions to occur. This function also raises a ValidationError if the activatable model has not defined a Boolean field with the field name defined b...
[ "Raises", "a", "ValidationError", "for", "any", "ActivatableModel", "that", "has", "ForeignKeys", "or", "OneToOneFields", "that", "will", "cause", "cascading", "deletions", "to", "occur", ".", "This", "function", "also", "raises", "a", "ValidationError", "if", "th...
ambitioninc/django-activatable-model
python
https://github.com/ambitioninc/django-activatable-model/blob/2c142430949a923a69201f4914a6b73a642b4b48/activatable_model/validation.py#L14-L43
[ "def", "validate_activatable_models", "(", ")", ":", "for", "model", "in", "get_activatable_models", "(", ")", ":", "# Verify the activatable model has an activatable boolean field", "activatable_field", "=", "next", "(", "(", "f", "for", "f", "in", "model", ".", "_me...
2c142430949a923a69201f4914a6b73a642b4b48
valid
to_table
Helper function to convet an Args object to a HoloViews Table
lancet/core.py
def to_table(args, vdims=[]): "Helper function to convet an Args object to a HoloViews Table" if not Table: return "HoloViews Table not available" kdims = [dim for dim in args.constant_keys + args.varying_keys if dim not in vdims] items = [tuple([spec[k] for k in kdims+vdims]) ...
def to_table(args, vdims=[]): "Helper function to convet an Args object to a HoloViews Table" if not Table: return "HoloViews Table not available" kdims = [dim for dim in args.constant_keys + args.varying_keys if dim not in vdims] items = [tuple([spec[k] for k in kdims+vdims]) ...
[ "Helper", "function", "to", "convet", "an", "Args", "object", "to", "a", "HoloViews", "Table" ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L35-L43
[ "def", "to_table", "(", "args", ",", "vdims", "=", "[", "]", ")", ":", "if", "not", "Table", ":", "return", "\"HoloViews Table not available\"", "kdims", "=", "[", "dim", "for", "dim", "in", "args", ".", "constant_keys", "+", "args", ".", "varying_keys", ...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
PrettyPrinted.pprint_args
Method to define the positional arguments and keyword order for pretty printing.
lancet/core.py
def pprint_args(self, pos_args, keyword_args, infix_operator=None, extra_params={}): """ Method to define the positional arguments and keyword order for pretty printing. """ if infix_operator and not (len(pos_args)==2 and keyword_args==[]): raise Exception('Infix form...
def pprint_args(self, pos_args, keyword_args, infix_operator=None, extra_params={}): """ Method to define the positional arguments and keyword order for pretty printing. """ if infix_operator and not (len(pos_args)==2 and keyword_args==[]): raise Exception('Infix form...
[ "Method", "to", "define", "the", "positional", "arguments", "and", "keyword", "order", "for", "pretty", "printing", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L54-L63
[ "def", "pprint_args", "(", "self", ",", "pos_args", ",", "keyword_args", ",", "infix_operator", "=", "None", ",", "extra_params", "=", "{", "}", ")", ":", "if", "infix_operator", "and", "not", "(", "len", "(", "pos_args", ")", "==", "2", "and", "keyword_...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
PrettyPrinted._pprint
Pretty printer that prints only the modified keywords and generates flat representations (for repr) and optionally annotates the top of the repr with a comment.
lancet/core.py
def _pprint(self, cycle=False, flat=False, annotate=False, onlychanged=True, level=1, tab = ' '): """ Pretty printer that prints only the modified keywords and generates flat representations (for repr) and optionally annotates the top of the repr with a comment. """ (kw...
def _pprint(self, cycle=False, flat=False, annotate=False, onlychanged=True, level=1, tab = ' '): """ Pretty printer that prints only the modified keywords and generates flat representations (for repr) and optionally annotates the top of the repr with a comment. """ (kw...
[ "Pretty", "printer", "that", "prints", "only", "the", "modified", "keywords", "and", "generates", "flat", "representations", "(", "for", "repr", ")", "and", "optionally", "annotates", "the", "top", "of", "the", "repr", "with", "a", "comment", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L65-L107
[ "def", "_pprint", "(", "self", ",", "cycle", "=", "False", ",", "flat", "=", "False", ",", "annotate", "=", "False", ",", "onlychanged", "=", "True", ",", "level", "=", "1", ",", "tab", "=", "' '", ")", ":", "(", "kwargs", ",", "pos_args", ",", ...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
Arguments.spec_formatter
Formats the elements of an argument set appropriately
lancet/core.py
def spec_formatter(cls, spec): " Formats the elements of an argument set appropriately" return type(spec)((k, str(v)) for (k,v) in spec.items())
def spec_formatter(cls, spec): " Formats the elements of an argument set appropriately" return type(spec)((k, str(v)) for (k,v) in spec.items())
[ "Formats", "the", "elements", "of", "an", "argument", "set", "appropriately" ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L153-L155
[ "def", "spec_formatter", "(", "cls", ",", "spec", ")", ":", "return", "type", "(", "spec", ")", "(", "(", "k", ",", "str", "(", "v", ")", ")", "for", "(", "k", ",", "v", ")", "in", "spec", ".", "items", "(", ")", ")" ]
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
Arguments._collect_by_key
Returns a dictionary like object with the lists of values collapsed by their respective key. Useful to find varying vs constant keys and to find how fast keys vary.
lancet/core.py
def _collect_by_key(self,specs): """ Returns a dictionary like object with the lists of values collapsed by their respective key. Useful to find varying vs constant keys and to find how fast keys vary. """ # Collect (key, value) tuples as list of lists, flatten with chain...
def _collect_by_key(self,specs): """ Returns a dictionary like object with the lists of values collapsed by their respective key. Useful to find varying vs constant keys and to find how fast keys vary. """ # Collect (key, value) tuples as list of lists, flatten with chain...
[ "Returns", "a", "dictionary", "like", "object", "with", "the", "lists", "of", "values", "collapsed", "by", "their", "respective", "key", ".", "Useful", "to", "find", "varying", "vs", "constant", "keys", "and", "to", "find", "how", "fast", "keys", "vary", "...
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L210-L221
[ "def", "_collect_by_key", "(", "self", ",", "specs", ")", ":", "# Collect (key, value) tuples as list of lists, flatten with chain", "allkeys", "=", "itertools", ".", "chain", ".", "from_iterable", "(", "[", "[", "(", "k", ",", "run", "[", "k", "]", ")", "for", ...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
Arguments._cartesian_product
Takes the Cartesian product of the specifications. Result will contain N specifications where N = len(first_specs) * len(second_specs) and keys are merged. Example: [{'a':1},{'b':2}] * [{'c':3},{'d':4}] = [{'a':1,'c':3},{'a':1,'d':4},{'b':2,'c':3},{'b':2,'d':4}]
lancet/core.py
def _cartesian_product(self, first_specs, second_specs): """ Takes the Cartesian product of the specifications. Result will contain N specifications where N = len(first_specs) * len(second_specs) and keys are merged. Example: [{'a':1},{'b':2}] * [{'c':3},{'d':4}] = [{'a':...
def _cartesian_product(self, first_specs, second_specs): """ Takes the Cartesian product of the specifications. Result will contain N specifications where N = len(first_specs) * len(second_specs) and keys are merged. Example: [{'a':1},{'b':2}] * [{'c':3},{'d':4}] = [{'a':...
[ "Takes", "the", "Cartesian", "product", "of", "the", "specifications", ".", "Result", "will", "contain", "N", "specifications", "where", "N", "=", "len", "(", "first_specs", ")", "*", "len", "(", "second_specs", ")", "and", "keys", "are", "merged", ".", "E...
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L242-L254
[ "def", "_cartesian_product", "(", "self", ",", "first_specs", ",", "second_specs", ")", ":", "return", "[", "dict", "(", "zip", "(", "list", "(", "s1", ".", "keys", "(", ")", ")", "+", "list", "(", "s2", ".", "keys", "(", ")", ")", ",", "list", "...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
Arguments.summary
A succinct summary of the argument specifier. Unlike the repr, a summary does not have to be complete but must supply the most relevant information about the object to the user.
lancet/core.py
def summary(self): """ A succinct summary of the argument specifier. Unlike the repr, a summary does not have to be complete but must supply the most relevant information about the object to the user. """ print("Items: %s" % len(self)) varying_keys = ', '.join('%r...
def summary(self): """ A succinct summary of the argument specifier. Unlike the repr, a summary does not have to be complete but must supply the most relevant information about the object to the user. """ print("Items: %s" % len(self)) varying_keys = ', '.join('%r...
[ "A", "succinct", "summary", "of", "the", "argument", "specifier", ".", "Unlike", "the", "repr", "a", "summary", "does", "not", "have", "to", "be", "complete", "but", "must", "supply", "the", "most", "relevant", "information", "about", "the", "object", "to", ...
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L256-L268
[ "def", "summary", "(", "self", ")", ":", "print", "(", "\"Items: %s\"", "%", "len", "(", "self", ")", ")", "varying_keys", "=", "', '", ".", "join", "(", "'%r'", "%", "k", "for", "k", "in", "self", ".", "varying_keys", ")", "print", "(", "\"Varying K...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
Args._build_specs
Returns the specs, the remaining kwargs and whether or not the constructor was called with kwarg or explicit specs.
lancet/core.py
def _build_specs(self, specs, kwargs, fp_precision): """ Returns the specs, the remaining kwargs and whether or not the constructor was called with kwarg or explicit specs. """ if specs is None: overrides = param.ParamOverrides(self, kwargs, ...
def _build_specs(self, specs, kwargs, fp_precision): """ Returns the specs, the remaining kwargs and whether or not the constructor was called with kwarg or explicit specs. """ if specs is None: overrides = param.ParamOverrides(self, kwargs, ...
[ "Returns", "the", "specs", "the", "remaining", "kwargs", "and", "whether", "or", "not", "the", "constructor", "was", "called", "with", "kwarg", "or", "explicit", "specs", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L349-L366
[ "def", "_build_specs", "(", "self", ",", "specs", ",", "kwargs", ",", "fp_precision", ")", ":", "if", "specs", "is", "None", ":", "overrides", "=", "param", ".", "ParamOverrides", "(", "self", ",", "kwargs", ",", "allow_extra_keywords", "=", "True", ")", ...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
Args._unique
Note: repr() must be implemented properly on all objects. This is implicitly assumed by Lancet when Python objects need to be formatted to string representation.
lancet/core.py
def _unique(self, sequence, idfun=repr): """ Note: repr() must be implemented properly on all objects. This is implicitly assumed by Lancet when Python objects need to be formatted to string representation. """ seen = {} return [seen.setdefault(idfun(e),e) for e i...
def _unique(self, sequence, idfun=repr): """ Note: repr() must be implemented properly on all objects. This is implicitly assumed by Lancet when Python objects need to be formatted to string representation. """ seen = {} return [seen.setdefault(idfun(e),e) for e i...
[ "Note", ":", "repr", "()", "must", "be", "implemented", "properly", "on", "all", "objects", ".", "This", "is", "implicitly", "assumed", "by", "Lancet", "when", "Python", "objects", "need", "to", "be", "formatted", "to", "string", "representation", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L381-L389
[ "def", "_unique", "(", "self", ",", "sequence", ",", "idfun", "=", "repr", ")", ":", "seen", "=", "{", "}", "return", "[", "seen", ".", "setdefault", "(", "idfun", "(", "e", ")", ",", "e", ")", "for", "e", "in", "sequence", "if", "idfun", "(", ...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
Args.show
Convenience method to inspect the available argument values in human-readable format. The ordering of keys is determined by how quickly they vary. The exclude list allows specific keys to be excluded for readability (e.g. to hide long, absolute filenames).
lancet/core.py
def show(self, exclude=[]): """ Convenience method to inspect the available argument values in human-readable format. The ordering of keys is determined by how quickly they vary. The exclude list allows specific keys to be excluded for readability (e.g. to hide long, abs...
def show(self, exclude=[]): """ Convenience method to inspect the available argument values in human-readable format. The ordering of keys is determined by how quickly they vary. The exclude list allows specific keys to be excluded for readability (e.g. to hide long, abs...
[ "Convenience", "method", "to", "inspect", "the", "available", "argument", "values", "in", "human", "-", "readable", "format", ".", "The", "ordering", "of", "keys", "is", "determined", "by", "how", "quickly", "they", "vary", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L391-L404
[ "def", "show", "(", "self", ",", "exclude", "=", "[", "]", ")", ":", "ordering", "=", "self", ".", "constant_keys", "+", "self", ".", "varying_keys", "spec_lines", "=", "[", "', '", ".", "join", "(", "[", "'%s=%s'", "%", "(", "k", ",", "s", "[", ...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
Args.lexsort
The lexical sort order is specified by a list of string arguments. Each string is a key name prefixed by '+' or '-' for ascending and descending sort respectively. If the key is not found in the operand's set of varying keys, it is ignored.
lancet/core.py
def lexsort(self, *order): """ The lexical sort order is specified by a list of string arguments. Each string is a key name prefixed by '+' or '-' for ascending and descending sort respectively. If the key is not found in the operand's set of varying keys, it is ignored. ...
def lexsort(self, *order): """ The lexical sort order is specified by a list of string arguments. Each string is a key name prefixed by '+' or '-' for ascending and descending sort respectively. If the key is not found in the operand's set of varying keys, it is ignored. ...
[ "The", "lexical", "sort", "order", "is", "specified", "by", "a", "list", "of", "string", "arguments", ".", "Each", "string", "is", "a", "key", "name", "prefixed", "by", "+", "or", "-", "for", "ascending", "and", "descending", "sort", "respectively", ".", ...
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L407-L428
[ "def", "lexsort", "(", "self", ",", "*", "order", ")", ":", "if", "order", "==", "[", "]", ":", "raise", "Exception", "(", "\"Please specify the keys for sorting, use\"", "\"'+' prefix for ascending,\"", "\"'-' for descending.)\"", ")", "if", "not", "set", "(", "e...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
Args._lexsorted_specs
A lexsort is specified using normal key string prefixed by '+' (for ascending) or '-' for (for descending). Note that in Python 2, if a key is missing, None is returned (smallest Python value). In Python 3, an Exception will be raised regarding comparison of heterogenous types.
lancet/core.py
def _lexsorted_specs(self, order): """ A lexsort is specified using normal key string prefixed by '+' (for ascending) or '-' for (for descending). Note that in Python 2, if a key is missing, None is returned (smallest Python value). In Python 3, an Exception will be rais...
def _lexsorted_specs(self, order): """ A lexsort is specified using normal key string prefixed by '+' (for ascending) or '-' for (for descending). Note that in Python 2, if a key is missing, None is returned (smallest Python value). In Python 3, an Exception will be rais...
[ "A", "lexsort", "is", "specified", "using", "normal", "key", "string", "prefixed", "by", "+", "(", "for", "ascending", ")", "or", "-", "for", "(", "for", "descending", ")", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L430-L452
[ "def", "_lexsorted_specs", "(", "self", ",", "order", ")", ":", "specs", "=", "self", ".", "specs", "[", ":", "]", "if", "not", "all", "(", "el", "[", "0", "]", "in", "[", "'+'", ",", "'-'", "]", "for", "el", "in", "order", ")", ":", "raise", ...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
Range.linspace
Simple replacement for numpy linspace
lancet/core.py
def linspace(self, start, stop, n): """ Simple replacement for numpy linspace""" if n == 1: return [start] L = [0.0] * n nm1 = n - 1 nm1inv = 1.0 / nm1 for i in range(n): L[i] = nm1inv * (start*(nm1 - i) + stop*i) return L
def linspace(self, start, stop, n): """ Simple replacement for numpy linspace""" if n == 1: return [start] L = [0.0] * n nm1 = n - 1 nm1inv = 1.0 / nm1 for i in range(n): L[i] = nm1inv * (start*(nm1 - i) + stop*i) return L
[ "Simple", "replacement", "for", "numpy", "linspace" ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L581-L589
[ "def", "linspace", "(", "self", ",", "start", ",", "stop", ",", "n", ")", ":", "if", "n", "==", "1", ":", "return", "[", "start", "]", "L", "=", "[", "0.0", "]", "*", "n", "nm1", "=", "n", "-", "1", "nm1inv", "=", "1.0", "/", "nm1", "for", ...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
Log.extract_log
Parses the log file generated by a launcher and returns dictionary with tid keys and specification values. Ordering can be maintained by setting dict_type to the appropriate constructor (i.e. OrderedDict). Keys are converted from unicode to strings for kwarg use.
lancet/core.py
def extract_log(log_path, dict_type=dict): """ Parses the log file generated by a launcher and returns dictionary with tid keys and specification values. Ordering can be maintained by setting dict_type to the appropriate constructor (i.e. OrderedDict). Keys are converted ...
def extract_log(log_path, dict_type=dict): """ Parses the log file generated by a launcher and returns dictionary with tid keys and specification values. Ordering can be maintained by setting dict_type to the appropriate constructor (i.e. OrderedDict). Keys are converted ...
[ "Parses", "the", "log", "file", "generated", "by", "a", "launcher", "and", "returns", "dictionary", "with", "tid", "keys", "and", "specification", "values", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L631-L646
[ "def", "extract_log", "(", "log_path", ",", "dict_type", "=", "dict", ")", ":", "log_path", "=", "(", "log_path", "if", "os", ".", "path", ".", "isfile", "(", "log_path", ")", "else", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd", "(", "...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
Log.write_log
Writes the supplied specifications to the log path. The data may be supplied as either as a an Args or as a list of dictionaries. By default, specifications will be appropriately appended to an existing log file. This can be disabled by setting allow_append to False.
lancet/core.py
def write_log(log_path, data, allow_append=True): """ Writes the supplied specifications to the log path. The data may be supplied as either as a an Args or as a list of dictionaries. By default, specifications will be appropriately appended to an existing log file. This...
def write_log(log_path, data, allow_append=True): """ Writes the supplied specifications to the log path. The data may be supplied as either as a an Args or as a list of dictionaries. By default, specifications will be appropriately appended to an existing log file. This...
[ "Writes", "the", "supplied", "specifications", "to", "the", "log", "path", ".", "The", "data", "may", "be", "supplied", "as", "either", "as", "a", "an", "Args", "or", "as", "a", "list", "of", "dictionaries", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L649-L681
[ "def", "write_log", "(", "log_path", ",", "data", ",", "allow_append", "=", "True", ")", ":", "append", "=", "os", ".", "path", ".", "isfile", "(", "log_path", ")", "islist", "=", "isinstance", "(", "data", ",", "list", ")", "if", "append", "and", "n...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
FilePattern.directory
Load all the files in a given directory selecting only files with the given extension if specified. The given kwargs are passed through to the normal constructor.
lancet/core.py
def directory(cls, directory, root=None, extension=None, **kwargs): """ Load all the files in a given directory selecting only files with the given extension if specified. The given kwargs are passed through to the normal constructor. """ root = os.getcwd() if root is Non...
def directory(cls, directory, root=None, extension=None, **kwargs): """ Load all the files in a given directory selecting only files with the given extension if specified. The given kwargs are passed through to the normal constructor. """ root = os.getcwd() if root is Non...
[ "Load", "all", "the", "files", "in", "a", "given", "directory", "selecting", "only", "files", "with", "the", "given", "extension", "if", "specified", ".", "The", "given", "kwargs", "are", "passed", "through", "to", "the", "normal", "constructor", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L745-L758
[ "def", "directory", "(", "cls", ",", "directory", ",", "root", "=", "None", ",", "extension", "=", "None", ",", "*", "*", "kwargs", ")", ":", "root", "=", "os", ".", "getcwd", "(", ")", "if", "root", "is", "None", "else", "root", "suffix", "=", "...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
FilePattern.fields
Return the fields specified in the pattern using Python's formatting mini-language.
lancet/core.py
def fields(self): """ Return the fields specified in the pattern using Python's formatting mini-language. """ parse = list(string.Formatter().parse(self.pattern)) return [f for f in zip(*parse)[1] if f is not None]
def fields(self): """ Return the fields specified in the pattern using Python's formatting mini-language. """ parse = list(string.Formatter().parse(self.pattern)) return [f for f in zip(*parse)[1] if f is not None]
[ "Return", "the", "fields", "specified", "in", "the", "pattern", "using", "Python", "s", "formatting", "mini", "-", "language", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L768-L774
[ "def", "fields", "(", "self", ")", ":", "parse", "=", "list", "(", "string", ".", "Formatter", "(", ")", ".", "parse", "(", "self", ".", "pattern", ")", ")", "return", "[", "f", "for", "f", "in", "zip", "(", "*", "parse", ")", "[", "1", "]", ...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
FilePattern._load_expansion
Loads the files that match the given pattern.
lancet/core.py
def _load_expansion(self, key, root, pattern): """ Loads the files that match the given pattern. """ path_pattern = os.path.join(root, pattern) expanded_paths = self._expand_pattern(path_pattern) specs=[] for (path, tags) in expanded_paths: filelist =...
def _load_expansion(self, key, root, pattern): """ Loads the files that match the given pattern. """ path_pattern = os.path.join(root, pattern) expanded_paths = self._expand_pattern(path_pattern) specs=[] for (path, tags) in expanded_paths: filelist =...
[ "Loads", "the", "files", "that", "match", "the", "given", "pattern", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L776-L789
[ "def", "_load_expansion", "(", "self", ",", "key", ",", "root", ",", "pattern", ")", ":", "path_pattern", "=", "os", ".", "path", ".", "join", "(", "root", ",", "pattern", ")", "expanded_paths", "=", "self", ".", "_expand_pattern", "(", "path_pattern", "...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
FilePattern._expand_pattern
From the pattern decomposition, finds the absolute paths matching the pattern.
lancet/core.py
def _expand_pattern(self, pattern): """ From the pattern decomposition, finds the absolute paths matching the pattern. """ (globpattern, regexp, fields, types) = self._decompose_pattern(pattern) filelist = glob.glob(globpattern) expansion = [] for fname i...
def _expand_pattern(self, pattern): """ From the pattern decomposition, finds the absolute paths matching the pattern. """ (globpattern, regexp, fields, types) = self._decompose_pattern(pattern) filelist = glob.glob(globpattern) expansion = [] for fname i...
[ "From", "the", "pattern", "decomposition", "finds", "the", "absolute", "paths", "matching", "the", "pattern", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L791-L810
[ "def", "_expand_pattern", "(", "self", ",", "pattern", ")", ":", "(", "globpattern", ",", "regexp", ",", "fields", ",", "types", ")", "=", "self", ".", "_decompose_pattern", "(", "pattern", ")", "filelist", "=", "glob", ".", "glob", "(", "globpattern", "...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
FilePattern._decompose_pattern
Given a path pattern with format declaration, generates a four-tuple (glob_pattern, regexp pattern, fields, type map)
lancet/core.py
def _decompose_pattern(self, pattern): """ Given a path pattern with format declaration, generates a four-tuple (glob_pattern, regexp pattern, fields, type map) """ sep = '~lancet~sep~' float_codes = ['e','E','f', 'F','g', 'G', 'n'] typecodes = dict([(k,float) for...
def _decompose_pattern(self, pattern): """ Given a path pattern with format declaration, generates a four-tuple (glob_pattern, regexp pattern, fields, type map) """ sep = '~lancet~sep~' float_codes = ['e','E','f', 'F','g', 'G', 'n'] typecodes = dict([(k,float) for...
[ "Given", "a", "path", "pattern", "with", "format", "declaration", "generates", "a", "four", "-", "tuple", "(", "glob_pattern", "regexp", "pattern", "fields", "type", "map", ")" ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L812-L840
[ "def", "_decompose_pattern", "(", "self", ",", "pattern", ")", ":", "sep", "=", "'~lancet~sep~'", "float_codes", "=", "[", "'e'", ",", "'E'", ",", "'f'", ",", "'F'", ",", "'g'", ",", "'G'", ",", "'n'", "]", "typecodes", "=", "dict", "(", "[", "(", ...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
FileInfo.from_pattern
Convenience method to directly chain a pattern processed by FilePattern into a FileInfo instance. Note that if a default filetype has been set on FileInfo, the filetype argument may be omitted.
lancet/core.py
def from_pattern(cls, pattern, filetype=None, key='filename', root=None, ignore=[]): """ Convenience method to directly chain a pattern processed by FilePattern into a FileInfo instance. Note that if a default filetype has been set on FileInfo, the filetype argument may be omitt...
def from_pattern(cls, pattern, filetype=None, key='filename', root=None, ignore=[]): """ Convenience method to directly chain a pattern processed by FilePattern into a FileInfo instance. Note that if a default filetype has been set on FileInfo, the filetype argument may be omitt...
[ "Convenience", "method", "to", "directly", "chain", "a", "pattern", "processed", "by", "FilePattern", "into", "a", "FileInfo", "instance", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L884-L899
[ "def", "from_pattern", "(", "cls", ",", "pattern", ",", "filetype", "=", "None", ",", "key", "=", "'filename'", ",", "root", "=", "None", ",", "ignore", "=", "[", "]", ")", ":", "filepattern", "=", "FilePattern", "(", "key", ",", "pattern", ",", "roo...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
FileInfo.load
Load the file contents into the supplied pandas dataframe or HoloViews Table. This allows a selection to be made over the metadata before loading the file contents (may be slow).
lancet/core.py
def load(self, val, **kwargs): """ Load the file contents into the supplied pandas dataframe or HoloViews Table. This allows a selection to be made over the metadata before loading the file contents (may be slow). """ if Table and isinstance(val, Table): retur...
def load(self, val, **kwargs): """ Load the file contents into the supplied pandas dataframe or HoloViews Table. This allows a selection to be made over the metadata before loading the file contents (may be slow). """ if Table and isinstance(val, Table): retur...
[ "Load", "the", "file", "contents", "into", "the", "supplied", "pandas", "dataframe", "or", "HoloViews", "Table", ".", "This", "allows", "a", "selection", "to", "be", "made", "over", "the", "metadata", "before", "loading", "the", "file", "contents", "(", "may...
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L907-L918
[ "def", "load", "(", "self", ",", "val", ",", "*", "*", "kwargs", ")", ":", "if", "Table", "and", "isinstance", "(", "val", ",", "Table", ")", ":", "return", "self", ".", "load_table", "(", "val", ",", "*", "*", "kwargs", ")", "elif", "DataFrame", ...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
FileInfo.load_table
Load the file contents into the supplied Table using the specified key and filetype. The input table should have the filenames as values which will be replaced by the loaded data. If data_key is specified, this key will be used to index the loaded data to retrive the specified item.
lancet/core.py
def load_table(self, table): """ Load the file contents into the supplied Table using the specified key and filetype. The input table should have the filenames as values which will be replaced by the loaded data. If data_key is specified, this key will be used to index th...
def load_table(self, table): """ Load the file contents into the supplied Table using the specified key and filetype. The input table should have the filenames as values which will be replaced by the loaded data. If data_key is specified, this key will be used to index th...
[ "Load", "the", "file", "contents", "into", "the", "supplied", "Table", "using", "the", "specified", "key", "and", "filetype", ".", "The", "input", "table", "should", "have", "the", "filenames", "as", "values", "which", "will", "be", "replaced", "by", "the", ...
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L921-L940
[ "def", "load_table", "(", "self", ",", "table", ")", ":", "items", ",", "data_keys", "=", "[", "]", ",", "None", "for", "key", ",", "filename", "in", "table", ".", "items", "(", ")", ":", "data_dict", "=", "self", ".", "filetype", ".", "data", "(",...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
FileInfo.load_dframe
Load the file contents into the supplied dataframe using the specified key and filetype.
lancet/core.py
def load_dframe(self, dframe): """ Load the file contents into the supplied dataframe using the specified key and filetype. """ filename_series = dframe[self.key] loaded_data = filename_series.map(self.filetype.data) keys = [list(el.keys()) for el in loaded_data.v...
def load_dframe(self, dframe): """ Load the file contents into the supplied dataframe using the specified key and filetype. """ filename_series = dframe[self.key] loaded_data = filename_series.map(self.filetype.data) keys = [list(el.keys()) for el in loaded_data.v...
[ "Load", "the", "file", "contents", "into", "the", "supplied", "dataframe", "using", "the", "specified", "key", "and", "filetype", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L943-L958
[ "def", "load_dframe", "(", "self", ",", "dframe", ")", ":", "filename_series", "=", "dframe", "[", "self", ".", "key", "]", "loaded_data", "=", "filename_series", ".", "map", "(", "self", ".", "filetype", ".", "data", ")", "keys", "=", "[", "list", "("...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
FileInfo._info
Generates the union of the source.specs and the metadata dictionary loaded by the filetype object.
lancet/core.py
def _info(self, source, key, filetype, ignore): """ Generates the union of the source.specs and the metadata dictionary loaded by the filetype object. """ specs, mdata = [], {} mdata_clashes = set() for spec in source.specs: if key not in spec: ...
def _info(self, source, key, filetype, ignore): """ Generates the union of the source.specs and the metadata dictionary loaded by the filetype object. """ specs, mdata = [], {} mdata_clashes = set() for spec in source.specs: if key not in spec: ...
[ "Generates", "the", "union", "of", "the", "source", ".", "specs", "and", "the", "metadata", "dictionary", "loaded", "by", "the", "filetype", "object", "." ]
ioam/lancet
python
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L961-L983
[ "def", "_info", "(", "self", ",", "source", ",", "key", ",", "filetype", ",", "ignore", ")", ":", "specs", ",", "mdata", "=", "[", "]", ",", "{", "}", "mdata_clashes", "=", "set", "(", ")", "for", "spec", "in", "source", ".", "specs", ":", "if", ...
1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e
valid
EventIterator._push
Push new data into the buffer. Resume looping if paused.
eventemitter/iterable.py
async def _push(self, *args, **kwargs): """Push new data into the buffer. Resume looping if paused.""" self._data.append((args, kwargs)) if self._future is not None: future, self._future = self._future, None future.set_result(True)
async def _push(self, *args, **kwargs): """Push new data into the buffer. Resume looping if paused.""" self._data.append((args, kwargs)) if self._future is not None: future, self._future = self._future, None future.set_result(True)
[ "Push", "new", "data", "into", "the", "buffer", ".", "Resume", "looping", "if", "paused", "." ]
asyncdef/eventemitter
python
https://github.com/asyncdef/eventemitter/blob/148b700c5846d8fdafc562d4326587da5447223f/eventemitter/iterable.py#L20-L26
[ "async", "def", "_push", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_data", ".", "append", "(", "(", "args", ",", "kwargs", ")", ")", "if", "self", ".", "_future", "is", "not", "None", ":", "future", ",", "s...
148b700c5846d8fdafc562d4326587da5447223f
valid
newVersion
increments version counter in swhlab/version.py
scripts/old/helper.py
def newVersion(): """increments version counter in swhlab/version.py""" version=None fname='../swhlab/version.py' with open(fname) as f: raw=f.read().split("\n") for i,line in enumerate(raw): if line.startswith("__counter__"): if version is None: ...
def newVersion(): """increments version counter in swhlab/version.py""" version=None fname='../swhlab/version.py' with open(fname) as f: raw=f.read().split("\n") for i,line in enumerate(raw): if line.startswith("__counter__"): if version is None: ...
[ "increments", "version", "counter", "in", "swhlab", "/", "version", ".", "py" ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/scripts/old/helper.py#L12-L25
[ "def", "newVersion", "(", ")", ":", "version", "=", "None", "fname", "=", "'../swhlab/version.py'", "with", "open", "(", "fname", ")", "as", "f", ":", "raw", "=", "f", ".", "read", "(", ")", ".", "split", "(", "\"\\n\"", ")", "for", "i", ",", "line...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
figureStimulus
Create a plot of one area of interest of a single sweep.
doc/uses/compare evoked/go.py
def figureStimulus(abf,sweeps=[0]): """ Create a plot of one area of interest of a single sweep. """ stimuli=[2.31250, 2.35270] for sweep in sweeps: abf.setsweep(sweep) for stimulus in stimuli: S1=int(abf.pointsPerSec*stimulus) S2=int(abf.pointsPerSec*(stimul...
def figureStimulus(abf,sweeps=[0]): """ Create a plot of one area of interest of a single sweep. """ stimuli=[2.31250, 2.35270] for sweep in sweeps: abf.setsweep(sweep) for stimulus in stimuli: S1=int(abf.pointsPerSec*stimulus) S2=int(abf.pointsPerSec*(stimul...
[ "Create", "a", "plot", "of", "one", "area", "of", "interest", "of", "a", "single", "sweep", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/uses/compare evoked/go.py#L99-L117
[ "def", "figureStimulus", "(", "abf", ",", "sweeps", "=", "[", "0", "]", ")", ":", "stimuli", "=", "[", "2.31250", ",", "2.35270", "]", "for", "sweep", "in", "sweeps", ":", "abf", ".", "setsweep", "(", "sweep", ")", "for", "stimulus", "in", "stimuli",...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
ABF2.phasicTonic
chunkMs should be ~50 ms or greater. bin sizes must be equal to or multiples of the data resolution. transients smaller than the expected RMS will be silenced.
doc/uses/EPSCs-and-IPSCs/variance method/2016-12-18 01 curve fit.py
def phasicTonic(self,m1=None,m2=None,chunkMs=50, quietPercentile=10,histResolution=1): """ chunkMs should be ~50 ms or greater. bin sizes must be equal to or multiples of the data resolution. transients smaller than the expected RMS will be silenced. """ ...
def phasicTonic(self,m1=None,m2=None,chunkMs=50, quietPercentile=10,histResolution=1): """ chunkMs should be ~50 ms or greater. bin sizes must be equal to or multiples of the data resolution. transients smaller than the expected RMS will be silenced. """ ...
[ "chunkMs", "should", "be", "~50", "ms", "or", "greater", ".", "bin", "sizes", "must", "be", "equal", "to", "or", "multiples", "of", "the", "data", "resolution", ".", "transients", "smaller", "than", "the", "expected", "RMS", "will", "be", "silenced", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/uses/EPSCs-and-IPSCs/variance method/2016-12-18 01 curve fit.py#L34-L75
[ "def", "phasicTonic", "(", "self", ",", "m1", "=", "None", ",", "m2", "=", "None", ",", "chunkMs", "=", "50", ",", "quietPercentile", "=", "10", ",", "histResolution", "=", "1", ")", ":", "# prepare sectioning values to be used later (marker positions)", "m1", ...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
doStuff
Inelegant for now, but lets you manually analyze every ABF in a folder.
swhlab/indexing/indexing.py
def doStuff(ABFfolder,analyze=False,convert=False,index=True,overwrite=True, launch=True): """Inelegant for now, but lets you manually analyze every ABF in a folder.""" IN=INDEX(ABFfolder) if analyze: IN.analyzeAll() if convert: IN.convertImages()
def doStuff(ABFfolder,analyze=False,convert=False,index=True,overwrite=True, launch=True): """Inelegant for now, but lets you manually analyze every ABF in a folder.""" IN=INDEX(ABFfolder) if analyze: IN.analyzeAll() if convert: IN.convertImages()
[ "Inelegant", "for", "now", "but", "lets", "you", "manually", "analyze", "every", "ABF", "in", "a", "folder", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/indexing/indexing.py#L260-L267
[ "def", "doStuff", "(", "ABFfolder", ",", "analyze", "=", "False", ",", "convert", "=", "False", ",", "index", "=", "True", ",", "overwrite", "=", "True", ",", "launch", "=", "True", ")", ":", "IN", "=", "INDEX", "(", "ABFfolder", ")", "if", "analyze"...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
analyzeSingle
Reanalyze data for a single ABF. Also remakes child and parent html.
swhlab/indexing/indexing.py
def analyzeSingle(abfFname): """Reanalyze data for a single ABF. Also remakes child and parent html.""" assert os.path.exists(abfFname) and abfFname.endswith(".abf") ABFfolder,ABFfname=os.path.split(abfFname) abfID=os.path.splitext(ABFfname)[0] IN=INDEX(ABFfolder) IN.analyzeABF(abfID) IN.sca...
def analyzeSingle(abfFname): """Reanalyze data for a single ABF. Also remakes child and parent html.""" assert os.path.exists(abfFname) and abfFname.endswith(".abf") ABFfolder,ABFfname=os.path.split(abfFname) abfID=os.path.splitext(ABFfname)[0] IN=INDEX(ABFfolder) IN.analyzeABF(abfID) IN.sca...
[ "Reanalyze", "data", "for", "a", "single", "ABF", ".", "Also", "remakes", "child", "and", "parent", "html", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/indexing/indexing.py#L279-L292
[ "def", "analyzeSingle", "(", "abfFname", ")", ":", "assert", "os", ".", "path", ".", "exists", "(", "abfFname", ")", "and", "abfFname", ".", "endswith", "(", "\".abf\"", ")", "ABFfolder", ",", "ABFfname", "=", "os", ".", "path", ".", "split", "(", "abf...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
INDEX.scan
scan folder1 and folder2 into files1 and files2. since we are on windows, simplify things by making them all lowercase. this WILL cause problems on 'nix operating systems.If this is the case, just run a script to rename every file to all lowercase.
swhlab/indexing/indexing.py
def scan(self): """ scan folder1 and folder2 into files1 and files2. since we are on windows, simplify things by making them all lowercase. this WILL cause problems on 'nix operating systems.If this is the case, just run a script to rename every file to all lowercase. """...
def scan(self): """ scan folder1 and folder2 into files1 and files2. since we are on windows, simplify things by making them all lowercase. this WILL cause problems on 'nix operating systems.If this is the case, just run a script to rename every file to all lowercase. """...
[ "scan", "folder1", "and", "folder2", "into", "files1", "and", "files2", ".", "since", "we", "are", "on", "windows", "simplify", "things", "by", "making", "them", "all", "lowercase", ".", "this", "WILL", "cause", "problems", "on", "nix", "operating", "systems...
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/indexing/indexing.py#L80-L96
[ "def", "scan", "(", "self", ")", ":", "t1", "=", "cm", ".", "timeit", "(", ")", "self", ".", "files1", "=", "cm", ".", "list_to_lowercase", "(", "sorted", "(", "os", ".", "listdir", "(", "self", ".", "folder1", ")", ")", ")", "self", ".", "files2...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
INDEX.convertImages
run this to turn all folder1 TIFs and JPGs into folder2 data. TIFs will be treated as micrographs and converted to JPG with enhanced contrast. JPGs will simply be copied over.
swhlab/indexing/indexing.py
def convertImages(self): """ run this to turn all folder1 TIFs and JPGs into folder2 data. TIFs will be treated as micrographs and converted to JPG with enhanced contrast. JPGs will simply be copied over. """ # copy over JPGs (and such) exts=['.jpg','.png'] ...
def convertImages(self): """ run this to turn all folder1 TIFs and JPGs into folder2 data. TIFs will be treated as micrographs and converted to JPG with enhanced contrast. JPGs will simply be copied over. """ # copy over JPGs (and such) exts=['.jpg','.png'] ...
[ "run", "this", "to", "turn", "all", "folder1", "TIFs", "and", "JPGs", "into", "folder2", "data", ".", "TIFs", "will", "be", "treated", "as", "micrographs", "and", "converted", "to", "JPG", "with", "enhanced", "contrast", ".", "JPGs", "will", "simply", "be"...
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/indexing/indexing.py#L100-L131
[ "def", "convertImages", "(", "self", ")", ":", "# copy over JPGs (and such)", "exts", "=", "[", "'.jpg'", ",", "'.png'", "]", "for", "fname", "in", "[", "x", "for", "x", "in", "self", ".", "files1", "if", "cm", ".", "ext", "(", "x", ")", "in", "exts"...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
INDEX.analyzeAll
analyze every unanalyzed ABF in the folder.
swhlab/indexing/indexing.py
def analyzeAll(self): """analyze every unanalyzed ABF in the folder.""" searchableData=str(self.files2) self.log.debug("considering analysis for %d ABFs",len(self.IDs)) for ID in self.IDs: if not ID+"_" in searchableData: self.log.debug("%s needs analysis",ID)...
def analyzeAll(self): """analyze every unanalyzed ABF in the folder.""" searchableData=str(self.files2) self.log.debug("considering analysis for %d ABFs",len(self.IDs)) for ID in self.IDs: if not ID+"_" in searchableData: self.log.debug("%s needs analysis",ID)...
[ "analyze", "every", "unanalyzed", "ABF", "in", "the", "folder", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/indexing/indexing.py#L133-L146
[ "def", "analyzeAll", "(", "self", ")", ":", "searchableData", "=", "str", "(", "self", ".", "files2", ")", "self", ".", "log", ".", "debug", "(", "\"considering analysis for %d ABFs\"", ",", "len", "(", "self", ".", "IDs", ")", ")", "for", "ID", "in", ...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
INDEX.analyzeABF
Analye a single ABF: make data, index it. If called directly, will delete all ID_data_ and recreate it.
swhlab/indexing/indexing.py
def analyzeABF(self,ID): """ Analye a single ABF: make data, index it. If called directly, will delete all ID_data_ and recreate it. """ for fname in self.files2: if fname.startswith(ID+"_data_"): self.log.debug("deleting [%s]",fname) o...
def analyzeABF(self,ID): """ Analye a single ABF: make data, index it. If called directly, will delete all ID_data_ and recreate it. """ for fname in self.files2: if fname.startswith(ID+"_data_"): self.log.debug("deleting [%s]",fname) o...
[ "Analye", "a", "single", "ABF", ":", "make", "data", "index", "it", ".", "If", "called", "directly", "will", "delete", "all", "ID_data_", "and", "recreate", "it", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/indexing/indexing.py#L148-L158
[ "def", "analyzeABF", "(", "self", ",", "ID", ")", ":", "for", "fname", "in", "self", ".", "files2", ":", "if", "fname", ".", "startswith", "(", "ID", "+", "\"_data_\"", ")", ":", "self", ".", "log", ".", "debug", "(", "\"deleting [%s]\"", ",", "fname...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
INDEX.htmlFor
return appropriate HTML determined by file extension.
swhlab/indexing/indexing.py
def htmlFor(self,fname): """return appropriate HTML determined by file extension.""" if os.path.splitext(fname)[1].lower() in ['.jpg','.png']: html='<a href="%s"><img src="%s"></a>'%(fname,fname) if "_tif_" in fname: html=html.replace('<img ','<img class="datapic ...
def htmlFor(self,fname): """return appropriate HTML determined by file extension.""" if os.path.splitext(fname)[1].lower() in ['.jpg','.png']: html='<a href="%s"><img src="%s"></a>'%(fname,fname) if "_tif_" in fname: html=html.replace('<img ','<img class="datapic ...
[ "return", "appropriate", "HTML", "determined", "by", "file", "extension", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/indexing/indexing.py#L162-L176
[ "def", "htmlFor", "(", "self", ",", "fname", ")", ":", "if", "os", ".", "path", ".", "splitext", "(", "fname", ")", "[", "1", "]", ".", "lower", "(", ")", "in", "[", "'.jpg'", ",", "'.png'", "]", ":", "html", "=", "'<a href=\"%s\"><img src=\"%s\"></a...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
INDEX.html_single_basic
generate a generic flat file html for an ABF parent. You could give this a single ABF ID, its parent ID, or a list of ABF IDs. If a child ABF is given, the parent will automatically be used.
swhlab/indexing/indexing.py
def html_single_basic(self,abfID,launch=False,overwrite=False): """ generate a generic flat file html for an ABF parent. You could give this a single ABF ID, its parent ID, or a list of ABF IDs. If a child ABF is given, the parent will automatically be used. """ if type(a...
def html_single_basic(self,abfID,launch=False,overwrite=False): """ generate a generic flat file html for an ABF parent. You could give this a single ABF ID, its parent ID, or a list of ABF IDs. If a child ABF is given, the parent will automatically be used. """ if type(a...
[ "generate", "a", "generic", "flat", "file", "html", "for", "an", "ABF", "parent", ".", "You", "could", "give", "this", "a", "single", "ABF", "ID", "its", "parent", "ID", "or", "a", "list", "of", "ABF", "IDs", ".", "If", "a", "child", "ABF", "is", "...
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/indexing/indexing.py#L178-L216
[ "def", "html_single_basic", "(", "self", ",", "abfID", ",", "launch", "=", "False", ",", "overwrite", "=", "False", ")", ":", "if", "type", "(", "abfID", ")", "is", "str", ":", "abfID", "=", "[", "abfID", "]", "for", "thisABFid", "in", "cm", ".", "...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
INDEX.html_single_plot
create ID_plot.html of just intrinsic properties.
swhlab/indexing/indexing.py
def html_single_plot(self,abfID,launch=False,overwrite=False): """create ID_plot.html of just intrinsic properties.""" if type(abfID) is str: abfID=[abfID] for thisABFid in cm.abfSort(abfID): parentID=cm.parent(self.groups,thisABFid) saveAs=os.path.abspath("%s...
def html_single_plot(self,abfID,launch=False,overwrite=False): """create ID_plot.html of just intrinsic properties.""" if type(abfID) is str: abfID=[abfID] for thisABFid in cm.abfSort(abfID): parentID=cm.parent(self.groups,thisABFid) saveAs=os.path.abspath("%s...
[ "create", "ID_plot", ".", "html", "of", "just", "intrinsic", "properties", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/indexing/indexing.py#L218-L236
[ "def", "html_single_plot", "(", "self", ",", "abfID", ",", "launch", "=", "False", ",", "overwrite", "=", "False", ")", ":", "if", "type", "(", "abfID", ")", "is", "str", ":", "abfID", "=", "[", "abfID", "]", "for", "thisABFid", "in", "cm", ".", "a...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
lowpass
minimal complexity low-pass filtering. Filter size is how "wide" the filter will be. Sigma will be 1/10 of this filter width. If filter size isn't given, it will be 1/10 of the data size.
swhlab/common.py
def lowpass(data,filterSize=None): """ minimal complexity low-pass filtering. Filter size is how "wide" the filter will be. Sigma will be 1/10 of this filter width. If filter size isn't given, it will be 1/10 of the data size. """ if filterSize is None: filterSize=len(data)/10 ke...
def lowpass(data,filterSize=None): """ minimal complexity low-pass filtering. Filter size is how "wide" the filter will be. Sigma will be 1/10 of this filter width. If filter size isn't given, it will be 1/10 of the data size. """ if filterSize is None: filterSize=len(data)/10 ke...
[ "minimal", "complexity", "low", "-", "pass", "filtering", ".", "Filter", "size", "is", "how", "wide", "the", "filter", "will", "be", ".", "Sigma", "will", "be", "1", "/", "10", "of", "this", "filter", "width", ".", "If", "filter", "size", "isn", "t", ...
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/common.py#L36-L47
[ "def", "lowpass", "(", "data", ",", "filterSize", "=", "None", ")", ":", "if", "filterSize", "is", "None", ":", "filterSize", "=", "len", "(", "data", ")", "/", "10", "kernel", "=", "kernel_gaussian", "(", "size", "=", "filterSize", ")", "data", "=", ...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
convolve
This applies a kernel to a signal through convolution and returns the result. Some magic is done at the edges so the result doesn't apprach zero: 1. extend the signal's edges with len(kernel)/2 duplicated values 2. perform the convolution ('same' mode) 3. slice-off the ends we added ...
swhlab/common.py
def convolve(signal,kernel): """ This applies a kernel to a signal through convolution and returns the result. Some magic is done at the edges so the result doesn't apprach zero: 1. extend the signal's edges with len(kernel)/2 duplicated values 2. perform the convolution ('same' mode) ...
def convolve(signal,kernel): """ This applies a kernel to a signal through convolution and returns the result. Some magic is done at the edges so the result doesn't apprach zero: 1. extend the signal's edges with len(kernel)/2 duplicated values 2. perform the convolution ('same' mode) ...
[ "This", "applies", "a", "kernel", "to", "a", "signal", "through", "convolution", "and", "returns", "the", "result", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/common.py#L49-L63
[ "def", "convolve", "(", "signal", ",", "kernel", ")", ":", "pad", "=", "np", ".", "ones", "(", "len", "(", "kernel", ")", "/", "2", ")", "signal", "=", "np", ".", "concatenate", "(", "(", "pad", "*", "signal", "[", "0", "]", ",", "signal", ",",...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
timeit
simple timer. returns a time object, or a string.
swhlab/common.py
def timeit(timer=None): """simple timer. returns a time object, or a string.""" if timer is None: return time.time() else: took=time.time()-timer if took<1: return "%.02f ms"%(took*1000.0) elif took<60: return "%.02f s"%(took) else: ...
def timeit(timer=None): """simple timer. returns a time object, or a string.""" if timer is None: return time.time() else: took=time.time()-timer if took<1: return "%.02f ms"%(took*1000.0) elif took<60: return "%.02f s"%(took) else: ...
[ "simple", "timer", ".", "returns", "a", "time", "object", "or", "a", "string", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/common.py#L97-L108
[ "def", "timeit", "(", "timer", "=", "None", ")", ":", "if", "timer", "is", "None", ":", "return", "time", ".", "time", "(", ")", "else", ":", "took", "=", "time", ".", "time", "(", ")", "-", "timer", "if", "took", "<", "1", ":", "return", "\"%....
a86c3c65323cec809a4bd4f81919644927094bf5
valid
list_move_to_front
if the value is in the list, move it to the front and return it.
swhlab/common.py
def list_move_to_front(l,value='other'): """if the value is in the list, move it to the front and return it.""" l=list(l) if value in l: l.remove(value) l.insert(0,value) return l
def list_move_to_front(l,value='other'): """if the value is in the list, move it to the front and return it.""" l=list(l) if value in l: l.remove(value) l.insert(0,value) return l
[ "if", "the", "value", "is", "in", "the", "list", "move", "it", "to", "the", "front", "and", "return", "it", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/common.py#L125-L131
[ "def", "list_move_to_front", "(", "l", ",", "value", "=", "'other'", ")", ":", "l", "=", "list", "(", "l", ")", "if", "value", "in", "l", ":", "l", ".", "remove", "(", "value", ")", "l", ".", "insert", "(", "0", ",", "value", ")", "return", "l"...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
list_move_to_back
if the value is in the list, move it to the back and return it.
swhlab/common.py
def list_move_to_back(l,value='other'): """if the value is in the list, move it to the back and return it.""" l=list(l) if value in l: l.remove(value) l.append(value) return l
def list_move_to_back(l,value='other'): """if the value is in the list, move it to the back and return it.""" l=list(l) if value in l: l.remove(value) l.append(value) return l
[ "if", "the", "value", "is", "in", "the", "list", "move", "it", "to", "the", "back", "and", "return", "it", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/common.py#L133-L139
[ "def", "list_move_to_back", "(", "l", ",", "value", "=", "'other'", ")", ":", "l", "=", "list", "(", "l", ")", "if", "value", "in", "l", ":", "l", ".", "remove", "(", "value", ")", "l", ".", "append", "(", "value", ")", "return", "l" ]
a86c3c65323cec809a4bd4f81919644927094bf5
valid
list_order_by
given a list and a list of items to be first, return the list in the same order except that it begins with each of the first items.
swhlab/common.py
def list_order_by(l,firstItems): """given a list and a list of items to be first, return the list in the same order except that it begins with each of the first items.""" l=list(l) for item in firstItems[::-1]: #backwards if item in l: l.remove(item) l.insert(0,item) ...
def list_order_by(l,firstItems): """given a list and a list of items to be first, return the list in the same order except that it begins with each of the first items.""" l=list(l) for item in firstItems[::-1]: #backwards if item in l: l.remove(item) l.insert(0,item) ...
[ "given", "a", "list", "and", "a", "list", "of", "items", "to", "be", "first", "return", "the", "list", "in", "the", "same", "order", "except", "that", "it", "begins", "with", "each", "of", "the", "first", "items", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/common.py#L141-L149
[ "def", "list_order_by", "(", "l", ",", "firstItems", ")", ":", "l", "=", "list", "(", "l", ")", "for", "item", "in", "firstItems", "[", ":", ":", "-", "1", "]", ":", "#backwards", "if", "item", "in", "l", ":", "l", ".", "remove", "(", "item", "...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
abfSort
given a list of goofy ABF names, return it sorted intelligently. This places things like 16o01001 after 16901001.
swhlab/common.py
def abfSort(IDs): """ given a list of goofy ABF names, return it sorted intelligently. This places things like 16o01001 after 16901001. """ IDs=list(IDs) monO=[] monN=[] monD=[] good=[] for ID in IDs: if ID is None: continue if 'o' in ID: m...
def abfSort(IDs): """ given a list of goofy ABF names, return it sorted intelligently. This places things like 16o01001 after 16901001. """ IDs=list(IDs) monO=[] monN=[] monD=[] good=[] for ID in IDs: if ID is None: continue if 'o' in ID: m...
[ "given", "a", "list", "of", "goofy", "ABF", "names", "return", "it", "sorted", "intelligently", ".", "This", "places", "things", "like", "16o01001", "after", "16901001", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/common.py#L163-L184
[ "def", "abfSort", "(", "IDs", ")", ":", "IDs", "=", "list", "(", "IDs", ")", "monO", "=", "[", "]", "monN", "=", "[", "]", "monD", "=", "[", "]", "good", "=", "[", "]", "for", "ID", "in", "IDs", ":", "if", "ID", "is", "None", ":", "continue...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
abfGroups
Given a folder path or list of files, return groups (dict) by cell. Rules which define parents (cells): * assume each cell has one or several ABFs * that cell can be labeled by its "ID" or "parent" ABF (first abf) * the ID is just the filename of the first abf without .abf * if any ...
swhlab/common.py
def abfGroups(abfFolder): """ Given a folder path or list of files, return groups (dict) by cell. Rules which define parents (cells): * assume each cell has one or several ABFs * that cell can be labeled by its "ID" or "parent" ABF (first abf) * the ID is just the filename of the fi...
def abfGroups(abfFolder): """ Given a folder path or list of files, return groups (dict) by cell. Rules which define parents (cells): * assume each cell has one or several ABFs * that cell can be labeled by its "ID" or "parent" ABF (first abf) * the ID is just the filename of the fi...
[ "Given", "a", "folder", "path", "or", "list", "of", "files", "return", "groups", "(", "dict", ")", "by", "cell", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/common.py#L186-L241
[ "def", "abfGroups", "(", "abfFolder", ")", ":", "# prepare the list of files, filenames, and IDs", "files", "=", "False", "if", "type", "(", "abfFolder", ")", "is", "str", "and", "os", ".", "path", ".", "isdir", "(", "abfFolder", ")", ":", "files", "=", "abf...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
abfGroupFiles
when given a dictionary where every key contains a list of IDs, replace the keys with the list of files matching those IDs. This is how you get a list of files belonging to each child for each parent.
swhlab/common.py
def abfGroupFiles(groups,folder): """ when given a dictionary where every key contains a list of IDs, replace the keys with the list of files matching those IDs. This is how you get a list of files belonging to each child for each parent. """ assert os.path.exists(folder) files=os.listdir(fo...
def abfGroupFiles(groups,folder): """ when given a dictionary where every key contains a list of IDs, replace the keys with the list of files matching those IDs. This is how you get a list of files belonging to each child for each parent. """ assert os.path.exists(folder) files=os.listdir(fo...
[ "when", "given", "a", "dictionary", "where", "every", "key", "contains", "a", "list", "of", "IDs", "replace", "the", "keys", "with", "the", "list", "of", "files", "matching", "those", "IDs", ".", "This", "is", "how", "you", "get", "a", "list", "of", "f...
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/common.py#L243-L258
[ "def", "abfGroupFiles", "(", "groups", ",", "folder", ")", ":", "assert", "os", ".", "path", ".", "exists", "(", "folder", ")", "files", "=", "os", ".", "listdir", "(", "folder", ")", "group2", "=", "{", "}", "for", "parent", "in", "groups", ".", "...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
parent
given a groups dictionary and an ID, return its actual parent ID.
swhlab/common.py
def parent(groups,ID): """given a groups dictionary and an ID, return its actual parent ID.""" if ID in groups.keys(): return ID # already a parent if not ID in groups.keys(): for actualParent in groups.keys(): if ID in groups[actualParent]: return actualParent # ...
def parent(groups,ID): """given a groups dictionary and an ID, return its actual parent ID.""" if ID in groups.keys(): return ID # already a parent if not ID in groups.keys(): for actualParent in groups.keys(): if ID in groups[actualParent]: return actualParent # ...
[ "given", "a", "groups", "dictionary", "and", "an", "ID", "return", "its", "actual", "parent", "ID", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/common.py#L260-L268
[ "def", "parent", "(", "groups", ",", "ID", ")", ":", "if", "ID", "in", "groups", ".", "keys", "(", ")", ":", "return", "ID", "# already a parent", "if", "not", "ID", "in", "groups", ".", "keys", "(", ")", ":", "for", "actualParent", "in", "groups", ...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
filesByType
given a list of files, return them as a dict sorted by type: * plot, tif, data, other
swhlab/common.py
def filesByType(fileList): """ given a list of files, return them as a dict sorted by type: * plot, tif, data, other """ features=["plot","tif","data","other","experiment"] files={} for feature in features: files[feature]=[] for fname in fileList: other=True f...
def filesByType(fileList): """ given a list of files, return them as a dict sorted by type: * plot, tif, data, other """ features=["plot","tif","data","other","experiment"] files={} for feature in features: files[feature]=[] for fname in fileList: other=True f...
[ "given", "a", "list", "of", "files", "return", "them", "as", "a", "dict", "sorted", "by", "type", ":", "*", "plot", "tif", "data", "other" ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/common.py#L270-L287
[ "def", "filesByType", "(", "fileList", ")", ":", "features", "=", "[", "\"plot\"", ",", "\"tif\"", ",", "\"data\"", ",", "\"other\"", ",", "\"experiment\"", "]", "files", "=", "{", "}", "for", "feature", "in", "features", ":", "files", "[", "feature", "]...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
userFolder
return the semi-temporary user folder
swhlab/common.py
def userFolder(): """return the semi-temporary user folder""" #path=os.path.abspath(tempfile.gettempdir()+"/swhlab/") #don't use tempdir! it will get deleted easily. path=os.path.expanduser("~")+"/.swhlab/" # works on windows or linux # for me, path=r"C:\Users\swharden\.swhlab" if not os.path.ex...
def userFolder(): """return the semi-temporary user folder""" #path=os.path.abspath(tempfile.gettempdir()+"/swhlab/") #don't use tempdir! it will get deleted easily. path=os.path.expanduser("~")+"/.swhlab/" # works on windows or linux # for me, path=r"C:\Users\swharden\.swhlab" if not os.path.ex...
[ "return", "the", "semi", "-", "temporary", "user", "folder" ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/common.py#L291-L300
[ "def", "userFolder", "(", ")", ":", "#path=os.path.abspath(tempfile.gettempdir()+\"/swhlab/\")", "#don't use tempdir! it will get deleted easily.", "path", "=", "os", ".", "path", ".", "expanduser", "(", "\"~\"", ")", "+", "\"/.swhlab/\"", "# works on windows or linux", "# fo...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
abfFname_Load
return the path of the last loaded ABF.
swhlab/common.py
def abfFname_Load(): """return the path of the last loaded ABF.""" fname=userFolder()+"/abfFname.ini" if os.path.exists(fname): abfFname=open(fname).read().strip() if os.path.exists(abfFname) or abfFname.endswith("_._"): return abfFname return os.path.abspath(os.sep)
def abfFname_Load(): """return the path of the last loaded ABF.""" fname=userFolder()+"/abfFname.ini" if os.path.exists(fname): abfFname=open(fname).read().strip() if os.path.exists(abfFname) or abfFname.endswith("_._"): return abfFname return os.path.abspath(os.sep)
[ "return", "the", "path", "of", "the", "last", "loaded", "ABF", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/common.py#L302-L309
[ "def", "abfFname_Load", "(", ")", ":", "fname", "=", "userFolder", "(", ")", "+", "\"/abfFname.ini\"", "if", "os", ".", "path", ".", "exists", "(", "fname", ")", ":", "abfFname", "=", "open", "(", "fname", ")", ".", "read", "(", ")", ".", "strip", ...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
abfFname_Save
return the path of the last loaded ABF.
swhlab/common.py
def abfFname_Save(abfFname): """return the path of the last loaded ABF.""" fname=userFolder()+"/abfFname.ini" with open(fname,'w') as f: f.write(os.path.abspath(abfFname)) return
def abfFname_Save(abfFname): """return the path of the last loaded ABF.""" fname=userFolder()+"/abfFname.ini" with open(fname,'w') as f: f.write(os.path.abspath(abfFname)) return
[ "return", "the", "path", "of", "the", "last", "loaded", "ABF", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/common.py#L312-L317
[ "def", "abfFname_Save", "(", "abfFname", ")", ":", "fname", "=", "userFolder", "(", ")", "+", "\"/abfFname.ini\"", "with", "open", "(", "fname", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "os", ".", "path", ".", "abspath", "(", "abfFnam...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
gui_getFile
Launch an ABF file selection file dialog. This is smart, and remembers (through reboots) where you last were.
swhlab/common.py
def gui_getFile(): """ Launch an ABF file selection file dialog. This is smart, and remembers (through reboots) where you last were. """ import tkinter as tk from tkinter import filedialog root = tk.Tk() # this is natively supported by python root.withdraw() # hide main window root.w...
def gui_getFile(): """ Launch an ABF file selection file dialog. This is smart, and remembers (through reboots) where you last were. """ import tkinter as tk from tkinter import filedialog root = tk.Tk() # this is natively supported by python root.withdraw() # hide main window root.w...
[ "Launch", "an", "ABF", "file", "selection", "file", "dialog", ".", "This", "is", "smart", "and", "remembers", "(", "through", "reboots", ")", "where", "you", "last", "were", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/common.py#L321-L339
[ "def", "gui_getFile", "(", ")", ":", "import", "tkinter", "as", "tk", "from", "tkinter", "import", "filedialog", "root", "=", "tk", ".", "Tk", "(", ")", "# this is natively supported by python", "root", ".", "withdraw", "(", ")", "# hide main window", "root", ...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
gui_getFolder
Launch a folder selection dialog. This is smart, and remembers (through reboots) where you last were.
swhlab/common.py
def gui_getFolder(): """ Launch a folder selection dialog. This is smart, and remembers (through reboots) where you last were. """ import tkinter as tk from tkinter import filedialog root = tk.Tk() # this is natively supported by python root.withdraw() # hide main window root.wm_attr...
def gui_getFolder(): """ Launch a folder selection dialog. This is smart, and remembers (through reboots) where you last were. """ import tkinter as tk from tkinter import filedialog root = tk.Tk() # this is natively supported by python root.withdraw() # hide main window root.wm_attr...
[ "Launch", "a", "folder", "selection", "dialog", ".", "This", "is", "smart", "and", "remembers", "(", "through", "reboots", ")", "where", "you", "last", "were", "." ]
swharden/SWHLab
python
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/common.py#L341-L358
[ "def", "gui_getFolder", "(", ")", ":", "import", "tkinter", "as", "tk", "from", "tkinter", "import", "filedialog", "root", "=", "tk", ".", "Tk", "(", ")", "# this is natively supported by python", "root", ".", "withdraw", "(", ")", "# hide main window", "root", ...
a86c3c65323cec809a4bd4f81919644927094bf5
valid
_try_catch_coro
Coroutine wrapper to catch errors after async scheduling. Args: emitter (EventEmitter): The event emitter that is attempting to call a listener. event (str): The event that triggered the emitter. listener (async def): The async def that was used to generate the coro. cor...
eventemitter/emitter.py
async def _try_catch_coro(emitter, event, listener, coro): """Coroutine wrapper to catch errors after async scheduling. Args: emitter (EventEmitter): The event emitter that is attempting to call a listener. event (str): The event that triggered the emitter. listener (async d...
async def _try_catch_coro(emitter, event, listener, coro): """Coroutine wrapper to catch errors after async scheduling. Args: emitter (EventEmitter): The event emitter that is attempting to call a listener. event (str): The event that triggered the emitter. listener (async d...
[ "Coroutine", "wrapper", "to", "catch", "errors", "after", "async", "scheduling", "." ]
asyncdef/eventemitter
python
https://github.com/asyncdef/eventemitter/blob/148b700c5846d8fdafc562d4326587da5447223f/eventemitter/emitter.py#L11-L36
[ "async", "def", "_try_catch_coro", "(", "emitter", ",", "event", ",", "listener", ",", "coro", ")", ":", "try", ":", "await", "coro", "except", "Exception", "as", "exc", ":", "if", "event", "==", "emitter", ".", "LISTENER_ERROR_EVENT", ":", "raise", "emitt...
148b700c5846d8fdafc562d4326587da5447223f
valid
EventEmitter._check_limit
Check if the listener limit is hit and warn if needed.
eventemitter/emitter.py
def _check_limit(self, event): """Check if the listener limit is hit and warn if needed.""" if self.count(event) > self.max_listeners: warnings.warn( 'Too many listeners for event {}'.format(event), ResourceWarning, )
def _check_limit(self, event): """Check if the listener limit is hit and warn if needed.""" if self.count(event) > self.max_listeners: warnings.warn( 'Too many listeners for event {}'.format(event), ResourceWarning, )
[ "Check", "if", "the", "listener", "limit", "is", "hit", "and", "warn", "if", "needed", "." ]
asyncdef/eventemitter
python
https://github.com/asyncdef/eventemitter/blob/148b700c5846d8fdafc562d4326587da5447223f/eventemitter/emitter.py#L63-L70
[ "def", "_check_limit", "(", "self", ",", "event", ")", ":", "if", "self", ".", "count", "(", "event", ")", ">", "self", ".", "max_listeners", ":", "warnings", ".", "warn", "(", "'Too many listeners for event {}'", ".", "format", "(", "event", ")", ",", "...
148b700c5846d8fdafc562d4326587da5447223f
valid
EventEmitter.add_listener
Bind a listener to a particular event. Args: event (str): The name of the event to listen for. This may be any string value. listener (def or async def): The callback to execute when the event fires. This may be a sync or async function.
eventemitter/emitter.py
def add_listener(self, event, listener): """Bind a listener to a particular event. Args: event (str): The name of the event to listen for. This may be any string value. listener (def or async def): The callback to execute when the event fires. Thi...
def add_listener(self, event, listener): """Bind a listener to a particular event. Args: event (str): The name of the event to listen for. This may be any string value. listener (def or async def): The callback to execute when the event fires. Thi...
[ "Bind", "a", "listener", "to", "a", "particular", "event", "." ]
asyncdef/eventemitter
python
https://github.com/asyncdef/eventemitter/blob/148b700c5846d8fdafc562d4326587da5447223f/eventemitter/emitter.py#L72-L84
[ "def", "add_listener", "(", "self", ",", "event", ",", "listener", ")", ":", "self", ".", "emit", "(", "'new_listener'", ",", "event", ",", "listener", ")", "self", ".", "_listeners", "[", "event", "]", ".", "append", "(", "listener", ")", "self", ".",...
148b700c5846d8fdafc562d4326587da5447223f
valid
EventEmitter.once
Add a listener that is only called once.
eventemitter/emitter.py
def once(self, event, listener): """Add a listener that is only called once.""" self.emit('new_listener', event, listener) self._once[event].append(listener) self._check_limit(event) return self
def once(self, event, listener): """Add a listener that is only called once.""" self.emit('new_listener', event, listener) self._once[event].append(listener) self._check_limit(event) return self
[ "Add", "a", "listener", "that", "is", "only", "called", "once", "." ]
asyncdef/eventemitter
python
https://github.com/asyncdef/eventemitter/blob/148b700c5846d8fdafc562d4326587da5447223f/eventemitter/emitter.py#L88-L93
[ "def", "once", "(", "self", ",", "event", ",", "listener", ")", ":", "self", ".", "emit", "(", "'new_listener'", ",", "event", ",", "listener", ")", "self", ".", "_once", "[", "event", "]", ".", "append", "(", "listener", ")", "self", ".", "_check_li...
148b700c5846d8fdafc562d4326587da5447223f
valid
EventEmitter.remove_listener
Remove a listener from the emitter. Args: event (str): The event name on which the listener is bound. listener: A reference to the same object given to add_listener. Returns: bool: True if a listener was removed else False. This method only removes one list...
eventemitter/emitter.py
def remove_listener(self, event, listener): """Remove a listener from the emitter. Args: event (str): The event name on which the listener is bound. listener: A reference to the same object given to add_listener. Returns: bool: True if a listener was removed...
def remove_listener(self, event, listener): """Remove a listener from the emitter. Args: event (str): The event name on which the listener is bound. listener: A reference to the same object given to add_listener. Returns: bool: True if a listener was removed...
[ "Remove", "a", "listener", "from", "the", "emitter", "." ]
asyncdef/eventemitter
python
https://github.com/asyncdef/eventemitter/blob/148b700c5846d8fdafc562d4326587da5447223f/eventemitter/emitter.py#L95-L121
[ "def", "remove_listener", "(", "self", ",", "event", ",", "listener", ")", ":", "with", "contextlib", ".", "suppress", "(", "ValueError", ")", ":", "self", ".", "_listeners", "[", "event", "]", ".", "remove", "(", "listener", ")", "return", "True", "with...
148b700c5846d8fdafc562d4326587da5447223f
valid
EventEmitter.remove_all_listeners
Remove all listeners, or those of the specified *event*. It's not a good idea to remove listeners that were added elsewhere in the code, especially when it's on an emitter that you didn't create (e.g. sockets or file streams).
eventemitter/emitter.py
def remove_all_listeners(self, event=None): """Remove all listeners, or those of the specified *event*. It's not a good idea to remove listeners that were added elsewhere in the code, especially when it's on an emitter that you didn't create (e.g. sockets or file streams). """ ...
def remove_all_listeners(self, event=None): """Remove all listeners, or those of the specified *event*. It's not a good idea to remove listeners that were added elsewhere in the code, especially when it's on an emitter that you didn't create (e.g. sockets or file streams). """ ...
[ "Remove", "all", "listeners", "or", "those", "of", "the", "specified", "*", "event", "*", "." ]
asyncdef/eventemitter
python
https://github.com/asyncdef/eventemitter/blob/148b700c5846d8fdafc562d4326587da5447223f/eventemitter/emitter.py#L123-L135
[ "def", "remove_all_listeners", "(", "self", ",", "event", "=", "None", ")", ":", "if", "event", "is", "None", ":", "self", ".", "_listeners", "=", "collections", ".", "defaultdict", "(", "list", ")", "self", ".", "_once", "=", "collections", ".", "defaul...
148b700c5846d8fdafc562d4326587da5447223f