Skip to content

Commit fe307cb

Browse files
committed
docs + readme
1 parent 60afaa6 commit fe307cb

File tree

8 files changed

+86
-45
lines changed

8 files changed

+86
-45
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.DS_Store
22
temp/
33
.vscode/
4+
*.psd
45

56
# Byte-compiled / optimized / DLL files
67
__pycache__/

README.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,48 @@
11
# mphot
2-
A versatile Python package to model photometry for ground-based astronomy
2+
*mphot* is a fast Python package to model photometry data from the ground or space.
3+
4+
![example plots](examples/example-plots.png)
5+
6+
7+
## How it works
8+
9+
Simply put,
10+
- it combines user submitted [telescope * filter * camera qe] efficiencies with generic stellar models and sky transmission/radiance models (for Paranal, 2400m) to generate integrable grids of stellar fluxes and sky radiances.
11+
12+
- Then, *mphot* uses the grids to interpolate between different
13+
- atmospheric parameters (PWV, airmass)
14+
- target star parameters (effective temperature + distance)
15+
16+
- using user submitted
17+
- telescope/site parameters (primary and secondary diameters, site seeing)
18+
- camera parameters (plate scale, dark current, read noise, well depth, target well fill, read time)
19+
20+
- to calculate ideal exposure time and expected precision for a given observation.
21+
22+
Please see the [examples](https://github.com/ppp-one/mphot/tree/main/examples) for more details on how to use *mphot*. For further details on the models used, please see [https://doi.org/10.1117/12.3018320](https://doi.org/10.1117/12.3018320).
23+
24+
Note, it uses stellar parameters from "[A Modern Mean Dwarf Stellar Color and Effective Temperature Sequence](https://www.pas.rochester.edu/~emamajek/EEM_dwarf_UBVIJHK_colors_Teff.txt)". Temperatures between 1278 K to 3042 K are calibrated for the [SPECULOOS target list](https://doi.org/10.1051/0004-6361/202038827) and [2MASS](https://irsa.ipac.caltech.edu/Missions/2mass.html) (see Figure 4.7 in "[Optimised ground-based near-infrared instrumentation for robotic exoplanet transit surveys](https://doi.org/10.17863/CAM.96904)").
25+
26+
<!-- For further details, please see the [documentation](https://ppp-one.github.io/mphot/). -->
27+
28+
29+
## Installation
30+
31+
You can install *mphot* in a Python (`>=3.11`) environment with
32+
33+
```bash
34+
pip install mphot
35+
```
36+
37+
or from a local clone
38+
39+
```bash
40+
git clone https://github.com/ppp-one/mphot
41+
pip install -e mphot
42+
```
43+
44+
You can test the package has been properly installed with
45+
46+
```bash
47+
python -c "import mphot"
48+
```

docs/source/conf.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@
2828
"myst_parser",
2929
]
3030

31+
source_suffix = {
32+
".rst": "restructuredtext",
33+
".txt": "markdown",
34+
".md": "markdown",
35+
}
36+
3137
templates_path = ["_templates"]
3238
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
3339

docs/source/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
```{include} ../../README.md
2+
:relative-docs: ../../
3+
:relative-images:
4+
```
5+
6+
## Contents
7+
```{toctree} mphot
8+
```

docs/source/index.rst

Lines changed: 0 additions & 18 deletions
This file was deleted.

examples/Basic use.ipynb

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
},
3434
{
3535
"cell_type": "code",
36-
"execution_count": 41,
36+
"execution_count": 3,
3737
"id": "ba5f2fbd",
3838
"metadata": {},
3939
"outputs": [
@@ -43,7 +43,7 @@
4343
"<Axes: title={'center': 'speculoos_Andor_iKon-L-936_-60_I+z'}, xlabel='Wavelength (microns)', ylabel='System Response'>"
4444
]
4545
},
46-
"execution_count": 41,
46+
"execution_count": 3,
4747
"metadata": {},
4848
"output_type": "execute_result"
4949
},
@@ -64,7 +64,7 @@
6464
},
6565
{
6666
"cell_type": "code",
67-
"execution_count": 42,
67+
"execution_count": 4,
6868
"id": "0feee513-9586-40b8-81e3-d0a05723a2d0",
6969
"metadata": {},
7070
"outputs": [],
@@ -99,17 +99,10 @@
9999
},
100100
{
101101
"cell_type": "code",
102-
"execution_count": 43,
102+
"execution_count": 13,
103103
"id": "43ff22f5-b58d-44c4-ae15-2bcf5703ff07",
104104
"metadata": {},
105105
"outputs": [
106-
{
107-
"name": "stdout",
108-
"output_type": "stream",
109-
"text": [
110-
"Progress: [####################] 100.0%\n"
111-
]
112-
},
113106
{
114107
"data": {
115108
"text/html": [
@@ -244,7 +237,7 @@
244237
" <td>394</td>\n",
245238
" </tr>\n",
246239
" <tr>\n",
247-
" <th>npix</th>\n",
240+
" <th>pixels in aperture [pix]</th>\n",
248241
" <td>421</td>\n",
249242
" </tr>\n",
250243
" <tr>\n",
@@ -304,7 +297,7 @@
304297
" <td>6.40e+4</td>\n",
305298
" </tr>\n",
306299
" <tr>\n",
307-
" <th>well_fill</th>\n",
300+
" <th>peak well_fill</th>\n",
308301
" <td>0.700</td>\n",
309302
" </tr>\n",
310303
" <tr>\n",
@@ -316,7 +309,7 @@
316309
" <td>10.5</td>\n",
317310
" </tr>\n",
318311
" <tr>\n",
319-
" <th>nImages</th>\n",
312+
" <th>binned images</th>\n",
320313
" <td>7.84</td>\n",
321314
" </tr>\n",
322315
" </tbody>\n",
@@ -330,7 +323,7 @@
330323
"N_star [e/s] 1.16e+4\n",
331324
"star_flux [e/m2/s] 1.77e+4\n",
332325
"scn [e_rms] 394\n",
333-
"npix 421\n",
326+
"pixels in aperture [pix] 421\n",
334327
"ap_radius [pix] 11.6\n",
335328
"N_sky [e/pix/s] 13.5\n",
336329
"sky_radiance [e/m2/arcsec2/s] 152\n",
@@ -345,10 +338,10 @@
345338
"r1 [m] 0.140\n",
346339
"t [s] 66.1\n",
347340
"well_depth [e/pix] 6.40e+4\n",
348-
"well_fill 0.700\n",
341+
"peak well_fill 0.700\n",
349342
"binning [mins] 10.0\n",
350343
"read_time [s] 10.5\n",
351-
"nImages 7.84"
344+
"binned images 7.84"
352345
]
353346
},
354347
"metadata": {},

examples/example-plots.png

184 KB
Loading

src/mphot/core.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,7 @@ def get_precision(
662662
SPCcorrection: bool = True,
663663
N_sky: float | None = None,
664664
N_star: float | None = None,
665+
scn: float | None = None,
665666
exp_time: float | None = None,
666667
extended: bool = False,
667668
) -> dict:
@@ -711,6 +712,9 @@ def get_precision(
711712
N_star (float, optional):
712713
Number of star counts, calculated if None. Default is None.
713714
715+
scn (float, optional):
716+
Scintillation noise, calculated if None. Default is None.
717+
714718
exp_time (float, optional):
715719
Exposure time in seconds, calculated if None. Default is None.
716720
@@ -896,7 +900,8 @@ def get_precision(
896900

897901
npix = np.pi * ap**2
898902

899-
scn = scintillation_noise(r0, t, N_star, airmass)
903+
if scn is None:
904+
scn = scintillation_noise(r0, t, N_star, airmass)
900905

901906
precision = np.sqrt(
902907
N_star * t + scn**2 + npix * (N_sky * t + N_dc * t + N_rn**2)
@@ -1112,7 +1117,7 @@ def update_progress(progress: float | int) -> None:
11121117
print(text)
11131118

11141119

1115-
def to_precision(x: float, p: int = 3) -> str:
1120+
def display_number(x: float, p: int = 3) -> str:
11161121
"""
11171122
Convert a number to a string with the given precision.
11181123
@@ -1124,11 +1129,11 @@ def to_precision(x: float, p: int = 3) -> str:
11241129
str: The number represented as a string with the specified precision.
11251130
11261131
Examples:
1127-
>>> to_precision(123.456, 4)
1132+
>>> display_number(123.456, 4)
11281133
'123.5'
1129-
>>> to_precision(0.00123456, 2)
1134+
>>> display_number(0.00123456, 2)
11301135
'0.0012'
1131-
>>> to_precision(123456, 2)
1136+
>>> display_number(123456, 2)
11321137
'1.2e+05'
11331138
"""
11341139

@@ -1214,7 +1219,7 @@ def display_results(r1: tuple, r2: tuple = None) -> None:
12141219
This function displays the results using pandas DataFrames and does not return any value.
12151220
"""
12161221

1217-
pd.set_option("display.float_format", to_precision)
1222+
pd.set_option("display.float_format", display_number)
12181223

12191224
image_precision1, binned_precision1, components1 = r1
12201225

@@ -1301,11 +1306,11 @@ def display_results(r1: tuple, r2: tuple = None) -> None:
13011306

13021307
for k, v in components1.items():
13031308
if not isinstance(v, (str, bool)):
1304-
components1[k] = to_precision(v)
1309+
components1[k] = display_number(v)
13051310

13061311
for k, v in components2.items():
13071312
if not isinstance(v, (str, bool)):
1308-
components2[k] = to_precision(v)
1313+
components2[k] = display_number(v)
13091314

13101315
values = np.c_[list(components1.values()), list(components2.values())]
13111316
display(pd.DataFrame(values, index=components1.keys(), columns=columns))
@@ -1335,7 +1340,7 @@ def display_results(r1: tuple, r2: tuple = None) -> None:
13351340

13361341
for k, v in components1.items():
13371342
if (type(v) != str) and (type(v) != bool):
1338-
components1[k] = to_precision(v)
1343+
components1[k] = display_number(v)
13391344

13401345
values = np.c_[list(components1.values())]
13411346
display(pd.DataFrame(values, index=components1.keys(), columns=columns))

0 commit comments

Comments
 (0)