Skip to content

Commit

Permalink
Update example notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
aymgal committed Nov 16, 2023
1 parent 9556e40 commit 8b6ddd6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
24 changes: 14 additions & 10 deletions docs/notebooks/02-generate_template.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"\n",
"__author__: @aymgal\n",
"\n",
"__last update__: 11/07/23"
"__last update__: 16/07/23"
]
},
{
Expand Down Expand Up @@ -210,16 +210,20 @@
"name": "stdout",
"output_type": "stream",
"text": [
"[<coolest.template.classes.mass_field.MassField object at 0x1304da520>,\n",
" <coolest.template.classes.galaxy.Galaxy object at 0x1304daa60>,\n",
" <coolest.template.classes.galaxy.Galaxy object at 0x13048fd30>,\n",
" <coolest.template.classes.galaxy.Galaxy object at 0x1304f1220>,\n",
" <coolest.template.classes.galaxy.Galaxy object at 0x13051a8b0>]\n"
"Template file '/Users/aymgal/Science/packages/my_packages/coolest/docs/notebooks/template_dir/coolest_template_pyAPI.json' not found, now trying to read '/Users/aymgal/Science/packages/my_packages/coolest/docs/notebooks/template_dir/coolest_template.json'.\n",
"[<coolest.template.classes.mass_field.MassField object at 0x168be9880>,\n",
" <coolest.template.classes.galaxy.Galaxy object at 0x168dd4bb0>,\n",
" <coolest.template.classes.galaxy.Galaxy object at 0x10719a070>,\n",
" <coolest.template.classes.galaxy.Galaxy object at 0x168f351f0>,\n",
" <coolest.template.classes.galaxy.Galaxy object at 0x168f252e0>]\n"
]
}
],
"source": [
"coolest_2 = serializer.load()\n",
"coolest_2 = serializer.load(\n",
" skip_jsonpickle=True, # using skip_jsonpickle=True will ensure to read the pure JSON template\n",
" check_point_sources=False, # using check_point_sources=True will check self-consistency of point source light profiles (in this example we don't have any)\n",
")\n",
"\n",
"pprint(coolest_2.lensing_entities)"
]
Expand Down Expand Up @@ -319,7 +323,7 @@
"output_type": "stream",
"text": [
"All parameters with name 'q' that are not fixed:\n",
"[<coolest.template.classes.parameter.NonLinearParameter object at 0x1304f4940>, <coolest.template.classes.parameter.NonLinearParameter object at 0x13051a280>, <coolest.template.classes.parameter.NonLinearParameter object at 0x13048fee0>, <coolest.template.classes.parameter.NonLinearParameter object at 0x13051b5e0>]\n",
"[<coolest.template.classes.parameter.NonLinearParameter object at 0x107173670>, <coolest.template.classes.parameter.NonLinearParameter object at 0x168efa1c0>, <coolest.template.classes.parameter.NonLinearParameter object at 0x168f2a070>, <coolest.template.classes.parameter.NonLinearParameter object at 0x168dbe310>]\n",
"\n"
]
}
Expand Down Expand Up @@ -358,7 +362,7 @@
"# output to JSON\n",
"template_path_mock = os.path.join(os.getcwd(), TEMPLATE_DIR, TEMPLATE_NAME+\"_mock\")\n",
"serializer_mock = JSONSerializer(template_path_mock, obj=coolest_mock,\n",
" check_external_files=True)\n",
" check_external_files=True)\n",
"serializer_mock.dump_simple()"
]
},
Expand Down Expand Up @@ -387,7 +391,7 @@
"# output to JSON\n",
"template_path_doc = os.path.join(os.getcwd(), TEMPLATE_DIR, TEMPLATE_NAME+\"_doc\")\n",
"serializer_doc = JSONSerializer(template_path_doc, obj=coolest_doc,\n",
" check_external_files=True)\n",
" check_external_files=True)\n",
"serializer_doc.dump_simple()"
]
}
Expand Down
2 changes: 1 addition & 1 deletion docs/notebooks/template_dir/coolest_template_doc.json
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@
"meta": {},
"mode": "DOC",
"observation": {
"documentation": "Defines the observation itself, that is the image pixels, \n the exposure time, the noise model and/or properties, the magnitude \n zero-point and sky brightness.\n\n Parameters\n ----------\n pixels : PixelatedRegularGrid, optional\n Regular 2D Grid instance for the observed / mock data pixels, by default None\n noise : Noise, optional\n Instance of a Noise object associated with the modeling \n of the data pixels, by default None\n mag_zero_point : float, optional\n Zero-point magnitude, which corresponds to the 1 electron per second\n hitting the detecor (given in mag), by default None\n mag_sky_brightness : float, optional\n Magnitude due to sky brightness (given in mag per arcsec^2), \n by default None",
"documentation": "Defines the observation itself, that is the image pixels, \n the exposure time, the noise model and/or properties, the magnitude \n zero-point and sky brightness.\n\n Parameters\n ----------\n pixels : PixelatedRegularGrid, optional\n Regular 2D Grid instance for the observed / mock data pixels, by default None\n noise : Noise, optional\n Instance of a Noise object associated with the modeling \n of the data pixels, by default None\n mag_zero_point : float, optional\n Zero-point magnitude, which corresponds to the 1 electron per second\n hitting the detector (given in mag), by default None\n mag_sky_brightness : float, optional\n Magnitude due to sky brightness (given in mag per arcsec^2), \n by default None",
"exposure_time": null,
"mag_sky_brightness": null,
"mag_zero_point": null,
Expand Down
2 changes: 1 addition & 1 deletion docs/notebooks/template_dir/coolest_template_pyAPI.json
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@
"with_target_shot_noise": true,
"documentation": "Noise properties are computed directly based on the observed \n or modeled flux, and on the Instrument (e.g., readout noise) and \n Observation (e.g., exposure time, sky brightness, etc.) properties.\n\n Parameters\n ----------\n with_readout_noise : bool, optional\n If True, the noise includes readout noise from the detector, by default True\n with_sky_shot_noise : bool, optional\n If True, the noise includes shot noise from sky background flux \n (as the Gaussian approximation of the Poisson noise), by default True\n with_target_shot_noise : bool, optional\n If True, the noise includes shot noise from the target flux \n (as the Gaussian approximation of the Poisson noise), by default True"
},
"documentation": "Defines the observation itself, that is the image pixels, \n the exposure time, the noise model and/or properties, the magnitude \n zero-point and sky brightness.\n\n Parameters\n ----------\n pixels : PixelatedRegularGrid, optional\n Regular 2D Grid instance for the observed / mock data pixels, by default None\n noise : Noise, optional\n Instance of a Noise object associated with the modeling \n of the data pixels, by default None\n mag_zero_point : float, optional\n Zero-point magnitude, which corresponds to the 1 electron per second\n hitting the detecor (given in mag), by default None\n mag_sky_brightness : float, optional\n Magnitude due to sky brightness (given in mag per arcsec^2), \n by default None"
"documentation": "Defines the observation itself, that is the image pixels, \n the exposure time, the noise model and/or properties, the magnitude \n zero-point and sky brightness.\n\n Parameters\n ----------\n pixels : PixelatedRegularGrid, optional\n Regular 2D Grid instance for the observed / mock data pixels, by default None\n noise : Noise, optional\n Instance of a Noise object associated with the modeling \n of the data pixels, by default None\n mag_zero_point : float, optional\n Zero-point magnitude, which corresponds to the 1 electron per second\n hitting the detector (given in mag), by default None\n mag_sky_brightness : float, optional\n Magnitude due to sky brightness (given in mag per arcsec^2), \n by default None"
},
"instrument": {
"py/object": "coolest.template.classes.instrument.Instrument",
Expand Down
Binary file modified docs/notebooks/template_dir/obs.fits
Binary file not shown.

0 comments on commit 8b6ddd6

Please sign in to comment.