Commit e6192979 authored by NUNEZ Arturo's avatar NUNEZ Arturo
Browse files

Automatic commit dimanche 10 décembre 2017, 16:30:01 (UTC+0100)

parent 6c9c26a6
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"%load_ext autoreload\n",
"%autoreload 2"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"\n",
"from scipy.stats import rv_continuous\n",
"from scipy.interpolate import interp1d\n",
"from matplotlib.patches import Circle\n",
"from scipy.special import gamma\n",
"import numpy as np\n",
"import emcee\n",
"from mpl_toolkits.axes_grid1 import make_axes_locatable\n",
"from numpy import exp, sqrt\n",
"from scipy.integrate import quad, dblquad\n",
"import matplotlib.patches as patches\n",
"from itertools import product\n",
"from scipy.integrate import quad\n",
"import scipy.optimize as optimize\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib as mpl\n",
"from sklearn.neighbors import KDTree\n",
"import sys\n",
"import lmfit\n",
"from py_unsio import *\n",
"import pymc\n",
"import os\n",
"from pymodelfit import FunctionModel1DAuto\n",
"import wkbl\n",
"from mpl_toolkits.mplot3d import axes3d\n",
"from matplotlib import cm\n",
"import wkbl.astro.nbody_essentials as nbe\n",
"import cfalcon\n",
"CF =cfalcon.CFalcon()\n",
"import iminuit\n",
"from iminuit import Minuit, describe, Struct\n",
"import probfit\n",
"from matplotlib.colors import LogNorm"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"loading Dark matter..\n",
"loading Stars..\n",
"loading Gas..\n",
"loaded\n",
"| r_200 = 231.4453125\n",
"---- taking particles inside 2.5 * r200\n",
"| number of praticles inside 2.5 * r200 \n",
"| dm mass = 1.442e+12 M_sun\n",
"| p_dm_200 = 9.289e+05 particles\n",
"| stellar mass = 1.318e+11 M_sun\n",
"| p_st_200 = 4.688e+06 psrticles\n",
"| gas mass = 1.412e+11 M_sun\n",
"| p_gs_200 = 2.091e+06 particles\n",
"---- rotating galaxy \n",
"| Diagonal matrix computed \n",
"| |22, 0, 0|\n",
"| D =| 0,19, 0|\n",
"| | 0, 0, 1|\n",
"cutted\n"
]
}
],
"source": [
"path = \"/data/OWN/paramstest/e01_t20/output_00041\"\n",
"\n",
"\n",
"myhalo= wkbl.Galaxy_Hound(path)\n",
"print \"loaded\"\n",
"myhalo.r_virial(600)\n",
"print \"cutted\"\n",
"nucenter = nbe.real_center(myhalo.dm.pos3d, myhalo.dm.mass)\n",
"myhalo.center_shift(nucenter)\n",
"myhalo.redefine(4.5)"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"array([ 2.04015805e-06, 2.09017321e-06, 2.02778347e-06, ...,\n",
" 1.21929834e-05, 1.27527665e-05, 1.27030316e-05], dtype=float32)"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"myhalo.gs.temp"
]
},
{
"cell_type": "code",
"execution_count": 61,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"g = myhalo.gs.temp[myhalo.gs.r<myhalo.r200]*myhalo.p.simutokms*1e5#*1.66e-24 / 1.3806200e-16"
]
},
{
"cell_type": "code",
"execution_count": 68,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"st_K = np.sum(0.5* myhalo.st.mass[myhalo.st.r<myhalo.r200] * (myhalo.st.v[myhalo.st.r<myhalo.r200]**2 ))\n",
"dm_K = np.sum(0.5* myhalo.dm.mass[myhalo.dm.r<myhalo.r200] * (myhalo.dm.v[myhalo.dm.r<myhalo.r200]**2 ))\n",
"pot = myhalo.gs.pot[myhalo.gs.r<myhalo.r200]*myhalo.p.simutoMsun / myhalo.p.simutokpc\n",
"P = np.sum(3.6e-3*pot*myhalo.gs.mass[myhalo.gs.r<myhalo.r200])\n",
"K = dm_K+ st_K+ np.sum(g*myhalo.gs.mass[myhalo.gs.r<myhalo.r200])"
]
},
{
"cell_type": "code",
"execution_count": 69,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"4.14966e+16 9.47442e+15 1.45455e+16\n"
]
}
],
"source": [
"print dm_K, st_K, np.sum(g*myhalo.gs.mass[myhalo.gs.r<myhalo.r200])"
]
},
{
"cell_type": "code",
"execution_count": 70,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"-3.966e+17 6.55165e+16 0.669608832484\n"
]
}
],
"source": [
"print P,K,2*K/P+1"
]
},
{
"cell_type": "code",
"execution_count": 50,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"-4.32e+17\n"
]
}
],
"source": [
"#print np.sum(myhalo.gs.pot*myhalo.gs.mass)\n",
"pot = myhalo.gs.pot*myhalo.p.simutoMsun / myhalo.p.simutokpc\n",
"print np.sum(3.6e-3*pot*myhalo.gs.mass)"
]
},
{
"cell_type": "code",
"execution_count": 51,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"\n",
"K = dm_K+ st_K+ np.sum(g*myhalo.gs.mass)\n",
"P = np.sum(3.6e-3*pot*myhalo.gs.mass)"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"4.53957577032e-39\n"
]
}
],
"source": [
"print myhalo.p.G"
]
},
{
"cell_type": "code",
"execution_count": 77,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"g = myhalo.gs.temp[myhalo.gs.r<myhalo.r200]*myhalo.p.simutokms*1e5*1.66e-24 / 1.3806200e-16"
]
},
{
"cell_type": "code",
"execution_count": 78,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"4.0082909e-07"
]
},
"execution_count": 78,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"g.min()"
]
},
{
"cell_type": "code",
"execution_count": 79,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"0.056334898"
]
},
"execution_count": 79,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"g.max()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.12"
},
"latex_envs": {
"bibliofile": "biblio.bib",
"cite_by": "apalike",
"current_citInitial": 1,
"eqLabelWithNumbers": true,
"eqNumInitial": 0
}
},
"nbformat": 4,
"nbformat_minor": 1
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment