Skip to content

Commit

Permalink
issue/627/testskypixelcoords: New notebook to test coordinate system …
Browse files Browse the repository at this point in the history
…effects with instructions to use example data (#629)

* feat: Add coordinate_system parameter to compute_tangential_and_cross_components and _compute_lensing_angles functions

* Update documentation to account for new coordinate_system option

* feat: Add coordinate_system conversion test to test_compute_lensing_angles_flatsky function

* Add coordinate_system conversion test to test_compute_lensing_angles_astropy function and fix bug in coordinate system conversion bug in compute_lensing_angles_astropy

* Set coordinate_system option during creation of GalaxyCluster object

* adding a new notebook and data

* test

* new notebook to test coordinate systems and shear measurements

* Removed debuggin print in test_dataops.py

* editing README for the data availability

* moved tomomi's notebook to examples

* added prelude to Tomomi's notebook

* Fixed typo and set default coordinate_system to "pixel"

* Added option to choose coordinate system for generated mock catalog

* Added ellipticity coordinate system conversion tests to test_galaxycluster.py and test_mockdata.py

* Added documentation to other test cases in Tomomi's notebook.  Still need to incorporate Caio's added functionality for sky vs. pixel coordinates in CLMM

* Fixed formatting

* starting to work through and document example of lensing signal calculation of HSCY3 cluster without CLMM, but need to change colossus dependency because it is not easy to install on NERSC

* Finished baseline documentation, including changing colossus cosmology dependency in notebook to the astropy one so this is easier to run on NERSC

* minor change to clarify sections of notebook

* added kwargs to GalaxyCluster instance definition in preparation for re-installing latest CLMM with Caio's added coordinate_system kwargs

* Updated logic for lensing angle conversion between coordinate systems in _compute_lensing_angles_flatsky and updated tests

* Revert "Updated logic for lensing angle conversion between coordinate systems in _compute_lensing_angles_flatsky and updated tests"

This reverts commit 4a1faa6.

* Added coordinate_system validation and extra tests

* Changed example notebook to document new coordinate_system option

* examples/test_coordinate.ipynb has additional minor markdown detail

* test_coordinate.ipynb now runs from top to bottom using Caio's coordinate system implementation!

* adding additional docstrings to Tomomi's from-scratch calculation of lensing from HSC data

* refactoring code into functions to make loop over cluster lenses  more readable and some renaming of variables, e.g. sum to profile_sum, to avoid name space problems

* made additional refactoring changes, but refactored functions to calculate angles between source and lens, etc. likely broke something in the background selection (now empty)

* some of the refactoring incorporated with pre-broken code

* cleaned up the loop over rbins

* In line comments for portions of calculation

* modified reverted commit to when the functions did not break, added in documentation and light refactoring from latest commit

* renamed the notebook for consistency

* docs/doc-config.ini now includes the demo_coordinate_system notebook

* feat: Add coordinate_system parameter to compute_tangential_and_cross_components and _compute_lensing_angles functions (#624)

* feat: Add coordinate_system parameter to compute_tangential_and_cross_components and _compute_lensing_angles functions

* Update documentation to account for new coordinate_system option

* feat: Add coordinate_system conversion test to test_compute_lensing_angles_flatsky function

* Add coordinate_system conversion test to test_compute_lensing_angles_astropy function and fix bug in coordinate system conversion bug in compute_lensing_angles_astropy

* Set coordinate_system option during creation of GalaxyCluster object

* Removed debuggin print in test_dataops.py

* Fixed typo and set default coordinate_system to "pixel"

* Added option to choose coordinate system for generated mock catalog

* Added ellipticity coordinate system conversion tests to test_galaxycluster.py and test_mockdata.py

* Fixed formatting

* Updated logic for lensing angle conversion between coordinate systems in _compute_lensing_angles_flatsky and updated tests

* Revert "Updated logic for lensing angle conversion between coordinate systems in _compute_lensing_angles_flatsky and updated tests"

This reverts commit 4a1faa6.

* Added coordinate_system validation and extra tests

* Changed example notebook to document new coordinate_system option

* Fixed all the documentation for coordinate_system and changed names from 'pixel'/'sky' to 'euclidean'/'celestial'

* Added reference for defitions of coordinate systems

* Fixed bug in coordinate system conversion in mock data generation

* Test ValueError raise for coordinate_system in test_mockdata.py

* Added more explanations about ellipticity coordinate system

* Fixed typo

* uodated tag to 1.12.4

---------

Co-authored-by: Marina Ricci <[email protected]>

* removed a character in a markdown cell that tests complained about in making docs

* swapped pixel/euclidean and sky/celestial in notebook

* reverted two files to try to match main

* removed outputs in the notebook

* removed OTHER notebook outputs

* remove empty cells in notebooks

* made minor edits in response to review, primarily with generalizing file paths and removing comments or redundant text in the markdown

* incorporating original demo_mock_cluster.ipynb from main to remove changes to the file in this branch that should not have been committed

* modified the Oguri example to also show incorrect coordinate assumption as noted by Caio

* got rid of dollar signs inside markdown code snippet env hoping this will get the checks passed

* added review contributions line :-)

* added a note for the CosmoDC2 clusters so the user is aware to not necessarily expect a strong signal in center regions

* removed extra cell at end

* removed rogue savefig

* clarified why there might be less signal in the TXPipe outputted CosmoDC2 thing

* Formatted demo_coordinate_system_datasets.ipynb notebook

---------

Co-authored-by: Caio Lima de Oliveira <[email protected]>
Co-authored-by: Camille Avestruz <[email protected]>
Co-authored-by: Marina Ricci <[email protected]>
  • Loading branch information
4 people authored Jul 19, 2024
1 parent 9e26686 commit 2d5aa5b
Show file tree
Hide file tree
Showing 16 changed files with 1,044 additions and 158 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# CLMM
[![Build and Check](https://github.com/LSSTDESC/CLMM/workflows/Build%20and%20Check/badge.svg)](https://github.com/LSSTDESC/CLMM/actions?query=workflow%3A%22Build+and+Check%22)
[![Coverage Status](https://coveralls.io/repos/github/LSSTDESC/CLMM/badge.svg?branch=main)](https://coveralls.io/github/LSSTDESC/CLMM?branch=main)
Expand Down Expand Up @@ -110,6 +109,7 @@ the `CCL` publication be cited. See details
The `Cluster Toolkit` documentation can be found
[here](https://cluster-toolkit.readthedocs.io/en/latest/#).

The data for the notebook test_coordinate.ipynb is available at https://www.dropbox.com/scl/fo/dwsccslr5iwb7lnkf8jvx/AJkjgFeemUEHpHaZaHHqpAg?rlkey=efbtsr15mdrs3y6xsm7l48o0r&st=xb58ap0g&dl=0

# Contributing to CLMM <a name="contributing"></a>

Expand Down
1 change: 1 addition & 0 deletions docs/doc-config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ OTHER
../examples/demo_compute_deltasigma_weights.ipynb
../examples/demo_mass_conversion.ipynb
../examples/demo_mock_ensemble_realistic.ipynb
../examples/demo_coordinate_system_datasets.ipynb
#../examples/other_compare_NFW_critical_massdef.ipynb
#../examples/other_flat_sky_limitations.ipynb
4 changes: 2 additions & 2 deletions examples/DC2/DC2_gt_profiles.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -614,7 +614,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.1"
"version": "3.9.0"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion examples/DC2/data_and_model_demo_DC2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.1"
"version": "3.6.9"
}
},
"nbformat": 4,
Expand Down
34 changes: 2 additions & 32 deletions examples/demo_boost_factors.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"cells": [
{
"cell_type": "markdown",
"id": "b803f8e6",
"metadata": {},
"source": [
"# Boost factors"
Expand All @@ -11,7 +10,6 @@
{
"cell_type": "code",
"execution_count": null,
"id": "7180b199",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -26,7 +24,6 @@
},
{
"cell_type": "markdown",
"id": "11e76008",
"metadata": {},
"source": [
"Make sure we know which version we're using"
Expand All @@ -35,7 +32,6 @@
{
"cell_type": "code",
"execution_count": null,
"id": "389d5ab7",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -44,7 +40,6 @@
},
{
"cell_type": "markdown",
"id": "d86fa53c",
"metadata": {},
"source": [
"### Define cosmology object"
Expand All @@ -53,7 +48,6 @@
{
"cell_type": "code",
"execution_count": null,
"id": "74bcb35c",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -62,15 +56,13 @@
},
{
"cell_type": "markdown",
"id": "6b458081",
"metadata": {},
"source": [
"First, we want to generate a $\\Delta\\Sigma$ (excess surface density) profile from mock data, to which we can apply boost factors. The mock data is generated in the following cells."
]
},
{
"cell_type": "markdown",
"id": "de5340ee",
"metadata": {},
"source": [
"Generate cluster object from mock data"
Expand All @@ -79,7 +71,6 @@
{
"cell_type": "code",
"execution_count": null,
"id": "6cec7b64",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -107,7 +98,6 @@
},
{
"cell_type": "markdown",
"id": "50045a1f",
"metadata": {},
"source": [
"Loading this into a CLMM cluster object centered on (0,0)"
Expand All @@ -116,7 +106,6 @@
{
"cell_type": "code",
"execution_count": null,
"id": "a564b1c9",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -127,7 +116,6 @@
},
{
"cell_type": "markdown",
"id": "eb9c2218",
"metadata": {},
"source": [
"Compute cross and tangential excess surface density for each source galaxy"
Expand All @@ -136,7 +124,6 @@
{
"cell_type": "code",
"execution_count": null,
"id": "bc5b051d",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -154,7 +141,6 @@
},
{
"cell_type": "markdown",
"id": "26081451",
"metadata": {},
"source": [
"Calculate the binned profile"
Expand All @@ -163,7 +149,6 @@
{
"cell_type": "code",
"execution_count": null,
"id": "eaadac01",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -190,7 +175,6 @@
},
{
"cell_type": "markdown",
"id": "7e88afc4",
"metadata": {},
"source": [
"Plot the $\\Delta\\Sigma$ profile"
Expand All @@ -199,7 +183,6 @@
{
"cell_type": "code",
"execution_count": null,
"id": "0aeb2f52",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -219,15 +202,13 @@
},
{
"cell_type": "markdown",
"id": "e28ec4c5",
"metadata": {},
"source": [
"## Boost Factors"
]
},
{
"cell_type": "markdown",
"id": "19912d42",
"metadata": {},
"source": [
"CLMM offers two boost models, the NFW boost model, and a powerlaw boost model. \n",
Expand All @@ -242,7 +223,6 @@
{
"cell_type": "code",
"execution_count": null,
"id": "e6b6ee3d",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -255,7 +235,6 @@
},
{
"cell_type": "markdown",
"id": "58cbc299",
"metadata": {},
"source": [
"Plot the two boost factors, $B(R)$"
Expand All @@ -264,7 +243,6 @@
{
"cell_type": "code",
"execution_count": null,
"id": "1c1de291",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -278,7 +256,6 @@
},
{
"cell_type": "markdown",
"id": "30e8e6a0",
"metadata": {},
"source": [
"The $\\Delta\\Sigma$ profiles can be corrected with the boost factor using `correct_sigma_with_boost_values` or `correct_sigma_with_boost_model`. \n",
Expand All @@ -289,7 +266,6 @@
},
{
"cell_type": "markdown",
"id": "6c4daf84",
"metadata": {},
"source": [
"\n",
Expand All @@ -309,7 +285,6 @@
},
{
"cell_type": "markdown",
"id": "48e0f2ef",
"metadata": {},
"source": [
"First we will apply the boost factor with `correct_sigma_with_boost_values`"
Expand All @@ -318,7 +293,6 @@
{
"cell_type": "code",
"execution_count": null,
"id": "d7b5f71d",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -332,7 +306,6 @@
},
{
"cell_type": "markdown",
"id": "15252880",
"metadata": {},
"source": [
"Plot the result"
Expand All @@ -341,7 +314,6 @@
{
"cell_type": "code",
"execution_count": null,
"id": "e2d90e0c",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -380,7 +352,6 @@
},
{
"cell_type": "markdown",
"id": "caf00c95",
"metadata": {},
"source": [
"Now the same again but with `correct_sigma_with_boost_model`"
Expand All @@ -389,7 +360,6 @@
{
"cell_type": "code",
"execution_count": null,
"id": "b4b3f953",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -440,7 +410,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -454,7 +424,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.8"
"version": "3.6.9"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 2d5aa5b

Please sign in to comment.