Skip to content

Instantly share code, notes, and snippets.

View bocklund's full-sized avatar
💭
Reaching equilibrium

Brandon Bocklund bocklund

💭
Reaching equilibrium
View GitHub Profile
@bocklund
bocklund / Al-Ca-Si-O-demo.ipynb
Created May 29, 2022 20:02
MQMQA multi-component demo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bocklund
bocklund / sigfigs.py
Created January 16, 2022 01:45
Print floating point to n significant digits
import math
def float_sigfigs(val, sigfigs):
"""Return a string representation of a floating point number rounded to some number of significant figures without scientific notation"""
rounded_val = float(f"{val:0.{sigfigs}g}")
num_digits = int(abs(math.log10(rounded_val))) + sigfigs
return f"{rounded_val:0.{num_digits}f}"
print(float_sigfigs(3.141592653589793e-20, 5)) # 0.000000000000000000031416
@bocklund
bocklund / COST507-modified.tdb
Last active April 23, 2024 02:45
COST507 TDB with several mistakes fixed
$
$
$ VERSION : ROUND II (January 1999)
$
$ FROZEN VERSION
$ COST - 507
$
$ THERMODYNAMIC DATABASE FOR LIGHT METAL ALLOYS
$
$
@bocklund
bocklund / regular-solutions.ipynb
Last active March 14, 2021 20:49
Regular solutions following A.D. Pelton and W.T. Thompson (1975)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bocklund
bocklund / export-xarray.ipynb
Last active December 16, 2020 22:35
Example showing how to export pycalphad xarray calculations to CSV
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bocklund
bocklund / srs.ipynb
Last active March 4, 2019 23:33
Shifting reference states, pycalphad#55
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.