Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
NUNEZ Arturo
notebooks-wkbl
Commits
197cb5ec
Commit
197cb5ec
authored
Jun 20, 2018
by
NUNEZ Arturo
Browse files
Automatic commit mercredi 20 juin 2018, 16:30:01 (UTC+0200)
parent
0f3fe404
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
LAM2LUPM/VDF_comparison_Plot_HALOB.ipynb
View file @
197cb5ec
This diff is collapsed.
Click to expand it.
Simulations/.ipynb_checkpoints/Untitled1-checkpoint.ipynb
0 → 100644
View file @
197cb5ec
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 1
}
Simulations/Untitled1.ipynb
0 → 100644
View file @
197cb5ec
{
"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": [
"\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, nquad\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",
"import datetime\n",
"from pymodelfit import FunctionModel1DAuto\n",
"import wkbl\n",
"from wkbl.astro.halo_info import *\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\n",
"from matplotlib.ticker import FormatStrFormatter"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"evolution1 = evolution2 = evolution3 = np.array([]) "
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'HALOBHydro' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-1-885a0892541d>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mhalo\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mHALOBHydro\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mwhere\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"home\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0ma\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdatetime\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdatetime\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnow\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mmyhydro\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mwkbl\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mGalaxy_Hound\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhalo\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpath\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\"halo,stars\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mgas\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mFalse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mb\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdatetime\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdatetime\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnow\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mNameError\u001b[0m: name 'HALOBHydro' is not defined"
]
}
],
"source": [
"\n",
"halo = HALOBHydro(where=\"home\") \n",
"a = datetime.datetime.now()\n",
"myhydro = wkbl.Galaxy_Hound(halo.path,\"halo,stars\",gas=False)\n",
"b = datetime.datetime.now()\n",
"evolution1 = np.append(evolution1,(b-a).seconds)\n",
"print \"1st step took {0} s\".format((b-a).seconds)\n",
"myhydro.center_shift(halo.c_st_rho)\n",
"c = datetime.datetime.now()\n",
"evolution2 = np.append(evolution2,(c-b).seconds)\n",
"print \"2nd step took {0} s\".format((c-b).seconds)\n",
"myhydro.r_virial(600,n=25)\n",
"d = datetime.datetime.now()\n",
"evolution3 = np.append(evolution3,(d-c).seconds)\n",
"print \"3rd step took {0} s\".format((d-c).seconds)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"223"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"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
}
%% 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.interpolate
import
interp1d
from
matplotlib.patches
import
Circle
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
,
nquad
import
matplotlib.patches
as
patches
from
itertools
import
product
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
import
datetime
from
pymodelfit
import
FunctionModel1DAuto
import
wkbl
from
wkbl.astro.halo_info
import
*
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
from
matplotlib.colors
import
LogNorm
from
matplotlib.ticker
import
FormatStrFormatter
```
%% Cell type:code id: tags:
```
python
evolution1
=
evolution2
=
evolution3
=
np
.
array
([])
```
%% Cell type:code id: tags:
```
python
halo
=
HALOBHydro
(
where
=
"home"
)
a
=
datetime
.
datetime
.
now
()
myhydro
=
wkbl
.
Galaxy_Hound
(
halo
.
path
,
"halo,stars"
,
gas
=
False
)
b
=
datetime
.
datetime
.
now
()
evolution1
=
np
.
append
(
evolution1
,(
b
-
a
).
seconds
)
print
"1st step took {0} s"
.
format
((
b
-
a
).
seconds
)
myhydro
.
center_shift
(
halo
.
c_st_rho
)
c
=
datetime
.
datetime
.
now
()
evolution2
=
np
.
append
(
evolution2
,(
c
-
b
).
seconds
)
print
"2nd step took {0} s"
.
format
((
c
-
b
).
seconds
)
myhydro
.
r_virial
(
600
,
n
=
25
)
d
=
datetime
.
datetime
.
now
()
evolution3
=
np
.
append
(
evolution3
,(
d
-
c
).
seconds
)
print
"3rd step took {0} s"
.
format
((
d
-
c
).
seconds
)
```
%%%% Output: error
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-885a0892541d> in <module>()
1
----> 2 halo = HALOBHydro(where="home")
3 a = datetime.datetime.now()
4 myhydro = wkbl.Galaxy_Hound(halo.path,"halo,stars",gas=False)
5 b = datetime.datetime.now()
NameError: name 'HALOBHydro' is not defined
%% Cell type:code id: tags:
```
python
```
%% Cell type:code id: tags:
```
python
``
`
%%
Cell
type
:
code
id
:
tags
:
```
python
```
%%%% Output: execute_result
223
%% Cell type:code id: tags:
```
python
```
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment