Skip to content

Commit

Permalink
Created using Colaboratory
Browse files Browse the repository at this point in the history
  • Loading branch information
EiffL committed May 10, 2020
1 parent ea3ccf3 commit cad161d
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions notebooks/jax-cosmo-intro.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/DifferentiableUniverseInitiative/jax_cosmo/blob/number_counts/notebooks/jax-cosmo-intro.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
"<a href=\"https://colab.research.google.com/github/DifferentiableUniverseInitiative/jax_cosmo/blob/master/notebooks/jax-cosmo-intro.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
Expand All @@ -52,17 +52,17 @@
"metadata": {
"id": "yZWz-yxPcG6q",
"colab_type": "code",
"outputId": "0f00c4b5-e155-4b8c-a1df-7bc43b2a7339",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"outputId": "0f00c4b5-e155-4b8c-a1df-7bc43b2a7339"
}
},
"source": [
"# Installing jax-cosmo\n",
"!pip install --quiet git+https://github.com/DifferentiableUniverseInitiative/jax_cosmo.git@number_counts"
"!pip install --quiet git+https://github.com/DifferentiableUniverseInitiative/jax_cosmo.git"
],
"execution_count": 1,
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
Expand All @@ -78,19 +78,19 @@
"metadata": {
"id": "AZkSj6XNcFkE",
"colab_type": "code",
"outputId": "593af818-b7c1-4749-e96d-e7c8a4c0f435",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"outputId": "593af818-b7c1-4749-e96d-e7c8a4c0f435"
}
},
"source": [
"%pylab inline\n",
"import jax\n",
"import jax_cosmo as jc\n",
"import jax.numpy as np"
],
"execution_count": 2,
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
Expand All @@ -106,8 +106,8 @@
"metadata": {
"id": "8yvBIf1mm_h-",
"colab_type": "code",
"colab": {},
"cellView": "form"
"cellView": "form",
"colab": {}
},
"source": [
"#@title Defining some plotting functions [run me]\n",
Expand Down Expand Up @@ -157,11 +157,11 @@
"metadata": {
"id": "9ae0PcDzcFkQ",
"colab_type": "code",
"outputId": "0681cdf0-6bdc-4489-a129-2c6d49302b0d",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 442
},
"outputId": "0681cdf0-6bdc-4489-a129-2c6d49302b0d"
}
},
"source": [
"# Let's define a few redshift bins\n",
Expand All @@ -176,7 +176,7 @@
"plot(z, nz3(z))\n",
"plot(z, nz4(z))"
],
"execution_count": 70,
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
Expand Down Expand Up @@ -245,19 +245,19 @@
"metadata": {
"id": "QWedY8i6cFkw",
"colab_type": "code",
"outputId": "9c0dfe23-ba7e-49d4-c0cb-96fde28a18f1",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 173
},
"outputId": "9c0dfe23-ba7e-49d4-c0cb-96fde28a18f1"
}
},
"source": [
"ell = np.logspace(1,3)\n",
"\n",
"# Get some fake observed cls\n",
"cls = jc.angular_cl.angular_cl(cosmo, ell, probes) + jc.angular_cl.noise_cl(ell, probes)"
],
"execution_count": 74,
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
Expand All @@ -280,17 +280,17 @@
"metadata": {
"id": "-Xc458aidYL8",
"colab_type": "code",
"outputId": "d53adbe2-0f89-4024-e130-ea6fd875aa75",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 286
},
"outputId": "d53adbe2-0f89-4024-e130-ea6fd875aa75"
}
},
"source": [
"# This is for instance the first bin auto-spectrum \n",
"loglog(ell, cls[0])"
],
"execution_count": 81,
"execution_count": 0,
"outputs": [
{
"output_type": "execute_result",
Expand Down Expand Up @@ -379,17 +379,17 @@
"metadata": {
"id": "ipixcS11cFlB",
"colab_type": "code",
"outputId": "b12aaea3-7cba-4df7-e75f-8d7a4e314251",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 207
},
"outputId": "b12aaea3-7cba-4df7-e75f-8d7a4e314251"
}
},
"source": [
"print(grad_loglik(params))\n",
"%timeit grad_loglik(params).block_until_ready()"
],
"execution_count": 85,
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
Expand Down Expand Up @@ -446,17 +446,17 @@
"metadata": {
"id": "8hEptBHZig3S",
"colab_type": "code",
"outputId": "a22b6a09-a8ad-44b6-f930-a13c3f6e9859",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 190
},
"outputId": "a22b6a09-a8ad-44b6-f930-a13c3f6e9859"
}
},
"source": [
"H = hessian_loglik(params)\n",
"%timeit hess_loglik(params).block_until_ready()"
],
"execution_count": 88,
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
Expand Down Expand Up @@ -486,11 +486,11 @@
"metadata": {
"id": "pmTdQeeXk8qB",
"colab_type": "code",
"outputId": "11b5084a-781e-4c48-e0d5-3f8100060a1a",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 297
},
"outputId": "11b5084a-781e-4c48-e0d5-3f8100060a1a"
}
},
"source": [
"# Let's compute the Fisher matrix, i.e. the same thing but at the true cosmmology\n",
Expand All @@ -500,7 +500,7 @@
"xlabel('Omega_m')\n",
"ylabel('sigma8')"
],
"execution_count": 90,
"execution_count": 0,
"outputs": [
{
"output_type": "execute_result",
Expand Down

0 comments on commit cad161d

Please sign in to comment.