Skip to content

Instantly share code, notes, and snippets.

View blondegeek's full-sized avatar

Tess Smidt blondegeek

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@blondegeek
blondegeek / iplot_vrml_mesh.py
Created July 8, 2019 22:41
plot VRML mesh with plotly trisurface
import numpy as np
import re
import plotly
plotly.offline.init_notebook_mode(connected=False)
import plotly.figure_factory as FF
import plotly.graph_objs as go
# Based on https://scicomp.stackexchange.com/questions/11528/wrl-and-vrml-to-matplotlib-numpy
holder = []
#!/usr/bin/env python
# USAGE
# conv_calc.py width filter_size padding stride
import sys
args = list(map(int, sys.argv[1:]))
if len(args) == 0:
print("Usage: conv_calc.py width filter_size padding stride")
"""
This script can be used to determine the sensitivity of a crystal's
spacegroup to the symmetry precision.
"""
from pymatgen.core.structure import Structure
from pymatgen.symmetry.groups import SpaceGroup
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
from math import *
from numpy import isclose
import numpy as np
from pymatgen.core.structure import *
from pymatgen.core.lattice import *
# For PubChem 3D data, only the following atoms are included:
# H, C, N, O, F, Si, P, S, Cl, Br, and I
def structure_to_discrete(s,pixel_length=0.2,element_index=None,empty=0):
if element_index == None:
element_index = ["H","C","N","O","F","Si","P","S","Cl","Br","I"]
@blondegeek
blondegeek / simple_plotly_surface_plotly_vs_offline.py
Created November 28, 2018 21:53
Simple example of plotly surface plot plotting with plotly.plotly versus plotly.offline
# Example for
# https://stackoverflow.com/questions/53507426/why-is-ipad-not-able-to-render-offline-plotly-plots-but-iphone-can
# This code is intended to be run in a jupyter notebook
import plotly
import plotly.plotly as py
import plotly.graph_objs as go
import plotly.offline
plotly.offline.init_notebook_mode(connected=False)
@blondegeek
blondegeek / polar_metal_mp_query.ipynb
Created January 16, 2018 22:38
How to query for polar metals in the Materials Project
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@blondegeek
blondegeek / numpy_to_tfrecords_example.py
Created February 2, 2017 03:54
Example of how to convert numpy compressed file to TFRecords
import tensorflow as tf
import numpy as np
# This was useful
# see http://stackoverflow.com/questions/33849617/how-do-i-convert-a-directory-of-jpeg-images-to-tfrecords-file-in-tensorflow
# Example numpy file.
files = ['CH_7381_8380_1478761500.9.npz']
def _int64list_feature(value):
@blondegeek
blondegeek / 1GPU_command
Created January 22, 2017 21:58
harmonicConvolutions -- error when using multiple GPUs -- job.out, job.err, and python command for train.py with one and two GPUs
python train.py 0 mnist deep_stable /global/scratch/tsmidt/harmonicConvolutions/mnist
"""
Download eggs from here (you will have to log in to enthougt)
https://store.enthought.com/repo/.iron/eggs/
Change to download directory in command prompt.
Put this file also in that directory
Type:
ipy IronPython_numpy_scipy.py --install