Skip to content

Instantly share code, notes, and snippets.

View JonathanMaes's full-sized avatar

Jonathan Maes JonathanMaes

  • Ghent University
  • Belgium
  • 11:31 (UTC +01:00)
View GitHub Profile
@JonathanMaes
JonathanMaes / obj_to_ovf.py
Created June 16, 2025 08:54
Converts a 3D .obj file to a scalar OVF file at a given resolution. OVF files are used by micromagnetic simulators like OOMMF and mumax³.
import numpy as np
import trimesh # https://github.com/mikedh/trimesh
def write_ovf(voxel_grid, filename, resolution):
""" Writes voxel grid into OVF file format. """
nx, ny, nz = voxel_grid.shape
with open(filename, 'w') as f:
f.write("# OOMMF OVF 2.0\n")
@JonathanMaes
JonathanMaes / terminator.py
Last active April 2, 2025 18:33
Terminator boundary calculator (and plotting)
""" This script implements a class for calculating the Earth terminator.
Additional functionality for calculating the boundary of the various
twilight types and plotting these areas on a 2D map are also provided.
--------------------------------------------------------------------------
Copyright (C) 2023 Jonathan Maes
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.