Skip to content

Instantly share code, notes, and snippets.

import numpy as np
import pandas as pd
from pypesto.store import read_from_hdf5
import os
import matplotlib.pyplot as plt
from matplotlib import cm
from more_itertools import unique_everseen
from pathlib import Path
import argparse
from pypesto.visualize import optimizer_convergence
@stephanmg
stephanmg / gist:ab942c686736238f50d84ca84b14e37e
Last active September 20, 2021 10:16
.h5 file history file (dumped with h5dump)
DATASET "x_names" {
DATATYPE H5T_STRING {
STRSIZE H5T_VARIABLE;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_UTF8;
CTYPE H5T_C_S1;
}
DATASPACE SIMPLE { ( 71 ) / ( 71 ) }
DATA {
(0): "init_Cells", "init_Cells_Cycle_G2_rel",
@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:
# 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
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)
@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();
@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 / 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;
#!/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 / 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" }