% !TEX root = ../thesis-example.tex
%Example chapter on Asteroseismology
\chapter{Introduction \label{sec:intro}}
%\cleanchapterquote{Shoot for the moon. Even if you miss, you'll land among the stars.}{Les Brown} %optional, if you want to place something here.
This chapter gives brief introduction to the goals of this study, the state of the art, scientific backgrounds such as spectral types, spots and flares, as well as to the space missions from which data has been extensively used for the present study.\\
The goal of this study is to relate flares/superflares to the appearance of spots on the surfaces of stars of various spectral types. Flares are well studied for the Sun (\cite{solar_flares_1}, \cite{solar_flares_2}, \cite{solar_flares_3}) with the first recorded event being the Carrington event from September 1859 (\cite{Carrington_event}). The same accounts for the impact of stellar activity on Earths magnetic field (\cite{solar_flare_mag_field}). A detailed description of spots and flares is given in section \ref{sec:intro:flares_and_spots}.
While the first stellar flares were discovered in middle of the last century (\cite{early_stellar_flares1}, \cite{early_stellar_flares2}), the topic gained a lot of attraction with the launch of the likes of Kepler and the Transiting Exoplanet Survey Satellite (TESS). They allowed the survey of thousands of stars. With this, studies of flares and superflares on a large number of stars have been conducted (e.g. \cite{flare_study_1}, \cite{flare_study_2}, \cite{connection_starspots_flares_ms_kepler}, \cite{flare_occurance_periodicity}), but the origin of superflares (flares with a bolometric energy above $10^{33}$ erg) is still not clear. So far no superflare has been observed on our Sun, but there have been studies focusing on the possible origin on superflares and their likelyhood to happen on our Sun (\cite{superflares_on_sun}). They found that superflares on our Sun would be rare events (every \textasciitilde800 years for superflares with $10^{34}$ erg). Even more recently \cite{superflare_shapiro} estimated the occurance rate of superflares with $>10^{34}$ erg on Sun-like stars to roughly once per century.\\
A few proposed causes for superflares could be star-planet interaction (SPI) (\cite{au_mic_flaring_spi}, \cite{SPI_1}, \cite{SPI_2}), or just being scaled up version of normal flares which we see from our Sun coming from large spots (\cite{superflares_1}, \cite{superflares_2}).\\

\section{State of the art \label{sec:intro:goals}}

\cite{doyle_2018} studied 34 M dwarfs from the K2 mission, using short cadence observational data. They confirmed that the stars in their dataset with a rotational period of less than 10 days showed more flares than stars with longer roation periods, which was already shown previously (\cite{faster_rot_stars_more_flares1}, \cite{faster_rot_stars_more_flares2}). Furthermore they found no star with a preference for when flares occured during the rotational phase (\cite{doyle_2018}). A similar study using TESS 2 minute cadence data has been conducted by \cite{doyle_2019}. In this study they used data of 167 M dwarfs and found a total of 1834 flares. Similar to the study on K2 data, they found no preference for roational phase (\cite{doyle_2019}).\\
\cite{connection_starspots_flares_ms_kepler} investigated a sample of 119 stars from spectral types M to F. They used a subset of the Kepler long-cadence data. They found that flares which increase the stellar flux by 1\% to 5\% appear more often while larger starspots are visible, while flares which increase the flux by more that 5\% do not seem to have this dependency (\cite{connection_starspots_flares_ms_kepler}).\\
Further analysis on periodic flare occurance was done by \cite{flare_occurance_periodicity}, who studied TESS lightcurves of 284 cool dwarfs. They found three targets (TIC 80427281, TIC 95328477, TIC 220432563) with a confirmed flare periodicity, which correlates to their rotational period or half of it.\\
There have also been studies on individual stars, for example \cite{kepler_411_study} focused on Kepler-411, which is a K2V dwarf, by investigating the relation between superflares and star spots on that star. They found a positive correlation between the energy of flares and the area of star spots (\cite{kepler_411_study}) on Kepler-411. They then compared their results for Kepler-411, which produced multiple superflares, with Kepler-210 (a K dwarf with two planets), which did not produce superflares while having the same number of spots (\cite{kepler_411_210_comparison}). They found the spots on Kepler-210 to be larger, warmer and therefore being magnetically weaker/less complex compared to Kepler-411 and concluded that the area of starspots is not the only relevant parameter for superflare occurance (\cite{kepler_411_210_comparison}).\\
Star-planet interaction was studied by \cite{au_mic_flaring_spi} for the star AU Mic. While they found a signal in their used TESS lightcurves correlating with the orbital period of AU Mic b, they state that a $>3\sigma$ detection requires more observations (\cite{au_mic_flaring_spi}).\\
In conclusion, many flares and superflares have been found on stars, but the origin of the latter is still not clear. Although it is widely accepted that superflares may be scaled up normal flares, still the issue of star-planet interaction is discussed. Furthermore, the above mentioned studies could not relate flare/superflare occurance distinctively to the spottedness of stars. With a large data set comprised of Kepler, K2 and TESS data we aim for a more distinct relation flare/superflare occurance and spottedness of stars.

\section{Spectral Types \label{sec:intro:spectral_types}}

Spectral classification is a way to classify the vast amount of stars into various types. The original definition of the currently used Harvard System was developed by \cite{orig_harvard_system_sptype_definition}. It characterized stars by their most prominent spectral lines. The different spectral types introduced are O, B, A, F, G, K and M. In this system the stars were differentiated by their different prominent spectral lines. For example B type stars were described to have faint hydrogen lines, but numerous helium lines. Another example would be spectral class A, which was described to have the most prominent hydrogen lines (\cite{orig_harvard_system_sptype_definition}). Furthermore the spectral classes were divided into 10 subtypes, with 1 to 9 attached to the letter. In a later revision, the spectral types without a numeral had a 0 attached, for example B to B0 or A to A0 (\cite{orig_harvard_system_sptype_definition2}). If the exact spectral type can not be determined, the numeral should be left out (\cite{orig_harvard_system_sptype_definition2}). 
\cite{spectral_lines_temperature_correlation} then found that this specification links to the effective temperature of stars, with O being the hottest, and M being the coolest. The same applies to the subtypes, with 0 being the hottest, and 9 the coolest of their respective type (\cite{harvard_spectral_types_teff}). Additionally the terms "early" and "late" are often used and can refer to the spectral type itself, with the hotter O, B, or A stars being "early" type, and cooler F, G, K, M stars being "late" types, or if used in combination with a spectral type, it refers to hotter or colder subtypes like K0 being an early K type or G9 being a late G type (\cite{astrophysics_group_uk_spectral_types}). Table \ref{tab:spectral_types_table} shows the spectral types with their respective approximate temperature range as well as color.

\begin{table}
    \centering
    \caption{Table showing the different spectral types, in relation to their minimum and maximum effective temperature ranges in K. Based on the tables given in \cite{astrophysics_group_uk_spectral_types}, \cite{harvard_spectral_types_teff}}
    \label{tab:spectral_types_table}
    \begin{tabular}{lccl}
    \hline
    Spectral type & min. T\textsubscript{eff} & max. T\textsubscript{eff} & Color \\
     & [K] & [K] & \\
    \hline\hline
    O & 25000 & - & Blue \\
    B & 10000 & 25000 & Blue \\
    A & 7500 & 10000 & Blue \\
    F & 6000 & 7500 & Blue to White \\
    G & 5000 & 6000 & White to Yellow \\
    K & 3500 & 5000 & Orange to Red \\
    M & - & 3500 & Red \\
    \hline
    \end{tabular}
\end{table}

% Different Spectral Types

\section{Spots and Flares \label{sec:intro:flares_and_spots}}

This section gives a short overview of starspots/flares by explaining it based on the best observable example we have: the Sun.

\subsection{Spots}

Sunspots, or genereally speaking spots, are magnetic regions on the surface of a star that are cooler than their surroundings. Spots generally have an umbra, which is the center, and the penumbra, which is surrounding the umbra and separating it from the rest of the surface of the star (\cite{sunspots_overview}). If a spot does not have a penumbra, it is called a pore (\cite{sunspots_overview}). The size of spots varies greately, and can be up to a diameter of 60000 km on the Sun and have lifetimes from a few days up to several months (\cite{sunspots_overview}). The umbra can be 1000 to 1900K cooler than the solar surface, while the penumbra can be 250 to 400 K cooler, which also causes them to be less bright than the rest of the photosphere (values for the Sun, \cite{sunspots_overview}). This is because the strong magnetic fields (1800 to 3700 G in the umbra and 700 to 1000 G in the penumbra, compared to a few gauss in the photosphere (\cite{sunspots_overview})) limit the convection process, effecitvely reducing the thermal energy in this area (\cite{sunspots_overview}, \cite{sun_photosphere_mag_field_strength}). An example of a sunspot can be seen in figure \ref{fig:sunspot_soho}. The image was taken by SOHO (Solar \& Heliospheric Observatory, \cite{soho_project_page}, \cite{soho_esa}, \cite{soho_nasa}). It shows a sunspot, with its umbra (black area) being slightly larger than Earth. The penumbra is visible in orange, and the surrounding solar photosphere is colored in yellow. Additionally an image of full solar disk at the same time the spot image was taken is included in the top right. The sunspot is located slightly left of the center.\\
Figure \ref{fig:sunspot_magnetic_field_lines} shows a sketch of a sunspot, with its umbra and penumbra and magnetic field lines, with more field lines at the umbra representing a stronger magnetic field. Each spot is also magnetically linked to one or more spots of the opposite polarity, with the magnetic field varying in complexity. A simple example of this can be seen in figure \ref{fig:sunspot_magnetic_field_lines_connecting}.

\begin{figure}[pt!]
    \centering
    \includegraphics[width=.6\linewidth]{gfx/spots/sunspot00.png}
    \caption{Image showing a sunspot from the 23. September 2000. Comparison of its size to Earth in the bottom left. The whole visible photosphere of the Sun is visible in the top right corner. Image taken from the SOHO image gallery (\cite{soho_project_page}).}
    \label{fig:sunspot_soho}
\end{figure}

\begin{figure}[pt!]
    \centering
    \includegraphics[width=.7\linewidth]{gfx/spots/magnetic_fields_above_sunspot.png}
    \caption{Image showing magnetic field lines coming out of a sunspot. Field lines are denser in the umbra compared to the penumbra, representing stronger magnetic fields. Image from \cite{sunspot_magfieldlines_image}.}
    \label{fig:sunspot_magnetic_field_lines}
\end{figure}

\begin{figure}[pt!]
    \centering
    \includegraphics[width=.6\linewidth]{gfx/spots/image1_3.png}
    \caption{Image showing two sunspots being connected by magnetic field lines. Image from \cite{sunspot_mag_field_connecting_to_second}.}
    \label{fig:sunspot_magnetic_field_lines_connecting}
\end{figure}

\subsection{Flares}

Flares are a sudden release of a huge amount of magnetic energy, which happens due to magnetic reconnection (\cite{flares_1}) with the first flare observed on the 1. September 1859 by \cite{Carrington_event} and \cite{Carrington_event2}. \cite{Carrington_event3} estimated the energy release of the flare to $5.77 \pm 2.89 * 10^{32} erg$, which would .
The energy which is released, is the so called free magnetic energy. This is the excess energy above the ground state of the magnetic field. During a period of days to weeks this free energy is accumulated. This is done by braiding, sheering and twisting the frozen-in magnetic fields. The more the magnetic field now differs from the unmodified state, the more energy is built up. To release the stored energy, magnetic reconnection has to happen. For this two magnetic field lines of opposing direction need to come close. This causes a current sheet to form due to the strong current flow. In this region the frozen-in state is broken. The energy that is released during the reconnection process causes a temperature increase of the surrounding plasma (multiple 10 million K). This is then observed in soft X-ray, EUV, FUV, UV as well as some lines in the visible spectrum and in radio. Additionally particles are accelerated and when they hit the denser chromosphere, those particles are decelerated quickly, producing hard X-ray (Bremsstrahlung). The energy release can take just a few tens of seconds, but can also last up to a few hours on the Sun. An imagine of this process can be seen in figure \ref{fig:solar_flare}.

\begin{figure}[pt!]
    \centering
    \includegraphics[width=.6\linewidth]{gfx/flares/Color-online-Standard-model-of-a-solar-flare-The-flare-is-triggered-by-the-ascension.png}
    \caption{Imagine showing the standard model for a solar flare. The blue arrows indicate inflow of cool plasma. The green arrows indicate outflow of hot plasma. Image from \cite{flare_image}.}
    \label{fig:solar_flare}
\end{figure}

% Stellar Activity, 

\section{Space missions \label{sec:intro:space_missions}}

% TESS, Kepler/K2
This section gives a short overview on the space mission from which the data was used for this study.

\subsection{Kepler and K2}

The Kepler space telesope was named after Johannes Kepler and was launched in 2009\footnote{\label{fn:nasa_kepler_in_depth}\href{https://science.nasa.gov/mission/kepler/in-depth/}{https://science.nasa.gov/mission/kepler/in-depth/}} and its primary mission lasted till May 2013\footnote{\label{fn:kepler_missions_and_data_mast}\href{https://archive.stsci.edu/missions-and-data/kepler}{https://archive.stsci.edu/missions-and-data/kepler}}. Its main scientific goal was the discovery of exoplanets, especially Earth-sized ones, in the habitable zone around their host star\footnote{\label{fn:kepler_missions_caltech}\href{https://exoplanetarchive.ipac.caltech.edu/docs/KeplerMission.html}{https://exoplanetarchive.ipac.caltech.edu/docs/KeplerMission.html}} (\cite{Kepler_first_results}). This was done by observing transits of planets around their host star\cref{fn:kepler_missions_caltech}\textsuperscript{,}\cref{fn:kepler_missions_and_data_mast} (\cite{Kepler_first_results}).\\
It provides two different types of data: short cadence (1 minute exposure) and long cadence (30 minute exposure) data\cref{fn:kepler_missions_and_data_mast} (\cite{Kepler_first_results}). While short cadence data provides a higher temporal resolution, it was used for fewer targets (\cite{Kepler_first_results}). It had a fixed exposure time of 6.02 seconds for its photometer with a field of view of 115 $deg^{2}$ near the cygnus constellation\cref{fn:kepler_missions_and_data_mast} (\cite{Kepler_first_results}) and is most sensitive in the visual to near infrared as seen in figure \ref{fig:kepler_bands}. The data was then accumulated for selected targets to either short or long cadence, and then downloaded (\cite{Kepler_first_results}). The space telescope could accomondate data of around 170,000 targets with long cadence and 512 targets with short cadence (\cite{Kepler_first_results}). The spacial resolution of each of the 42 CCDs was 4 arcseconds per pixel (\cite{doyle_2019}, \cite{kepler_mission_stellar_and_instrument_noise}).\\
The K2 mission is the continuation mission of Kepler after the second of four of its reaction wheels broke in 2013\cref{fn:nasa_kepler_in_depth} (\cite{k2_missions_and_data_mast}). Due to this, a follow-up mission was proposed, keeping the now limited capabilities in mind\cref{fn:nasa_kepler_in_depth}. The mission was active from February 2014 till September 2018 when its fuel ran out\footnote{\label{fn:k2_missions_and_data_mast}\href{https://archive.stsci.edu/missions-and-data/k2}{https://archive.stsci.edu/missions-and-data/k2}}\textsuperscript{,}\footnote{\label{fn:kepler_end_nytimes}\href{https://web.archive.org/web/20181030211627/https://www.nytimes.com/2018/10/30/science/nasa-kepler-exoplanet.html}{https://web.archive.org/web/20181030211627/https://www.nytimes.com/2018/10/30/science/nasa-kepler-exoplanet.html}}\textsuperscript{,}\footnote{\label{fn:kepler_end_nasa_press}\href{https://www.jpl.nasa.gov/news/nasa-retires-kepler-space-telescope/}{https://www.jpl.nasa.gov/news/nasa-retires-kepler-space-telescope/}}. It discovered a total of over 2600 confirmed planets as of 2018\cref{fn:kepler_end_nytimes}\textsuperscript{,}\cref{fn:kepler_end_nasa_press}.

\begin{figure}[pt!]
    \centering
    \includegraphics[width=.6\linewidth]{gfx/kepler/kepler_bandpass_jason1.jpg}
    \caption{Johnson B, V, R and I in comparison to the Kepler, MOST and CoRoT missions response curves. Also shown is a A2V and a M2V spectrum. Image from \cite{kepler_sensitivity}.}
    \label{fig:kepler_bands}
\end{figure}

\subsection{TESS}

The Transiting Exoplanet Survey Satellite (TESS) was launched in 2018, with its primary mission lasting two years\footnote{\href{https://exoplanets.nasa.gov/tess/}{https://exoplanets.nasa.gov/tess/}}. Since 2020 TESS is in its extended mission, the first being from 2020 to 2022\footnote{\label{fn:tess_extended_mission_1}\href{https://archive.stsci.edu/contents/newsletters/august-2020/tess-extended-mission}{https://archive.stsci.edu/contents/newsletters/august-2020/tess-extended-mission}}, the second from 2022 to 2024\cref{fn:tess_tess}. TESS has four identical cameras, with each providing a 24 times 24 degree field of view\footnote{\label{fn:tess_tess}\href{https://tess.mit.edu/science/}{https://tess.mit.edu/science/}} (\cite{TESS2014}). TESS's CCDs have a pixel scale of 21 arcseconds (\cite{TESS2014}, \cite{doyle_2019}) and is most sensitive in the red and infrared (see figure \ref{fig:tess_bands}). The data is provided in 2 minute cadence for individual stars and 30 minute cadence for full frame images (\cite{tess_tess}).\\
TESS observes its targets in so called sectors. Each sector is observed for 27 days\cref{fn:tess_tess}.

\begin{figure}[pt!]
    \centering
    \includegraphics[width=.6\linewidth]{gfx/tess/The-TESS-spectral-response-function-black-line-defined-as-the-product-of-the-long-pass.png}
    \caption{Johnson V, R\textsubscript{C}, I\textsubscript{C} and SDSS z (colored dashed lines) response curves and in comparison to TESS (solid black line). Image from \cite{kepler_sensitivity}.}
    \label{fig:tess_bands}
\end{figure}