This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def prepare_for_amiga(outname, write = False, run_amiga=False) : | |
""" | |
Takes a RAMSES output and turns it into a 'tipsy' file for use with | |
tipsy, pkdgrav, or AHF | |
""" | |
import os | |
from pynbody.units import Unit | |
s = pynbody.load(outname) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Check whether the default compiler supports OpenMP. | |
This routine is adapted from yt, thanks to Nathan | |
Goldbaum. See https://github.com/pynbody/pynbody/issues/124""" | |
import tempfile | |
import os | |
import sysconfig | |
import subprocess | |
import shutil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:51674423333905e7630a6f70f9aed7a81e31205a98f3620d90a7374eb69f0931" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pynbody | |
part2birth = '/home/itp/roskar/ramses/galaxy_formation/part2birth' | |
@pynbody.ramses.RamsesSnap.derived_quantity | |
def tform(self) : | |
"""Generate a tform array that is compatible with pynbody unit system | |
and will allow one to get the ages of stars. | |
make sure the 'part2birth' above corresponds to the location of the executable on your machine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import marisa_trie | |
from sklearn.feature_extraction.text import CountVectorizer, _make_int_array | |
import numpy as np | |
import scipy.sparse as sp | |
from itertools import chain | |
class MarisaCountVectorizer(CountVectorizer): | |
""" | |
Extension of Scikit-learn CountVectorizer class using the | |
MARISA-trie python wrapper from https://github.com/kmike/marisa-trie |
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.
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.
OlderNewer