First example

Introduction

In this first example, we will run the LIFE Target Database data generation with a distance cut of 10 parsec.

File location

Make sure to have this file saved in the correct directory (data_generation/life_td_data_generation) before running it. The file in data_generation/docs/source/tutorials is only intended for proper display on the webpage.

Getting started

We start by turning off the astropy warnings. Those are useful for development but not needed in this tutorial.

[1]:
import warnings

from astropy.utils.exceptions import AstropyWarning

warnings.simplefilter("ignore", category=AstropyWarning)

Next we importing the needed functions from the modules.

[2]:
from life_td import create_life_td

We will use a distance cut of 10 pc as opposed to the 30 pc used in the published database because the data generation would take much longer otherwise.

[3]:
distance_cut = 10.0

Initiating data generation

First we make sure that the servers where we optain the data for the database are reachable.

[11]:
!pytest integration_tests/pre_db_creation/integration_test_provider_queries.py
============================= test session starts ==============================
platform linux -- Python 3.13.5, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/franziska/PycharmProjects/life_td
configfile: pyproject.toml
plugins: anyio-4.8.0
collected 7 items                                                              

integration_tests/pre_db_creation/integration_test_provider_queries.py . [ 14%]
......                                                                   [100%]

============================== 7 passed in 10.57s ==============================

Now we actually run the database creation module.

[4]:
provider_tables_dict, database_tables = create_life_td(distance_cut)
Building life_td data with distance cut of 10.0 pc
Trying to create SIMBAD tables from 2025-09-15...
 sorting object types...
removing 4  objects that had object types: ['BD?|MIR|NIR', 'BD?|NIR']
example object of them: WISE J083011.97+283716.6
Trying to create Grant Kennedy Disks tables from 2024-02-09...
Trying to create WDS tables from 2025-09-15...
Creating  WDS  tables ...
 querying VizieR for WDS...
 performing distance cut...
Trying to create Exo-MerCat tables from 2025-09-15...
Trying to create LIFE tables from 2025-09-15...
Trying to create Gaia tables from 2025-09-15...
Building sources table ...
Building objects table ...
Building provider table ...
Building ident table ...
Building best_h_link table ...
warning: empty table best_h_link
Building star_basic table ...
Building planet_basic table ...
Building disk_basic table ...
Building mes_mass_pl table ...
Building mes_teff_st table ...
Building mes_radius_st table ...
Building mes_mass_st table ...
Building mes_binary table ...
Building mes_sep_ang table ...
Building h_link table ...
Unifying null values...
Saving data...

Sanity tests

Now lets have a look at our generated tables to make sure the data makes sense.

[14]:
!pytest integration_tests/post_db_creation/integration_test_building.py
============================= test session starts ==============================
platform linux -- Python 3.13.5, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/franziska/PycharmProjects/life_td
configfile: pyproject.toml
plugins: anyio-4.8.0
collected 11 items                                                             

integration_tests/post_db_creation/integration_test_building.py ........ [ 72%]
...                                                                      [100%]

============================== 11 passed in 3.83s ==============================

Now this integration test actually has some nice plots to look at but I haven’t figured out how to show them through the jupyter notebook yet. I can produce them by running the tests in my pycharm or via terminal using

life_td/data_generation/life_td_data_generation$ python -m pytest integration_tests/post_db_creation/integration_test_building.py