Skip to content

Instantly share code, notes, and snippets.

Avatar

Nick George nkicg6

View GitHub Profile
View sql-query-to-list-of-dicts.py
# extract SQLite3 data to dict example, explained in this post:
# https://nickgeorge.net/programming/python-sqlite3-extract-to-dictionary/
# run with:
# python3 extract-to-dict.py
import os
import sqlite3
import sys
def sql_data_to_list_of_dicts(path_to_db, select_query):
@nkicg6
nkicg6 / archive.py
Last active Sep 20, 2020
Example python script to format and add metadata from electrophysiology experiments to an SQLite metadata table
View archive.py
# example script to organize and add metadata to a database
# see https://nickgeorge.net/science/organizing-scientific-metadata-with-sqlite-and-python/
# for explanation
import argparse
import os
import csv
import sqlite3
import pyabf
@nkicg6
nkicg6 / fit_paths.py
Created Oct 30, 2019
Jython script to fit paths automatically from a traces file and image in SNT
View fit_paths.py
# @SNTService sntService
# script to fit paths from previous tracing session programatically via Jython and SNT
# single threaded fitting and slow. Will refactor to multithreaded in future....
# see: https://forum.image.sc/t/fit-paths-with-simple-neurite-tracer-api/30139/
# test traces file
traces_test = "path/to/traces_file.traces"
# test img file
image_test = "path/to/image_file.tif"