Commit 73667f60 authored by NUNEZ Arturo's avatar NUNEZ Arturo
Browse files

Automatic commit mardi 30 janvier 2018, 16:30:01 (UTC+0100)

parent 28d529c4
This diff is collapsed.
This diff is collapsed.
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 1
}
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 1
}
This diff is collapsed.
%% Cell type:code id: tags:
``` python
%matplotlib notebook
%load_ext autoreload
%autoreload 2
```
%% Cell type:code id: tags:
``` python
from scipy.stats import rv_continuous
from scipy.special import gamma
import numpy as np
import emcee
from mpl_toolkits.axes_grid1 import make_axes_locatable
from numpy import exp, sqrt
from scipy.integrate import quad, dblquad, simps
from scipy.stats import rv_continuous
from scipy.special import gamma
from scipy.interpolate import interp1d
from scipy.integrate import quad
import scipy.optimize as optimize
import matplotlib.pyplot as plt
import matplotlib as mpl
from sklearn.neighbors import KDTree
import sys
import lmfit
from py_unsio import *
import pymc
import os
from pymodelfit import FunctionModel1DAuto
import wkbl
from mpl_toolkits.mplot3d import axes3d
from matplotlib import cm
import wkbl.astro.nbody_essentials as nbe
import cfalcon
CF =cfalcon.CFalcon()
import iminuit
from iminuit import Minuit, describe, Struct
import probfit
import warnings
from matplotlib.colors import LogNorm
warnings.filterwarnings('ignore')
```
%% Cell type:code id: tags:
``` python
path = "/data/OWN/DMO/mochima2_Z5/output_00041"
#path = "/media/arturo/ARTUROTECA/OUTPUTS/HaloB/output_00417"
myDMO = wkbl.Galaxy_Hound(path)
print "centering"
zoom_reg = np.where(myDMO.dm.mass == myDMO.dm.mass.min())
nucenter = nbe.real_center(myDMO.dm.pos3d[zoom_reg], myDMO.dm.mass[zoom_reg])
myDMO.center_shift(nucenter)
myDMO.r_virial(600)
print "done r200 = {0}".format(myDMO.r200)
myDMO.redefine(1)
myGkm = 6.673e-11*(1e-3**3)*myDMO.p.msuntokg#km^ 3 Msun^-1 s^-2
```
%% Cell type:code id: tags:
``` python
ok,myDMO.dm.rho,_= CF.getDensity(np.array(myDMO.dm.pos3d.reshape(len(myDMO.dm.pos3d)*3),dtype=np.float32), myDMO.dm.mass)
```
%% Cell type:markdown id: tags:
# $2E_{kin}$
%% Cell type:code id: tags:
``` python
K = np.sum(myDMO.dm.mass*(myDMO.dm.v)**2)
print "2E_kin = {0:1.4e} m_sun kms² s⁻²".format(K)
```
%% Cell type:markdown id: tags:
# $E_{pot}$
%% Cell type:code id: tags:
``` python
r_sorted = np.argsort(myDMO.dm.r)
M_i = np.cumsum(myDMO.dm.mass[r_sorted]) - myDMO.dm.mass[r_sorted]
m_i = myDMO.dm.mass[r_sorted]
r_i = myDMO.dm.r[r_sorted]*(1e-2*myDMO.p.pctocm)# in km
U = np.sum(-myG*M_i*m_i/r_i)
fi = np.where(r_i<0.19)
print fi
print "first simplification from Shapiro2004\n E_pot = {0:1.4e} m_sun km² s⁻²".format(U)
```
%% Cell type:code id: tags:
``` python
print myGkpc
```
%% Cell type:code id: tags:
``` python
print myGkpc
```
%% Cell type:code id: tags:
``` python
myGkm = 6.673e-11*(1e-3**3)*myDMO.p.msuntokg#km^ 3 Msun^-1 s^-2
myGkpc = myGkm / myDMO.p.kpctokm**3 #kpc^ 3 Msun^-1 s^-2
```
%% Cell type:code id: tags:
``` python
pos = np.array(myDMO.dm.pos3d.reshape(len(myDMO.dm.pos3d)*3),dtype=np.float32)
ok, acc, Phy = CF.getGravity(pos,myDMO.dm.mass,0.090,G=myGkpc)
```
%% Cell type:code id: tags:
``` python
np.sum(Phy*myDMO.p.kpctokm**2)
```
%%%% Output: execute_result
-359909900000.0
%% Cell type:code id: tags:
``` python
np.sum(Phy)
```
%%%% Output: execute_result
-3.7791042e-22
%% Cell type:code id: tags:
``` python
myDMO.p.kpctokm
```
%%%% Output: execute_result
3.086e+16
%% Cell type:code id: tags:
``` python
```
%%%% Output: execute_result
3.08567758e+16
%% Cell type:code id: tags:
``` python
```
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