Skip to content

Instantly share code, notes, and snippets.

View davidrpmorris's full-sized avatar

David R. P. Morris davidrpmorris

  • Kitchener
View GitHub Profile
import numpy as np
import sys
# this is the file's name or path to the file
fname = 'vox.gsf'
def gsf_read(fname):
if fname.rpartition('.')[1] == '.':
fname = fname[0:fname.rfind('.')]
# Final equations from Procedure for measuring electrical resistivity of anisotropic materials:
# A revision of the Montgomery method by Dos Santos et al. (2011) in the Journal of Applied Physics
# dx.doi.org/10.1063/1.3652905
# These equations can be used to determine the electrical resistivity in the two planar directions of an anisotropic material in the form of a thin film
# They are only valid if L3/(L1*L2)^(1/2) < 0.5, note that L1, L2 and L3 are the dimensions of the isotropic mapping of the anisotropic material and can't be determined a priori
# Refer to Section III of the paper for a discussion
R2 = np.array([10, 10, 10]) # Measured resistance in direction "2" in ohms
R1 = np.array([1, 1, 1]) # Measured resistance in direction "1" in ohms
Verifying my Blockstack ID is secured with the address 1NMkspC4rwJ6b6vPupyKvgduMpHY2Hqrwg https://explorer.blockstack.org/address/1NMkspC4rwJ6b6vPupyKvgduMpHY2Hqrwg
@davidrpmorris
davidrpmorris / jinja2_filter.py
Last active January 15, 2022 21:23
Jinja2 Filter
from jinja2.filters import environmentfilter
@environmentfilter
def wrap_email(environment, s):
'''Return an email at '@' with a line break'''
email = s.split('@')
return email[0] + '@<br>' + email[1]
# after app is declared
app.jinja_env.filters['wrap_email'] = wrap_email
Verifying that "davidrpmorris.id" is my Blockstack ID. https://onename.com/davidrpmorris
@davidrpmorris
davidrpmorris / wtforms_fieldlist_json.py
Last active March 16, 2023 16:59
WTForms FormField with FieldList with JSON column type
# Skip to Line 56 to see how to set things up with JSON
# Normally each FormField is represented by its own row in a database. In this example
# each FormField is a row in the Specification table.
# models.py
class Specification(db.Model):
...
name = db.Column(db.String)