Skip to content

Instantly share code, notes, and snippets.

// CopyGrid defined in lib_grid/file_io/file_io.cpp
CopyGrid<APosition>(grid, gridOut, sh, destSh, aPosition);
size_t numVertsGrid = grid.num<Vertex>();
size_t numVertsGridOut = gridOut.num<Vertex>();
UG_COND_THROW(numVertsGrid != numVertsGridOut, "Num vertices of copied grid must agree.");
for (VertexIterator iter = grid.vertices_begin(); iter != grid.vertices_end(); ++iter) {
UG_LOGN("(grid before) aaSurfParams[*iter]: " << aaSurfParams[*iter]);
}
@stephanmg
stephanmg / example.tex
Created October 30, 2019 09:52
Draft name clash
\documentclass[utf8]{article}
\usepackage{url}
\usepackage{lineno}
\usepackage{microtype}
\usepackage{booktabs}
\usepackage[onehalfspacing]{setspace}
\usepackage{blindtext}
\usepackage{timestamp}
\usepackage{lscape}
\usepackage{tabularx}
@stephanmg
stephanmg / trigger_dependent_appveyor_build.ps1
Last active September 3, 2020 12:21
trigger_dependent_appveyor_build.ps1
param(
[Parameter(Mandatory=$true)][String]$APPVEYOR_TOKEN="",
[Parameter(Mandatory=$true)][String]$PROJECT_SLUG="",
[String]$APPVEYOR_USER=stephanmg)
if ([string]::IsNullOrWhiteSpace($APPVEYOR_TOKEN)) { "No AppVeyor API token given" }
if ([string]::IsNullOrWhiteSpace($PROJECT_SLUG)) { "No project slug to trigger given" }
if ([string]::IsNullOrWhiteSpace($APPVEYOR_USER)) { "No Appveyor user given }
$headers = @{Authorization = "Bearer $APPVEYOR_TOKEN" }
#!/bin/bash
# number of neurons
numNeurons=100
# get neurons
for index in $(seq 1 "$numNeurons"); do
python get_swc.py --search "brain_region=neocortex" \
--filter "cell_type=pyramidal" \
--filter "archive=Hrvoj-Mihic_Semendeferi" \
@stephanmg
stephanmg / Cone.cs
Last active September 18, 2020 06:45 — forked from mattatz/Cone.cs
Example of a cone mesh creator for Unity.
using UnityEngine;
using System.Collections;
[RequireComponent (typeof (MeshFilter))]
public class Cone : MonoBehaviour {
/// subdivision
public int subdivisions = 10;
/// height and radius
public float radius = 1f;
@stephanmg
stephanmg / Unity3D Cone Generator
Last active September 18, 2020 06:45 — forked from gszauer/Unity3D Cone Generator
Cone and truncated cone generator
using UnityEngine;
using UnityEditor;
using System.Collections;
// an Editor method to create a cone primitive (so far no end caps)
// the top center is placed at (0/0/0)
// the bottom center is placed at (0/0/length)
// if either one of the radii is 0, the result will be a cone, otherwise a truncated cone
// note you will get inevitable breaks in the smooth shading at cone tips
// note the resulting mesh will be created as an asset in Assets/Editor
@stephanmg
stephanmg / save_mesh_as_prefab.cs
Created September 18, 2020 07:07
Save mesh as prefab
GameObject cone = GameObject.Find("cone");
Mesh mesh = cone.GetComponent<MeshFilter>().sharedMesh;
AssetDatabase.CreateAsset(msh, assetpath);
PrefabUtility.SaveAsPrefabAsset(mesh, prefabpath);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
parpool(4)
parfor K = 1 : 4
if K == 1; compute_function_val(10); end
if K == 2; compute_function_val(20); end
if K == 3; compute_function_val(30); end
if K == 4; compute_function_val(40); end
end
function y=compute_function_val(m)
# Amici.py
def check_gradients(self, x: np.ndarray = None, *args, **kwargs):
if x is None and 'petab_problem' in dir(self.amici_object_builder):
x = self.amici_object_builder.petab_problem.x_nominal_scaled
x_free = self.amici_object_builder.petab_problem.x_free_indices
return ObjectiveBase.check_gradients(self, x=x, x_free=x_free, *args, **kwargs)
# Base.py
@stephanmg
stephanmg / optimize.py
Created August 4, 2021 14:19
script for optimization
def run_optimization(importer, optimizer, output_folder, yaml_file, algorithm_name, num_starts, parallel):
"""
Run the optimization
Parameters
----------
importer:
PEtab model importer
optimizer:
name of the optimizer
output_folder: