Skip to content

Commit a32962e

Browse files
Merge pull request #323 from astro-informatics/update_notebooks
Update notebooks
2 parents 2eeccd7 + 1e49d03 commit a32962e

File tree

5 files changed

+275
-279
lines changed

5 files changed

+275
-279
lines changed

harmonic/utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -336,20 +336,20 @@ def cross_validation(
336336
)
337337
)
338338
hm.logs.debug_log(
339-
"cross_validation: evidence_inv = {}".format(ev.evidence_inv)
339+
"cross_validation: evidence_inv = {}".format(np.exp(ev.ln_evidence_inv))
340340
)
341341
hm.logs.debug_log(
342-
"cross_validation: evidence_inv_var = {}".format(ev.evidence_inv_var)
342+
"cross_validation: evidence_inv_var = {}".format(np.exp(ev.ln_evidence_inv_var))
343343
)
344344
hm.logs.debug_log(
345345
"cross_validation:"
346-
+ " evidence_inv_var**0.5/evidence_inv = {}".format(
347-
ev.evidence_inv_var**0.5 / ev.evidence_inv
346+
+ " ln evidence_inv_var**0.5/evidence_inv = {}".format(
347+
(ev.ln_evidence_inv_var*0.5) - ev.ln_evidence_inv
348348
)
349349
)
350350
hm.logs.debug_log(
351-
"cross_validation: evidence_inv_var_var = {}".format(
352-
ev.evidence_inv_var_var
351+
"cross_validation: ln_evidence_inv_var_var = {}".format(
352+
ev.ln_evidence_inv_var_var
353353
)
354354
)
355355

notebooks/basic_usage.ipynb

Lines changed: 26 additions & 28 deletions
Large diffs are not rendered by default.

notebooks/checkpointing.ipynb

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,21 @@
3939
},
4040
{
4141
"cell_type": "code",
42-
"execution_count": null,
42+
"execution_count": 1,
4343
"metadata": {
4444
"id": "XSCBJ_S4XvDe"
4545
},
4646
"outputs": [],
4747
"source": [
4848
"%%capture\n",
49-
"# Install packages\n",
50-
"%pip install harmonic emcee corner getdist"
49+
"if 'google.colab' in str(get_ipython()):\n",
50+
" # Install packages\n",
51+
" %pip install harmonic emcee corner getdist"
5152
]
5253
},
5354
{
5455
"cell_type": "code",
55-
"execution_count": 1,
56+
"execution_count": 2,
5657
"metadata": {
5758
"id": "1OtVkBf7OAIF"
5859
},
@@ -79,7 +80,7 @@
7980
},
8081
{
8182
"cell_type": "code",
82-
"execution_count": 2,
83+
"execution_count": 3,
8384
"metadata": {
8485
"id": "8PgO6f4VQSpD"
8586
},
@@ -130,7 +131,7 @@
130131
},
131132
{
132133
"cell_type": "code",
133-
"execution_count": 3,
134+
"execution_count": 4,
134135
"metadata": {
135136
"id": "xjsxOkX0QSzL"
136137
},
@@ -161,7 +162,7 @@
161162
},
162163
{
163164
"cell_type": "code",
164-
"execution_count": 4,
165+
"execution_count": 5,
165166
"metadata": {
166167
"id": "Ju_YJlk2QS7x"
167168
},
@@ -187,7 +188,7 @@
187188
},
188189
{
189190
"cell_type": "code",
190-
"execution_count": 5,
191+
"execution_count": 6,
191192
"metadata": {
192193
"id": "us1kBuWlQZTy"
193194
},
@@ -196,7 +197,7 @@
196197
"name": "stderr",
197198
"output_type": "stream",
198199
"text": [
199-
"Training NF: 100%|██████████| 4/4 [01:45<00:00, 26.27s/it]\n"
200+
"Training NF: 100%|██████████| 4/4 [01:09<00:00, 17.46s/it]\n"
200201
]
201202
}
202203
],
@@ -270,7 +271,7 @@
270271
},
271272
{
272273
"cell_type": "code",
273-
"execution_count": 6,
274+
"execution_count": 7,
274275
"metadata": {
275276
"id": "Eel3bSORQZW0"
276277
},
@@ -293,7 +294,7 @@
293294
},
294295
{
295296
"cell_type": "code",
296-
"execution_count": 7,
297+
"execution_count": 8,
297298
"metadata": {
298299
"id": "eSxxNW1KQZZc"
299300
},
@@ -328,7 +329,7 @@
328329
},
329330
{
330331
"cell_type": "code",
331-
"execution_count": 8,
332+
"execution_count": 9,
332333
"metadata": {
333334
"id": "efPNgW8qQZcW"
334335
},
@@ -348,7 +349,7 @@
348349
},
349350
{
350351
"cell_type": "code",
351-
"execution_count": 9,
352+
"execution_count": 10,
352353
"metadata": {
353354
"id": "WrB47hA3QZfM"
354355
},
@@ -357,9 +358,9 @@
357358
"name": "stdout",
358359
"output_type": "stream",
359360
"text": [
360-
"ln_evidence_err_neg = -0.0031277022888513755\n",
361-
"ln_evidence_err_pos = 0.0031179502607592245\n",
362-
"ln_evidence_err_avg = 0.0031228262748053\n"
361+
"ln_evidence_err_neg = -0.004000549204647541\n",
362+
"ln_evidence_err_pos = 0.003984608221799135\n",
363+
"ln_evidence_err_avg = 0.003992578946053982\n"
363364
]
364365
}
365366
],
@@ -373,7 +374,7 @@
373374
},
374375
{
375376
"cell_type": "code",
376-
"execution_count": 10,
377+
"execution_count": 11,
377378
"metadata": {
378379
"colab": {
379380
"base_uri": "https://localhost:8080/"
@@ -386,9 +387,9 @@
386387
"name": "stdout",
387388
"output_type": "stream",
388389
"text": [
389-
"ln_evidence (harmonic) = 9.186614990234375 (+ 0.0031179502607592245 / -0.0031277022888513755)\n",
390+
"ln_evidence (harmonic) = 9.188836097717285 (+ 0.003984608221799135 / -0.004000549204647541)\n",
390391
"ln_evidence (analytic) = 9.189385332046726\n",
391-
"nsigma = 0.887126458074755\n"
392+
"nsigma = 0.13756379945435523\n"
392393
]
393394
}
394395
],
@@ -418,7 +419,8 @@
418419
"toc_visible": true
419420
},
420421
"kernelspec": {
421-
"display_name": "Python 3",
422+
"display_name": "hm_140",
423+
"language": "python",
422424
"name": "python3"
423425
},
424426
"language_info": {
@@ -431,7 +433,7 @@
431433
"name": "python",
432434
"nbconvert_exporter": "python",
433435
"pygments_lexer": "ipython3",
434-
"version": "3.9.18"
436+
"version": "3.13.9"
435437
}
436438
},
437439
"nbformat": 4,

0 commit comments

Comments
 (0)