Commit 6cbb86cc authored by NUNEZ Arturo's avatar NUNEZ Arturo
Browse files

Automatic commit mercredi 7 février 2018, 16:30:01 (UTC+0100)

parent f0b943d4
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 1
}
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 1
}
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 1
}
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.
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"%load_ext autoreload\n",
"%autoreload 2\n"
]
},
{
"cell_type": "code",
"execution_count": 108,
"metadata": {
"collapsed": false
},
"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": 109,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"loading Dark matter..\n",
"loading Stars..\n",
"loading Gas..\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"
]
}
],
"source": [
"path = \"/data/OWN/paramstest/e01_t20/output_00041\"\n",
"#path = \"/media/arturo/ARTUROTECA/OUTPUTS/HaloB/output_00417\"\n",
"myhalo = wkbl.Galaxy_Hound(path)\n",
"myhalo.r_virial(600)\n"
]
},
{
"cell_type": "code",
"execution_count": 110,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"myhalo.redefine(1/13.5)"
]
},
{
"cell_type": "code",
"execution_count": 121,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"188777 37755\n",
"188777 37755\n"
]
}
],
"source": [
"print len(myhalo.gs.metal),len(myhalo.gs.metal)/5\n",
"print len(myhalo.gs.mass),len(myhalo.gs.mass)/5"
]
},
{
"cell_type": "code",
"execution_count": 119,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"my_st_condition = np.where(np.abs(myhalo.st.pos3d[:,2])<1.2)\n",
"myhalo.st.pos3d = myhalo.st.pos3d[my_st_condition]\n",
"myhalo.st.metal = myhalo.st.metal[my_st_condition]\n",
"myhalo.st.mass = myhalo.st.mass[my_st_condition]\n",
"myhalo.st.age = myhalo.st.age[my_st_condition]\n",
"\n",
"my_gs_condition = np.where(np.abs(myhalo.gs.pos3d[:,2])<1.2)\n",
"myhalo.gs.pos3d = myhalo.gs.pos3d[my_gs_condition]\n",
"myhalo.gs.hsml = myhalo.gs.hsml[my_gs_condition]\n",
"myhalo.gs.metal = myhalo.gs.metal[my_gs_condition]\n",
"myhalo.gs.mass = myhalo.gs.mass[my_gs_condition]\n"
]
},
{
"cell_type": "code",
"execution_count": 122,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"making file number 0.. \n"
]
}
],
"source": [
"slices = 1\n",
"part_slice = len(myhalo.st.mass)/slices\n",
"ini, end,filenum = 0,int(part_slice),0\n",
"for k in range(slices):\n",
" print \"making file number {0}.. \".format(k)\n",
" file1 = open('/home/arturo/Documents/git/SKIRTIMAGES/Mochima_stars'+str(filenum)+'.dat', 'w+')\n",
"\n",
" def el_printo(i):\n",
" file1.write(\"{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.0f} {5:.7f} {6:1.6e}\\n\".format(myhalo.st.pos3d[i,0]*1e3,\n",
" myhalo.st.pos3d[i,1]*1e3,\n",
" myhalo.st.pos3d[i,2]*1e3,\n",
" myhalo.p.simutokpc,\n",
" myhalo.st.mass[i],\n",
" myhalo.st.metal[i],\n",
" np.abs(myhalo.st.age[i])*1e9 ))\n",
" return 0\n",
" printo = np.vectorize(el_printo)\n",
"\n",
" #print header\n",
" file1.write('# SPH Star Particles\\n# Converted from a Ramses SIM output format into SKIRT6 format\\n# Columns contain: x(pc) y(pc) z(pc) h(pc) M(Msun) Z(0-1) t(yr)\\n')\n",
" index = range(ini,end)\n",
" printo(index)\n",
" os.system(\"sed -i '4d' /home/arturo/Documents/git/SKIRTIMAGES/Mochima_stars.dat\")\n",
" os.system(\"sed -i '$ d' /home/arturo/Documents/git/SKIRTIMAGES/Mochima_stars.dat\")\n",
" file1.close()\n",
" filenum += 1 \n",
" end += part_slice\n",
" ini = index[-1]"
]
},
{
"cell_type": "code",
"execution_count": 123,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"making file number 0.. \n"
]
}
],
"source": [
"slices = 1\n",
"part_slice = len(myhalo.gs.mass)/slices\n",
"ini, end,filenum = 0,int(part_slice),0\n",
"for k in range(slices):\n",
" print \"making file number {0}.. \".format(k)\n",
" file1 = open('/home/arturo/Documents/git/SKIRTIMAGES/Mochima_gas'+str(filenum)+'.dat', 'w+')\n",
"\n",
" def el_printo(i):\n",
" file1.write(\"{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.0f} {5:.7f}\\n\".format(myhalo.gs.pos3d[i,0]*1e3,\n",
" myhalo.gs.pos3d[i,1]*1e3,\n",
" myhalo.gs.pos3d[i,2]*1e3,\n",
" myhalo.gs.hsml[i]*1e3,\n",
" myhalo.gs.mass[i],\n",
" myhalo.gs.metal[i]))\n",
" return 0\n",
" \n",
" printo = np.vectorize(el_printo)\n",
"\n",
" #print header\n",
" file1.write('# SPH Gas \"Particles\"\\n# Converted from a Ramses SIM output format into SKIRT6 format\\n# Columns contain: x(pc) y(pc) z(pc) h(pc) M(Msun) Z(0-1)\\n')\n",
" index = range(ini,end)\n",
" printo(index)\n",
" os.system(\"sed -i '4d' /home/arturo/Documents/git/SKIRTIMAGES/Mochima_stars.dat\")\n",
" os.system(\"sed -i '$ d' /home/arturo/Documents/git/SKIRTIMAGES/Mochima_stars.dat\")\n",
" file1.close()\n",
" filenum += 1 \n",
" end += part_slice\n",
" ini = index[-1]"
]
},
{
"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
}
{
"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": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import wkbl.astro.nbody_essentials as nbe\n"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"5615209.0 5155214.0 459995.0\n"
]
},
{
"data": {
"text/plain": [
"(5615209, 5155214, 459995)"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nbe.check_particles('/home/arturo/Documents/output')\n"
]
},
{
"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
}
This diff is collapsed.
......@@ -41,42 +41,24 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"loading Dark matter..\n",
"loading Stars..\n",
"loading Gas..\n"
]
}
],
"outputs": [],
"source": [
"path = \"/data/POL/HALOB/output_00417\"\n",
"path = \"/data/POL/HALOB/hydro/output_00417\"\n",
"#path = \"/media/arturo/ARTUROTECA/OUTPUTS/HaloB/output_00417\"\n",
"myhalo = wkbl.Galaxy_Hound(path,\"halo,gas,stars\",getcen=False)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"density [ 9685.31347656 9883.21972656 9817.79785156]\n"
]
}
],
"outputs": [],
"source": [
"ok,rho,_= CF.getDensity(np.array(myhalo.st.pos3d.reshape(len(myhalo.st.pos3d)*3),dtype=np.float32), myhalo.st.mass)\n",
"centro_rho = myhalo.st.pos3d[np.where(rho == rho.max())][0]\n",
......
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