Skip to content

Commit

Permalink
updates to notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
atsiaras committed Nov 16, 2024
1 parent e7c9cb2 commit 2cdf487
Show file tree
Hide file tree
Showing 81 changed files with 1,159 additions and 16,150 deletions.
96 changes: 75 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,59 @@ properties and calculations.
- Check the notebooks under the "notebooks/2_detrending_examples" directory
to see how to model your light-curves.

- Check the notebook "2_core_calculations" for higher efficiency
- Check the notebook "3_core_calculations" for higher efficiency
(suggested for developers).



## History
# History

### v4.1
## PyLightcurve v4.1.x

### Changes in usage compared to Pylightcurve v4.0.x versions:

- Parameters renamed

An attempt has been made to use more consistent and self-explainable parameter names in PyLightcurve.
Please pay extra care when accessing the fitting output, almost all parameter names have changed!

| variable name in | type | description |unit |
|:-------------------------|:----------:|:-----------------------------------------:|:----------------------:|
| ``name`` |``str`` |name of the planet | -- |
| ``ra`` |``float`` |RA of the host star |degrees (ICRS) |
| ``dec`` |``float`` |DEC of the host star |degrees (ICRS) |
| ``stellar_logg`` |``float`` |log(g) of the host star |log(cm/s<sup>2) |
| ``stellar_temperature`` |``float`` |effecive temperature of the host star |Kelvin |
| ``stellar_metallicity`` |``float`` |metallicity of the host star |dex(Fe/H) or dex(M/H) |
| ``rp_over_rs`` |``float`` |plant-to-star radius ratio | -- |
| ``period`` |``float`` |orbital period |days |
| ``sma_over_rs`` |``float`` |orbital semi-major axis relatively <br> to the stellar radius | -- |
| ``eccentricity`` |``float`` |orbital eccentricity | -- |
| ``inclination`` |``float`` |orbital inclination |degrees |
| ``periastron`` |``float`` |orbital argument of periastron |degrees |
| ``mid_time`` |``float`` |the time of conjunction with the planet in front of the star |days (BJD<sub>TDB</sub>)|
| ``albedo`` |``float`` |planet albedo | -- |
| ``emissivity`` |``float`` |planet emissivity | -- |
| ``filter_name`` |``str`` |filter used for the observation | -- |
| ``wlrange`` |``list`` or ``None`` |2-element list that includes the wavelength range in the filter used for the observation | Angstrom |
| ``ldc_method`` |``str`` |limb-darkening model used to calculate the limb-darkening coefficients | -- |
| ``stellar_model`` |``str`` |stellar model used to calculate the limb-darkening coefficients | -- |
| ``precision`` |``int`` |level of precision used to calculate the light-curve models | -- |

- New structure for fitting output

Please check the notebook ```notebooks/2_detrending_examples/0_a_simple_lc_fitting.ipynb``` to see the structure of the fitting output.

#### Changes in usage:
- New way of accessing the LDCs and the Fp/Fs in the planet class

```python
# v4.0
limb_darkening_coefficients = planet.filter('COUSINS_R').limb_darkening_coefficients
fp_over_fs = planet.filter('COUSINS_R').fp_over_fs
rp_over_rs = planet.filter('COUSINS_R').rp_over_rs

# v4.1
limb_darkening_coefficients = planet.exotethys('COUSINS_R', method='claret',
limb_darkening_coefficients = planet.exotethys('COUSINS_R', ldc_method='claret',
wlrange=None, stellar_model='Phoenix_2018')
# available methods: claret, power2, quad, linear
# available stellar models: Atlas_2000, Phoenix_2012_13, Stagger_2015, Stagger_2018
Expand All @@ -87,6 +121,7 @@ fp_over_fs = planet.fp_over_fs('COUSINS_R', wlrange=None)
rp_over_rs = planet.rp_over_rs
```


- Planet eclipse time is not automatically calulated
```python
# v4.0
Expand All @@ -97,7 +132,6 @@ eclipse_mid_time = planet.eclipse_mid_time()
```



- New way of adding custom filters or limb darkening coefficients in the planet class
```python
# v4.0
Expand All @@ -114,28 +148,47 @@ planet.add_custom_limb_darkening_coefficients([ldc1, ldc2, ldc3, ldc4], filter_n

- Stellar model is no longer defined when initialising a Planet object (no ```ldc_stellar_model``` argument), it is defined when adding an observation

- New way of defining the iterations in MCMC

- New definition of iterations in MCMC
```python
# v4.0 - total model evaluations = iterations
iterations, walkers = 15000, 3

# v4.1 - total model evaluations = iterations x walkers
iterations, walkers = 5000, 3
```
- Time conversions are now available through the Planet class


- Time conversions are now available through the Planet class directly
```python
# v4.0
time_in_bjd_utc = planet.target.convert_to_bjd_tdb(time_in_hjd_utc, 'HJD_UTC')
time_in_bjd_tdb = planet.target.convert_to_bjd_tdb(time_in_hjd_utc, 'HJD_UTC')


# v4.1
time_in_bjd_utc = planet.convert_to_bjd_tdb(time_in_hjd_utc, 'HJD_UTC')
time_in_bjd_tdb = planet.convert_to_bjd_tdb(time_in_hjd_utc, 'HJD_UTC')
# or
time_in_bjd_utc = plc.convert_to_bjd_tdb(ra_in_degrees, dec_in_degrees, time_in_hjd_utc, 'HJD_UTC')
time_in_bjd_tdb = plc.convert_to_bjd_tdb(ra_in_degrees, dec_in_degrees, time_in_hjd_utc, 'HJD_UTC')
# where ra, dec in degrees
# available formats: JD_UTC, MJD_UTC, HJD_UTC, HJD_TDB, BJD_UTC, BJD_TDB
```
- PyLightcurve now accepts angles as floats only (degrees). No angle transformation through


- When performing core calculations directly or through a ```plc.Planet``` object,
all time arrays must be provided in ```BJD_TDB```, so you need to convert them first
```python
# v4.0
time_in_jd_utc = np.arange(planet.mid_time - 0.1, planet.mid_time + 0.1, 0.001)
transit_model = planet.transit(time_in_jd_utc, time_format='JD_UTC', filter_name='COUSINS_R')


# v4.1
time_in_jd_utc = np.arange(planet.mid_time - 0.1, planet.mid_time + 0.1, 0.001)
time_in_bjd_tdb = planet.convert_to_bjd_tdb(time_in_hjd_utc, 'JD_UTC')
transit_model = planet.transit(time_array_in_jd_utc, filter_name='COUSINS_R')
```

- PyLightcurve now accepts angles as floats only (degrees). No angle transformations through
```pylightcurve``` are available, please use the new ```exoclock``` package.
```python
# v4.0
Expand All @@ -149,8 +202,6 @@ ra_in_dms_coordinate = ra.dms_coord() # this will give the angle between -90 and
ra_in_hms = ra.hms()
ra_in_degrees_coordinate = ra.deg_coord() # this will give the angle between -90 and 90 degrees



# v4.1
import exoclock
ra = exoclock.Hours('22:03:10.7729')
Expand All @@ -164,16 +215,15 @@ ra_in_hms = ra.hms()
ra_in_degrees_coordinate = ra.deg_coord() # this will give the angle between -90 and 90 degrees
```


#### New features:
### New features:
- Custom detrending
- Automatic scaling of uncertainties, outliers rejection and initial parameter optimisation
- Wrapper for ExoTETHyS and sub-bandpass LDCs
- Wrapper for ExoTETHyS and LDCs for sub-bandpass
- More precise integration
- Airmass detrending is now available
- Flux/Mag conversions are now available through the Planet class
- Airmass detrending
- Flux/Mag conversions available through the Planet class

### v4.0 - [latest (v4.0.3)](https://github.com/ucl-exoplanets/pylightcurve/releases/tag/v4.0.3)
### PyLightcurve v4.1.x - [latest (v4.0.4)](https://github.com/ucl-exoplanets/pylightcurve/releases/tag/v4.0.4)

- PyLightcurve 4.0 no longer supports the use of the Open Exoplanet Catalogue (OEC), due to the large number
of mistakes in the catalogue and the absence of parameters updates. OEC has been replaced by the
Expand Down Expand Up @@ -205,13 +255,17 @@ angles (e.g. '+47:12:34.05' to degrees) and of timing systems (e.g. HJD_UTC to B
### 4.0.3
- Fix np.float bug.

### 4.0.4
- Fixed packaging and test issues.
- Fixed latex strings in plots.
- Fixed matplotlib.cm.get_cmap bug.


## Licence

MIT License

Copyright (c) 2016-2023 Angelos Tsiaras, and collaborators
Copyright (c) 2016-present Angelos Tsiaras, and collaborators

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
91 changes: 91 additions & 0 deletions notebooks/.ipynb_checkpoints/1_the_planet_class-checkpoint.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "988b5848",
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"import matplotlib.pyplot as plt\n",
"import pylightcurve as plc\n",
"import numpy as np\n",
"\n",
"\n",
"###############################################################################################\n",
"##### Definitions\n",
"###############################################################################################\n",
"\n",
"# The core culculations are provided to ofer maximum efficiency and they are available to \n",
"# help developers build their own codes on the functionalities of PyLigthcurve.\n",
"# To use the core calculation in PyLightcurve we need to be able to provide the following \n",
"# information to the different functions:\n",
"\n",
"# ra # float, in degrees\n",
"# dec # float, in degrees\n",
"# stellar_logg # float, in log(cm/s^2)\n",
"# stellar_temperature # float, in Kelvin\n",
"# stellar_metallicity # float, in dex(Fe/H) or dex(M/H)\n",
"# rp_over_rs # float, no units\n",
"# period # float, in days\n",
"# sma_over_rs # float, no units\n",
"# eccentricity # float, no units\n",
"# inclination # float, in degrees\n",
"# periastron # float, in degrees\n",
"# mid_time # float, in days (BJD_TDB)\n",
"# time_array # np.array dtype=float, in days (BJD_TDB)\n",
"# albedo # float, no units\n",
"# emissivity # float, no units\n",
"\n",
"# For the examples below we will use the paraeters of the famus HD209458b:\n",
"\n",
"ra = 330.795\n",
"dec = 18.884\n",
"stellar_logg = 4.36 \n",
"stellar_temperature = 6065.0\n",
"stellar_metallicity = 0.0\n",
"rp_over_rs = 0.12086\n",
"period = 3.5247486\n",
"sma_over_rs = 8.76\n",
"eccentricity = 0.0\n",
"inclination = 86.71 \n",
"periastron = 0.0\n",
"mid_time = 2452826.62928\n",
"albedo = 0.15 # assumed\n",
"emissivity = 1.0 # assumed\n",
"\n",
"###############################################################################################"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c960cf47",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit 2cdf487

Please sign in to comment.