Skip to content

Instantly share code, notes, and snippets.

@hgrecco
hgrecco / lantz_multiple.py
Created October 5, 2012 12:09
Writting a multiple interface driver in lantz
class _A33120(object):
"""Agilent 33120A Function/Arbitrary Waveform Generator
"""
# Here goes the code for the instrument functions that
# are available in *both* GPIB and RS-232
class A33120Serial(_A33120, SerialDriver):
"""Agilent 33120A Function/Arbitrary Waveform Generator
@hgrecco
hgrecco / tasks.py
Last active June 22, 2022 07:49
Simple concurrent tasks with dependencies in Python.
from collections import defaultdict
import concurrent.futures
class TasksGroup(object):
"""A group of tasks with dependencies.
>>> tasks = TasksGroup()
>>> @tasks.add()
@hgrecco
hgrecco / test_wrap.py
Created August 21, 2013 01:28
Wrapping a ndarray
import numpy as np
class C(object):
def __init__(self, value):
self.value = value
def __getattr__(self, name):
return getattr(self.value, name)
@hgrecco
hgrecco / code
Last active December 22, 2015 14:39 — forked from ColinBrosseau/code
SampleRateUnit = {'Seconds': '0', 'Minutes': '1', 'Hours': '2',
'Days': '3', '%': '4'}
SamplePeriodUnit = {'Seconds': '0', 'Minutes': '1', 'Hours': '2',
'Days': '3', 'Weeks': '4', 'Pulses': '5'}
TotalDurationUnit = {'Period': '0', 'Seconds': '1', 'Minutes': '2',
'Hours': '3', 'Days': '4', 'Weeks': '5', 'Continuous': '6',
'predefinded': '7'}
TimeStampEnabled = {False: 0, True: 1}
@Feat(values=(None, SampleRateUnit, None, SamplePeriodUnit, None,
from __future__ import division, unicode_literals, print_function, absolute_import
import re
from collections import defaultdict
_NEST_SCOPES = {'[': ']', '(': ')', '{': '}'}
_STR_SCOPES = '"' + "'"
#: Regex to find function calls.
@hgrecco
hgrecco / flux.py
Created March 12, 2014 06:00
A GUI to travel through time in your filesystem using Camlistore.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Camlistore Flux Capacitor
~~~~~~~~~~~~~~~~~~~~~~~~~
A GUI to travel through time in your filesystem using Camlistore.
:copyright: 2014 by Hernan E. Grecco.
:license: BSD.
@hgrecco
hgrecco / gist:3db1fb7d9b5357b668c7
Last active February 22, 2017 14:13
Matplotlib theming
http://olgabot.github.io/prettyplotlib/
http://damon-is-a-geek.com/publication-ready-the-first-time-beautiful-reproducible-plots-with-matplotlib.html
http://datasciencelab.wordpress.com/2013/12/21/beautiful-plots-with-pandas-and-matplotlib/
http://www.huyng.com/posts/sane-color-scheme-for-matplotlib/
http://stanford.edu/~mwaskom/software/seaborn/index.html
http://nbviewer.ipython.org/gist/olgabot/5357268
@hgrecco
hgrecco / get-lantz.py
Created December 31, 2014 05:51
Script to install Lantz and its dependencies
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
if not sys.version_info >= (3, 2, 1):
print('Lantz requires Python >= 3.2.1')
sys.exit(1)
import os
@hgrecco
hgrecco / designer.html
Created March 20, 2015 00:00
designer
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-tooltip/core-tooltip.html">
<polymer-element name="my-element">
<template>
<style>
# -*- coding: utf-8 -*-
"""
Resource Name handling routines
:copyright: 2014 by PyVISA-sim Authors, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
from __future__ import division, unicode_literals, print_function, absolute_import