3.3. czelta.station

class czelta.station

Class for working with station data. On import it tries to load config_data.JSON (in python lib path and after failture in local directory.

example:

>>> import czelta
>>> #load data about stations, default try to load config_data.JSON
>>> czelta.station.load(open('config_data.JSON'))
>>> #get some station
>>> some_station = czelta.station(5)
>>> print("station name is %s"%some_station.name())
station name is kladno_sps
>>> praha_utef = czelta.station("praha_utef")
>>> print("id of praha_utef is %i"%praha_utef.id())
id of praha_utef is 6
>>> #prints distance between stations
>>> distance = praha_utef.distance_to(some_station)
>>> print("distance of %s to praha_utef is %f metres"%(some_station.name(), distance))
distance of kladno_sps to praha_utef is 24347.04590484944 metres
static load(file = open("config_data.JSON"), format)

Loads configuration file of stations. Must be called if you want to work with czelta.station.

static save(file, _format)

Save current configuration in use. Main usage is with fitting TDC. Formatting of original file is not preserved, stations are just ordered by ID.

static get_stations()

Return list of all available stations.

static clear_config()

Removes complete configuration.

id

Return station id, probably same as on czelta website.

name

Return code name of station. Example: 'praha_utef', 'pardubice_gd' or similar.

detector_position

Return position of detectors in format (x1, y1, x2, y2) where x1 and y1 are relative position of detector 1 to detector 0. x2 and y2 are relative position of detector 2 to detector 0. All values are in metres. Y+ is targeting to North and X+ is targeting to East.

gps_position

Returns GPS position of station. Return (latitude, longitude) or None if gps_position is not defined.

distance_to(other_station)

Calculate distance to other station using haversine method. The return number is in metres.

autofit_corrections(eventreader, confidence_level=0.0001, instability=25)

Automatically fits TDC corrections based on EventReader. For best effect, data should be downloaded for full measure time of station.

It works by calculating correction for each run (few days in most cases) and decide if it should be merged with previous aggregation based on statistical testing if hypotheses that run corrections is same as previous aggregation. Testing of hypotheses is based on two-sample normal distribution test.

confidence_level is float between 1 and 0, bigger values indicates, that smaller change in means triggers corrections split. Smaller values means, that it less sensitive (but because it’s based on Student’s distribution even really small values are enough sensitive). Default value is 0.01% (= 0.0001).

instability is value, which specifies allowed fluctiations. Differences difference in means are lowered by instability and then they are processed by statistics. To disable it choose 0. Default value is 25.