Skip to content

Instantly share code, notes, and snippets.

View mgmarino's full-sized avatar

Michael Marino mgmarino

View GitHub Profile
"""
Script to upload documents t the measurements DB.
Usage: python {} doc_id file_one [file_two] ... [file_n]
"""
import pynedm
from clint.textui.progress import Bar as ProgressBar
import json
import sys
from glob import iglob
"""
Setup replication for a CouchDB server
"""
import cloudant
import json
_replicate_source_server = {
"protocol" : "http",
"address" : "optimal.universe-cluster.de",
"port" : "15984",
import pynedm
# Authentication
po = pynedm.ProcessObject(uri="http://raid.nedm1", username="un", password="pw")
acct = po.acct
# Grab the correct database
db = acct["nedm%2Ffluxgate"]
# Reads all data from a certain time
@mgmarino
mgmarino / allan.py
Last active September 10, 2015 12:30 — forked from stefan789/allan.py
allan deviaton
import numpy as np
def allanVar(data, sf=1):
'''
calculates allan variance
according to eq 8.13a in
David W. Allan, John H. Shoaf and Donald Halford: Statistics of Time and Frequency Data Analysis,
NBS Monograph 140, pages 151–204, 1974
'''
@mgmarino
mgmarino / daemon_test.py
Created July 30, 2015 14:37
Example for using python-daemon and runner.DaemonRunner
import time
import os
import logging
from daemon.runner import DaemonRunner
_base_path = "/path/to/daemon"
class MyApp(object):
"""
Define the required attributes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import cloudant
import json
import urllib3.request as p
import requests
import struct
def interpret_file(url):
"""
File structure is:
import socket
import math
import numpy
#import matplotlib.pyplot as plt
"""
Simple objects to communicate with the Agilent waveform generator
"""
class SocketDisconnect(Exception):
pass
// Grab a DMA device
TUVMEDevice* dev =
get_dma_device(address,// address to begin read
DL710_AddressMod, // address modifier
DL710_DataSize, // data size
false // no auto-increment, always read from address!
);
if (!dev) // handle error
int32_t retVal = read_device(
dev, // Device
// Grab a DMA device
TUVMEDevice* dev =
get_dma_device(address,// address to begin read
DL710_AddressMod, // address modifier
DL710_DataSize, // data size
false // no auto-increment, always read from address!
);
if (!dev) throw ...;
int32_t retVal = dev->Read((char*)pData, // buffer
(uint32_t)numOfBytes, // number of bytes to read