Realizing an update cycle

class PyAstronomy.pyaC.pyaPermanent.PyAUpdateCycle(fn, section, updateCycle=7)

A simple data update cycle.

This class provides a simple way to realize an update cycle for data, which need to be re-initialized periodically.

Parameters
fnstring

The name of the file (within PyAFS), which is used to store the settings.

sectionstring

The section within the config file used to store the settings.

updateCyclefloat or int

The number of days defining the update cycle.

Methods

changeDownloadCycle(c)

Change the time after which the data are updated.

dataAge()

Determine the "age" of the data.

needsUpdate()

Determine whether data need to be updated.

changeDownloadCycle(c)

Change the time after which the data are updated.

By default, the data will be updated if they are older than the given update cycle. This method allows you to change that cycle.

Parameters
cfloat or None

The new update cycle in days. If None is provided, updating is switched off.

dataAge()

Determine the “age” of the data.

Returns
agefloat

The time since last data update in days. None, if no age can be determined, e.g., if data have never been downloaded.

needsUpdate()

Determine whether data need to be updated.

Returns
Update flagboolean

True if data need update and False otherwise.