Breakpoint analysis =================================== Once a new breakpoint has been detected (see :ref:`detection`), the next step is to decide what *type* of breakpoint it is. It can be: * A quiet breakpoint (due to normal variations of the solar zenith angle throughout the day) * The beginning or the onset of a flare * A breakpoint with a flat slope at the maximum of a flare * A breakpoint in the decay part of a flare * A breakpoint after a flare, when we go back to quiet times .. important:: If the slope detected is above 1e4 °/hr, the breakpoint may be due to a technical problem (e.g. the transmitter was off and has just started again; the phase unwrap missed one jump) or due to nighttime. Over one year of data with NRK, this happened 83 times (55 during nighttime, and 28 during daytime). It was never caused by a flare. Thus, any breakpoint with a slope that high will simply not be considered. This should limit the number of false positives due to this. It will not completely remove them though, but it should remove the ones with very high slopes, which would be detected as a very strong flares (because :math:`DP` would be very large, see :ref:`estimating_flux`). In this case, we also set :py:attr:`~vlf4ions.class_definition.station.quiet` = 1, :py:attr:`~vlf4ions.class_definition.station.DP` = 0 and :py:attr:`~vlf4ions.class_definition.station.DA` = 0. Similarly, if the amplitude has not changed much since last quiet breakpoint (:py:attr:`DA` is less than :py:attr:`receiver.threshold`/2), then there is a chance that this is a false detection. In this case, :py:attr:`quiet` is not set to zero, but :py:attr:`DP` is put to 0 to not impact the flux estimation or the computation of the electron density. This way, :py:attr:`DA` and :py:attr:`DP` will still be updated each time with the :py:meth:`~vlf4ions.class_definition.station.compute_DA_DP` method and this may lead to higher flux estimates in the future is there is a flare. The decision algorithm which is used to analyse breakpoint is presented in :ref:`fig-analyse_bp` .. _fig-analyse_bp: .. figure:: ../Figures/BP_analysis_drawio.png Breakpoint analysis algorithm The more detailed algorithm with the differents additional flags to avoir false detections is: .. figure:: ../Figures/BP_analysis.drawio.png Breakpoint analysis algorithm with error detection This is done internally by the :py:func:`vlf4ions.analyse_change_points.analyse_breakpoint` function. The main quantity that will determine which kind of breakpoint has just been detection is the :py:attr:`detection_threshold` (which is an attribute of the :py:class:`~vlf4ions.class_definition.station` class, see :ref:`station_class`), which is dependent on the station and the receiver and needs to be computed beforehand. Below is an explanation of how to compute it. .. _detection_threshold: Detection threshold ----------------------------- The detection threshold (:py:attr:`~vlf4ions.class_definition.station.detection_threshold`) is the slope above which we consider that there is a flare detection. To find it, the algorithm can be run on multiple days (e.g. one year of past data), and all the slopes detection in daytime, in quiet time (i.e. when GOES flux is below 3e-6 W/m^2^ for example) can be found. Arbitrarily, we have decided to take the :py:attr:`~vlf4ions.class_definition.station.detection_threshold` to be the 75^th^ quantile of all the slopes found previously, but this threshold can be decided by the user. A high detection threshold will limit the false positive detection, but a lower threshold will ensure a maximum of true detection. It should also be noted that for a single station, most 'false positive' detections are due to error in the phase unwrap (with slopes which can reach several thousands degrees per hour) and thus increasing the threshold will not solve this problem. A rougth outline of how we can compute this is provided in the `Notebook `_ .