You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/notebooks/sampling_positions.ipynb
+62-9Lines changed: 62 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,16 @@
6
6
"source": [
7
7
"# Sampling (RA, dec)\n",
8
8
"\n",
9
-
"LightCurveLynx provides multiple mechanisms for sampling (RA, dec) from choosing points uniformly on a sphere to using the footprint of a given survey. In this notebook we discuss several of the approaches and their relative tradeoffs.\n",
9
+
"Sampling the position (RA, dec) of an object on the sky is a critical for in survey-based simulation. LightCurveLynx matches the sampled positions (RA, dec) with the survey information (`ObsTable`) to determine when each object is observed. Points from the object's light curve are *only* generated at those times where the object is observed. For example if an object is at (45.0, -10.0) and the survey includes this points at MJDs 60676.0 and 60678.0, the generated light curve will only have two fluxes. More importantly, if the sampled position falls outside the survey's footprint the returned light curve will be empty (the object is never observed). Therefore it is critical to choose a reasonable sampling scheme.\n",
10
10
"\n",
11
-
"LightCurveLynx matches the sampled positions (RA, dec) with the survey information (`ObsTable`) to determine when each object is observed. Points from the object's light curve are *only* generated at those times where the object is observed. For example if an object is at (45.0, -10.0) and the survey includes this points at MJDs 60676.0 and 60678.0, the generated light curve will only have two fluxes. More importantly, if the sampled position falls outside the survey's footprint the returned light curve will be empty (the object is never observed). Therefor it is critical to choose a reasonable sampling scheme.\n",
11
+
"LightCurveLynx provides multiple mechanisms for sampling object positions, including:\n",
12
12
"\n",
13
-
"For almost all cases we recommend the `ApproximateMOCSampler` for generating positions that correspond to the underlying survey."
13
+
" * Complete uniform over a sphere (`UniformRADEC`)\n",
14
+
" * Sampling from a survey (`ObsTableRADECSampler`, `ObsTableUniformRADECSampler`\n",
15
+
", and `ApproximateMOCSampler`)\n",
16
+
" * Sampling from a catalog (`CatalogRADECSampler`)\n",
17
+
"\n",
18
+
"The choice of sampler will depend heavily on the science use case."
"However this approach has limited use when simulating a specific survey. Depending on the survey's coverage, a significant number of (RA, dec) points may fall outside the viewing area. In those cases, the returned light curves will be empty, indicating that there were no observations of a given object.\n",
62
69
"\n",
63
-
"## Sampling from a Survey\n",
70
+
"## Sampling from a Survey's Footprint\n",
64
71
"\n",
65
72
"We can sample (RA, dec) coordinates from a survey (an `ObsTable` object) in two ways. First we could sample a pointing from the survey and then a point from that field of view. Second, we could sample uniformly from the region coverage by the survey.\n",
66
73
"\n",
67
-
"We consider each of these approaches below, but recommend the `ApproximateMOCSampler` for the majority of simulations that want to generate positions from a given footprint.\n",
74
+
"We consider each of these approaches below, but recommend the `ApproximateMOCSampler` for the majority of simulations that want to generate positions from a given footprint as it is most efficient over a range of scenarios.\n",
75
+
"\n",
76
+
"### Sampling Pointings (Visted Weighted)\n",
68
77
"\n",
69
-
"### Sampling Pointings\n",
78
+
"Sampling pointings from the survey provides a **visit-weighted** sampling of positions covered by the survey. The sampling works from a table of all the survey's pointings and randomly selecting a row for each sample.\n",
70
79
"\n",
71
-
"Sampling pointings from the survey provides a **visit-weighted** sampling of positions covered by the survey. For concreteness let's start with a survey that visits two fields: one centered at (45.0, -15.0) and the other at (315.0, 15.0). The first field is visited once and the second field is visited four times on four consecutive nights."
80
+
"For concreteness let's start with a survey that visits two fields: one centered at (45.0, -15.0) and the other at (315.0, 15.0). The first field is visited once and the second field is visited four times on four consecutive nights."
72
81
]
73
82
},
74
83
{
@@ -110,7 +119,10 @@
110
119
"cell_type": "markdown",
111
120
"metadata": {},
112
121
"source": [
113
-
"As we can see, the field centered in the Northern hemisphere is sampled significantly more than the one centered in the Southern hemisphere.\n",
122
+
"As we can see, the field centered in the Northern hemisphere is sampled significantly more than the one centered in the Southern hemisphere, because the survey visited that field more often.\n",
123
+
"\n",
124
+
"Users can limit the overlap with the `dedup_threshold` parameter, which removes near duplicate rows. But for non-visit-weighted sampling of a survey, we highly recommend using one of either `ObsTableUniformRADECSampler` or `ApproximateMOCSampler`.\n",
125
+
"\n",
114
126
"\n",
115
127
"### Sampling Survey Coverage\n",
116
128
"\n",
@@ -169,6 +181,9 @@
169
181
"source": [
170
182
"As you can see, many of the points land outside the 1 degree radius around the center of the pointing (10, 0).\n",
171
183
"\n",
184
+
"We recommend the `ObsTableUniformRADECSampler` **only** for cases where there is large survey coverage.\n",
185
+
"\n",
186
+
"\n",
172
187
"**ApproximateMOCSampler**\n",
173
188
"\n",
174
189
"The `ApproximateMOCSampler` samples from the area covered by a [Multi-Order Coverage Map (MOC)](https://www.ivoa.net/documents/MOC/20190215/WD-MOC-1.1-20190215.pdf), which is a collection of healpix pixels representing an area on the sky. Users can generate custom MOCs for hypothetical surveys, build a MOC from a survey, or use a helper function to create the sampler directly from the survey. **This is our recommended approach for sampling from a survey.**\n",
@@ -219,7 +234,7 @@
219
234
"cell_type": "markdown",
220
235
"metadata": {},
221
236
"source": [
222
-
"For example, if we use depth=8, the survey's coverage is approximated by a grid of only 786,432 pixels over the entire sky with (an average pixel width of around 14 arc minutes). We recommend at least a depth of 12 (average pixel width around 50 arc seconds) for reasonable accuracy.\n",
237
+
"For example, if we use `depth=8`, the survey's coverage is approximated by a grid of only 786,432 pixels over the entire sky with (an average pixel width of around 14 arc minutes). We recommend at least a depth of 12 (average pixel width around 50 arc seconds) for reasonable accuracy.\n",
223
238
"\n",
224
239
"As a concrete example, let's look at what happens if we prebuild the MOC at depth=4 (very coarse). Although the sampler uses a depth of 14, it cannot extract any more resolution from the input than it was given (a depth=4 MOC)."
225
240
]
@@ -275,6 +290,44 @@
275
290
"moc_sampler.plot_footprint()"
276
291
]
277
292
},
293
+
{
294
+
"cell_type": "markdown",
295
+
"metadata": {},
296
+
"source": [
297
+
"## Sampling from a Catalog\n",
298
+
"\n",
299
+
"We can use the `CatalogRADECSampler` node to sample from a catalog of known objects. This class is a thin connivence wrapper on the `ObsTableRADECSampler` that samples only ra and dec and defaults to a zero radius (exact sampling of observations). It provides a `dedup_threshold` parameter for removing near duplicates."
"We can use the `CatalogRADECSampler` (as well as the `ObsTableRADECSampler`) includes a `from_hats()` function that allows users to directly load a catalog from the [HATS format](https://www.ivoa.net/documents/Notes/HATS/)."
0 commit comments