예제 #1
0
파일: test_reader.py 프로젝트: ethlau/caps
    def test_load_database_and_close(self, get_boxsize, mock_sqlite3):
        mock_sqlite3.return_value = sqlite3.connect(":memory:")
        get_boxsize.return_value = True

        sim = reader.Simulation("L500")

        self.assertTrue(sim is not None)
예제 #2
0
파일: test_reader.py 프로젝트: ethlau/caps
    def setUp(
        self,
        mock_get_boxsize,
        mock_load_database,
    ):

        mock_load_database.return_value = True
        self.sim = reader.Simulation("L500")
예제 #3
0
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties

from math import fabs
import numpy as np
import pandas as pd

import caps.io.reader as db
from caps.util import utilities as ut

import pydot

simulation = "L500_NR_0"

mt = db.Simulation(simulation + "", db_dir="/Users/Kaylea/Data/L500_NR_0")

clusters = mt.get_halo_ids(main_halos_only=True)
halos = mt.get_halo_properties(clusters, ["M_hc", "r_hc"], "1.0005")

for cluster in clusters:
    if cluster != 17:
        continue

    dot_object = pydot.Dot(graph_type='graph')
    dot_object.set_node_defaults(shape='circle', fontsize="14")
    dot_object.set_edge_defaults(arrowhead="diamond")

    print cluster
    z0_mass = halos[halos["id"] == cluster]["M_hc"]
    z0_radius = halos[halos["id"] == cluster]["r_hc"]
예제 #4
0
#!/usr/bin/env python

from caps.io import reader as db

simulation = "L500_NR_tracers"

mt = db.Simulation(simulation)

simdir, hcdir, profilesdir = mt.get_directories()

aexp_list = mt.get_halo_epochs()

for aexp in aexp_list:
    clusters = mt.get_halo_ids(aexp=aexp, main_halos_only=True)
    aexp_str = "%0.4f" % aexp
    output = open(simdir+"/"+hcdir+"/progenitors_a"+aexp_str+".dat","w")
    for cluster in clusters:
        print >>output, cluster
    output.close()

        
예제 #5
0
#!/usr/bin/env python

import caps.io.reader as db


print "Loading database and executing queries..."

sim = db.Simulation("L500_NR_0")

#print units
sim.print_units(["M_total_200c", "r500c"])

#prints all column names for all properties and profiles tables
sim.print_avail_properties()


#gets all epochs
aexp_list = sim.get_halo_epochs()

for aexp in aexp_list:
    aexp_str = "%0.4f" % aexp
    print aexp_str
    #gest ids for halo at given aexp
    clusters = sim.get_halo_ids(aexp_str, masscut=1e14)

    #gets properties for list of cluster ids and list of halo properties
    #global properties get returned in a numpy structure array so that you can cross section the data anyway you please
    property_list = ["M_total_200c", "r500c"]
    halos = sim.get_halo_properties(clusters, property_list, aexp_str)

    #get property for all halos or subset