Skip to content

Instantly share code, notes, and snippets.

View cmeyer's full-sized avatar

Chris Meyer cmeyer

View GitHub Profile
@cmeyer
cmeyer / ReadNData1.py
Last active November 4, 2024 21:38
Python code to read .ndata1 file
import json
import numpy
import numpy.typing
import pathlib
import typing
import zipfile
def read_ndata1(path: pathlib.Path) -> typing.Tuple[typing.Optional[typing.Dict[str, typing.Any]], typing.Optional[numpy.typing.NDArray[typing.Any]]]:
zip_file = zipfile.ZipFile(path, 'r')
namelist = zip_file.namelist()
# conda create -n py310 numpy scipy -y
# conda create -n py310-forge -c conda-forge numpy scipy -y
# conda install -c conda-forge pyfftw
# as of 2022-05-31 conda-forge has no signficant performance difference from conda on Windows, python 3.10
# and scipy.fft is much faster than numpy.fft. pyfftw is slower.
import time
import numpy
import scipy
@cmeyer
cmeyer / runtests.py
Last active October 28, 2021 17:01
Script to run all tests
#!/usr/bin/env python
import logging
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
from nion.swift import Test as Test
packages = []
@cmeyer
cmeyer / all_typing.sh
Last active May 19, 2022 16:06
Run type checks
#!/bin/zsh
autoload colors; colors
echo $fg_bold[blue]`date`$fg[black]
for python in py310-test py39-forge py38-forge
do
mypy=/Users/cmeyer/miniconda3/envs/$python/bin/mypy