Skip to content

Instantly share code, notes, and snippets.

@bruceravel
bruceravel / truncate.lar
Created February 3, 2013 16:15
Poor error reporting in larch
## import the data (see https://github.com/bruceravel/XAS-Education/blob/master/Examples/Fe%20foil/fe.060)
a = read_ascii('../../examples/fe.060')
a.xmu = ln(a.i0/a.it)
newplot(a.energy, a.xmu)
##
i = index_of(a.energy, 7000)
a.energy = a.energy[i:]
@bruceravel
bruceravel / interp example
Created November 21, 2013 13:36
This is a simple example showing that `interp` is broken in Larch 0.9.20
a=group()
b=group()
a.energy = array([ 5282.999 , 5292.9998, 5303.001 , 5312.9991, 5323.0013,
5333.0012, 5343.0008, 5352.9991, 5363.0007, 5372.9995,
5383. , 5392.9988, 5403.0005, 5412.9989, 5422.9988,
5432.9995, 5443.0003, 5453.0003, 5462.9989, 5463.3014,
5463.6011, 5463.9008, 5464.2006, 5464.5004, 5464.8003,
5465.1002, 5465.4001, 5465.7001, 5466.0002, 5466.3003,
5466.6004, 5466.9006, 5467.2008, 5467.501 , 5467.8013,
@bruceravel
bruceravel / gist:8357561
Created January 10, 2014 16:33
error building wx-perl under MacPorts
:info:build /usr/bin/clang++ -UWX_PRECOMP -c -I. -I../.. -I/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.0/lib/wx/include/osx_cocoa-unicode-3.0 -I/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.0/include/wx-3.0 -pipe -Os -fno-common -DPERL_DARWIN -I/opt/local/include -fno-strict-aliasing -fstack-protector -I/opt/local/include -arch x86_64 -O3 -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" "-I/opt/local/lib/perl5/5.16.1/darwin-thread-multi-2level/CORE" -DWXPL_EXT -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__ XRC.c
:info:build clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
:info:build In file included from XRC.c:24:
:info:build ./cpp/xr_constants.cpp:37:12: error: use of undeclared identifier 'wxXML_ELEMENT_NODE'
:info:build r( wxXML_ELEMENT_NODE );
:info:build ^
:info:build ./cpp/xr_constants.cpp:24:16: note: expanded from macro 'r'
:info:build return n;
:inf
@bruceravel
bruceravel / dpc.pl
Created April 18, 2014 18:04
simple DirPickerCtrl example
#!/usr/bin/perl
package MyApp;
use base 'Wx::App';
use Wx qw(:everything);
use Wx::Event qw(EVT_DIRPICKER_CHANGED EVT_BUTTON);
use Cwd;
$|=1;
sub OnInit {
@bruceravel
bruceravel / testVD.pl
Created July 16, 2014 14:39
test Demeter's VerbDialog control
#!/usr/bin/perl
package MyApp;
use base 'Wx::App';
use Wx qw(:everything);
use Wx::Event qw(EVT_BUTTON);
use Demeter::UI::Wx::VerbDialog;
use Cwd;
$|=1;
@bruceravel
bruceravel / cu.012
Created August 12, 2014 17:59
raw data for the canonical Cu foil spectrum from September 1992
NSLS/X11 EDC-5.02 15-Sep-92 01:52:53 E- ENERGY=2.584GEV
Cu foil, 10K, rolled and annealled foil by matt
2-SI111 HC/2D= 1977.260 STPDEG=6400. STPMMZ= 40. FOCUS=F TRANSLT=F
E0= 8980.0 NREG= 3 NPTS= 611 NSCLRS= 3 EF= .0
SRB= -193.7 -43.5 30.0 2381.3
DEL= 10.020 .483 .050K
SEC= 1.000 1.000 1.000
DETECTORSI0 I If
@bruceravel
bruceravel / SConstruct
Last active June 7, 2016 15:38
SConstruct file for json-fortran
# -*- python -*-
#
# SConstruct file for building json-fortran using scons
#
# This builds using the same commands as are used in json-fortran's
# "build.sh" script, but with proper dependency checking. It also
# deals gracefully with robodoc not being installed on the system.
#
from distutils.spawn import find_executable
@bruceravel
bruceravel / config_exfoliation.md
Last active August 29, 2015 14:15
Configuring the exfoliation theme for weewx

Setting the URLs in the exfoliation skin.conf Extras section

These notes are only useful for someone living in the US. The exfoliation theme uses a lot of links to US National Weather Service and NOAA assets.

I live in Port Jefferson, NY, USA. Use the name of your town in the examples below.

URL parameters in skin.conf

@bruceravel
bruceravel / patch.SConstruct
Created February 18, 2015 16:28
patch to update json-fortran's SConstruct
diff --git a/SConstruct b/SConstruct
index 7753412..567fb9f 100644
--- a/SConstruct
+++ b/SConstruct
@@ -19,7 +19,7 @@ elif env['FORTRAN'] == 'ifort':
env = Environment(F90FLAGS = '-O2 -warn -stand f08 -diag-disable 7601 -traceback -module lib',)
src = join('src','json_module.f90')
-obj = join('build','json_module.o')
+obj = join('lib','json_module.o')
@bruceravel
bruceravel / monolithicfeff.py
Last active August 29, 2015 14:15
larch plugin for running feff85exafs and other versions of feff from larch
## see https://github.com/xraypy/xraylarch/pull/108
from os import makedirs, chdir, getcwd, unlink, listdir
from os.path import realpath, isdir, isfile, join, basename, dirname
from distutils.spawn import find_executable
from shutil import copy, move
import subprocess
from larch import (Group, Parameter, isParameter, param_value, use_plugin_path, isNamedClass, Interpreter)