<jupyter_start><jupyter_text>Installing dependencies. Useful for running on Google Colab<jupyter_code># pyarrow might be needed to read the data
!python -m pip install Cython
!python -m pip install -e git+https://git@github.com/alercebroker/turbo-fats#egg=turbofats
!python -m pip install -e git+https://git@github.com/alercebroker/mhps#egg=mhps
!python -m pip install -e git+https://git@github.com/alercebroker/P4J#egg=P4J
!python -m pip install pyarrow
!python -m pip install -e git+https://git@github.com/alercebroker/lc_classifier#egg=lc_classifier<jupyter_output>Requirement already satisfied: Cython in /usr/local/lib/python3.7/dist-packages (0.29.24)
Obtaining turbofats from git+https://****@github.com/alercebroker/turbo-fats#egg=turbofats
  Cloning https://****@github.com/alercebroker/turbo-fats to ./src/turbofats
  Running command git clone -q 'https://****@github.com/alercebroker/turbo-fats' /content/src/turbofats
Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from turbofats) (1.19.5)
Requirement already satisfied: numba in /usr/local/lib/python3.7/dist-packages (from turbofats) (0.51.2)
Requirement already satisfied: scipy in /usr/local/lib/python3.7/dist-packages (from turbofats) (1.4.1)
Requirement already satisfied: statsmodels in /usr/local/lib/python3.7/dist-packages (from turbofats) (0.10.2)
Requirement already satisfied: llvmlite<0.35,>=0.34.0.dev0 in /usr/local/lib/python3.7/dist-packages (from numba->turbofats) (0.34.0)
Requirement already satisfied: setuptools in /usr/local/lib/python3.7/dist-pack[...]<jupyter_text>[Google Colab] Please restart Python after installing the packages: Runtime >> Restart runtime<jupyter_code>import numpy as np
import pandas as pd
from lc_classifier.features import ZTFLightcurvePreprocessor, ZTFFeatureExtractor<jupyter_output>/usr/local/lib/python3.7/dist-packages/statsmodels/tools/_testing.py:19: FutureWarning: pandas.util.testing is deprecated. Use the functions in the public API at pandas.testing instead.
  import pandas.util.testing as tm<jupyter_text>Reading the sample dataTo calculate the model features we will need:- Detections: Alerts from the ZTF stream, with 5 $\sigma$ difference between the template and the current image.- Non Detections: Previous measurements of the object but with less than 5 $\sigma$ magnitudes.- Object Information: Aggregated information by ALeRCE.<jupyter_code>detections = pd.read_parquet(
    'https://github.com/alercebroker/lc_classifier/raw/main/examples/'
    'data/detections_sample.parquet')
non_detections = pd.read_parquet(
    'https://github.com/alercebroker/lc_classifier/raw/main/examples/'
    'data/non_detections_sample.parquet')
object_information = pd.read_parquet(
    'https://github.com/alercebroker/lc_classifier/raw/main/examples/'
    'data/object_info_sample.parquet')
detections.head()
non_detections.head()
object_information.head()<jupyter_output><empty_output><jupyter_text>Calculating features  Light curve preprocessing<jupyter_code>preprocessor = ZTFLightcurvePreprocessor(stream=False)

detections = preprocessor.preprocess(detections, objects=object_information)
non_detections = preprocessor.rename_columns_non_detections(non_detections)<jupyter_output><empty_output><jupyter_text>Feature computation<jupyter_code>feature_extractor = ZTFFeatureExtractor(bands=(1, 2), stream=False)
# We use the compute_features method
features = feature_extractor.compute_features(
    detections = detections,
    non_detections = non_detections)
# The result is a dataframe with the features
features<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup