Skip to content

Instantly share code, notes, and snippets.

View lstagner's full-sized avatar

Luke Stagner lstagner

View GitHub Profile
@lstagner
lstagner / Compressed Sensing.ipynb
Created February 25, 2020 00:20
Compressed Sensing in Julia
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lstagner
lstagner / Runaway Electron Orbits.ipynb
Created February 4, 2020 21:51
Runaway Electron Orbits + Bremsstrahlung
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lstagner
lstagner / Callback MWE.ipynb
Last active October 18, 2018 19:30
Callback MWE
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
! Module libfida defined in file fidasim.f90
subroutine f90wrap_interpolcoeffs1d__get__i(this, f90wrap_i)
use libfida, only: interpolcoeffs1d
implicit none
type interpolcoeffs1d_ptr_type
type(interpolcoeffs1d), pointer :: p => NULL()
end type interpolcoeffs1d_ptr_type
integer, intent(in) :: this(2)
type(interpolcoeffs1d_ptr_type) :: this_ptr
@everywhere push!(LOAD_PATH, "/home/stagnerl/")
import InterpolatingFunctions; @everywhere using InterpolatingFunctions
import GuidingCenterOrbits; @everywhere using GuidingCenterOrbits
import HDF5; @everywhere using HDF5
import Clustering; @everywhere using Clustering
import Iterators; @everywhere using Iterators
import StaticArrays; @everywhere using StaticArrays
import FastKmeans; @everywhere using FastKmeans
function make_clustered_distribution_file(M,wall,nkk)
@lstagner
lstagner / read_ncdf.py
Last active May 25, 2016 22:39
Reads a NetCDF 3 file and returns a dict with its variables
#The MIT License (MIT)
#Copyright (c) 2016 Luke Stagner
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software
#and associated documentation files (the "Software"), to deal in the Software without restriction,
#including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
#and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
#subject to the following conditions:
LoadError: PyError (:PyObject_Call) <class 'AttributeError'>
AttributeError("'PathCollection' object has no attribute 'do_3d_projection'",)
File "/home/lstagner/anaconda3/lib/python3.5/site-packages/mpl_toolkits/mplot3d/axes3d.py", line 2273, in scatter
patches = Axes.scatter(self, xs, ys, s=s, c=c, *args, **kwargs)
File "/home/lstagner/anaconda3/lib/python3.5/site-packages/matplotlib/__init__.py", line 1812, in inner
return func(ax, *args, **kwargs)
File "/home/lstagner/anaconda3/lib/python3.5/site-packages/matplotlib/axes/_axes.py", line 3922, in scatter
self.add_collection(collection)
File "/home/lstagner/anaconda3/lib/python3.5/site-packages/matplotlib/axes/_base.py", line 1676, in add_collection
collection.set_clip_path(self.patch)
@lstagner
lstagner / ijulia_python2.log
Created June 12, 2015 20:01
IJulia python 2 error
SENDING IPython Msg [ idents pyerr ] {
header = Dict("msg_id"=>"d3543821-d811-4529-b786-ce4128bb9015","msg_type"=>"pyerr","username"=>"username","session"=>"937AFEA751D3466C8BF47EA8C7C66E2A"),
metadata = Dict{AbstractString,Any}(),
content = Dict{ASCIIString,Any}("traceback"=>UTF8String["PyError (:PyObject_Call) <type 'exceptions.AttributeError'>\nAttributeError(\"'Path' object has no attribute '_vertices'\",)\n File \"/home/lstagner/anaconda3/envs/python2/lib/python2.7/site-packages/matplotlib/backend_bases.py\", line 2158, in print_figure\n **kwargs)\n File \"/home/lstagner/anaconda3/envs/python2/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py\", line 521, in print_png\n FigureCanvasAgg.draw(self)\n File \"/home/lstagner/anaconda3/envs/python2/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py\", line 469, in draw\n self.figure.draw(self.renderer)\n File \"/home/lstagner/anaconda3/envs/python2/lib/python2.7/site-packages/matplotlib/artist.py\", line 59, in draw_
@lstagner
lstagner / ijulia.log
Created June 12, 2015 06:43
IJulia v0.4.0-dev Crash
EXECUTING using PyPlot
SENDING IPython Msg [ idents pyin ] {
header = Dict("msg_id"=>"fa39874c-5f4a-4265-add0-28cdfb910334","msg_type"=>"pyin","username"=>"username","session"=>"5DBF73B2FA44486D88C609D2E1C4BCE8"),
metadata = Dict{AbstractString,Any}(),
content = Dict{ASCIIString,Any}("code"=>"using PyPlot","execution_count"=>1)
}
Warning: New definition
call(Type{PyCall.PyDict}, Base.Associative{#K<:Any, Any}) at /home/lstagner/.julia/v0.4/PyCall/src/conversions.jl:464
is ambiguous with:
call(Type{PyCall.PyDict}, Base.Associative{Any, #V<:Any}) at /home/lstagner/.julia/v0.4/PyCall/src/conversions.jl:463.
@lstagner
lstagner / crash.txt
Created June 10, 2015 11:08
IJulia Crash
EXECUTING dens[err_ind-1] = sum(max(sol.x,0))
dens_err[err_ind-1] = norm(sol.sigma)
x[:,:,err_ind-1] = reshape(max(sol.x,0),npitch,nenergy)
sigma[:,:,err_ind-1] = reshape(sol.sigma,npitch,nenergy)
dx[:,:,err_ind-1] = x[:,:,err_ind-1] .- dist
pygui(true)
make_plots(energy,pitch,x[:,:,err_ind-1],sigma[:,:,err_ind-1],dist)
SENDING IPython Msg [ idents pyin ] {
header = ["msg_id"=>"1442b99d-500f-488e-99c2-e2b4ad9f2a51","msg_type"=>"pyin","username"=>"username","session"=>"9435E47D56D3486F894CA922AEFD2A89"],
metadata = Dict{String,Any}(),