vlf4ions.manage_statefile

Created on Fri Mar 21 10:16:58 2025

@author: pteysseyre

Functions

get_lastbreakpoint(la_station, la_date, path)

Read the value of the last breakpoint, such as the time of detection, the slope, and the associated amplitude and phase.

write_file_with_df(stations, path_to_result)

Write a file with the current df values for each station

write_fluxestimate(best_guess, quiet, today, ...)

Writes in a file the best guess for the flux estimation and informations about how it was computed.

write_newbreakpoint(la_station, la_date, ...)

Update the state file by adding the new detected breakpoint.

vlf4ions.manage_statefile.get_lastbreakpoint(la_station, la_date, path, quiet=False, check_yesterday=True)[source]

Read the value of the last breakpoint, such as the time of detection, the slope, and the associated amplitude and phase. If quiet is True, it returns the values for the last quiet breakpoint. If there were no breakpoints today, return a series of zeros and create the file

Parameters:
  • la_station – Call-sign of the station of interest

  • la_date – Date of interest (e.g. ‘2023_11_05’)

  • path – path to where the results will be stored

  • quiet – Boolean, is True if we want the last quiet breakpoint, False otherwise (default: False)

  • check_yesterday – Boolean. If True, will get the last breakpoint of the previous day if needed (for file initialisation)

Returns:

Last time, slope, amplitude, phase, quiet and DP of the last breakpoint.

vlf4ions.manage_statefile.write_newbreakpoint(la_station, la_date, path, time_now, p1, amp, phase, quiet, DP)[source]

Update the state file by adding the new detected breakpoint. Note: because the function get_lastbreakpoint has been called earlier in the Realtimescript, there is no need to check that a file exist, or to create a new one

Parameters:
  • la_station – Station call-sign

  • la_date – Date of interest

  • path – path to where the results are stored

  • time_now – time when the data was last read

  • p1 – Last breakpoint slope

  • amp – Median amplitude over the last minute

  • phase – Median phase over the last minute

  • quiet – Boolean, is True if we are in quiet time, False otherwise

  • DP – Phase increase compared to its quiet time value

vlf4ions.manage_statefile.write_fluxestimate(best_guess, quiet, today, path, ending, nb_stations_on)[source]

Writes in a file the best guess for the flux estimation and informations about how it was computed. This includes the DP values for each stations as well as the ‘quiet’ flag for each station.

Parameters:
  • best_guess – Best estimate for the X-ray flux

  • quiet – quiet value. It is proportional to the number of transmitters for which a quiet value was detected. If it is equal to 0, all transmitters have detected a flare time

  • today – Datetime object, time in UT

  • path – Destination of the file

  • ending – Ending of the file name created

  • nb_stations_on – Number of working station at the time

vlf4ions.manage_statefile.write_file_with_df(stations, path_to_result)[source]

Write a file with the current df values for each station

Parameters:
  • stations – List of stations recorded

  • path_to_result – Path to the file which will be written