API Views Reference

class Nagios
critical = (2, 'CRITICAL')
ok = (0, 'OK')
unknown = (3, 'UNKNOWN')
warning = (1, 'WARNING')
clusters(request, country_number=None)

Get cluster list

Retrieve a list of all clusters or only the clusters in a specific country. By cluster we here mean the main clusters, which contain subclusters.

Parameters:country_number – a country number identifier, give this to only get clusters from a specific country.
Returns:list of dictionaries containing the name and number of all clusters that matched the given parameters.
config(request, station_number, year=None, month=None, day=None)

Get station config settings

Retrieve the entire configuration of a station. If no date if given the latest config will be sent, otherwise the latest on or before the given date.

Parameters:
  • station_number – a station number identifier.
  • year – the year part of the date.
  • month – the month part of the date.
  • day – the day part of the date.
Returns:

dictionary containing the entire configuration from the HiSPARC DAQ.

countries(request)

Get country list

Retrieve a list of all countries.

Returns:list of dictionaries containing the name and number of all countries.
errfunc(p, t, y)

Distance to the target function

gauss(x, N, m, s)

Gaussian function for fitting

get_cluster_dict(country=None)
get_country_dict()
get_event_traces(request, station_number, ext_timestamp)

Get the traces for an event

Parameters:
  • station_number – a station number identifier.
  • ext_timestamp – extended timestamp (nanoseconds since UNIX epoch).
  • raw – (optional, GET) if present get the raw trace, i.e. without subtracted baseline.
Returns:

two or four traces.

get_pulseheight_drift(request, station_number, plate_number, year, month, day, number_of_days)

Get pulseheight drift

Parameters:
  • station_number – station number
  • plate_number – detector number, either 1, 2, 3 or 4.
  • year,month,day – date for which to check.
  • number_of_days – number of days over which to determine drift.
get_pulseheight_drift_last_14_days(request, station_number, plate_number)
get_pulseheight_drift_last_30_days(request, station_number, plate_number)
get_pulseheight_fit(request, station_number, plate_number, year=None, month=None, day=None)

Get fit values of the pulseheight distribution for a station on a date

Retrieve fit values of the pulseheight distribution. The fitting has to be done before and stored somewhere. This function retrieves the fit values from storage and returns to the client. Returns an error meesage if the values are not found on storage.

Parameters:
  • station_number – a station number identifier.
  • plate_number – plate number in the range 1..4
  • year – the year part of the date.
  • month – the month part of the date.
  • day – the day part of the date.
Returns:

dictionary containing fit results of the specified station, plate and date

get_station_dict(subcluster=None)

Return list of station numbers and names

For all non-test stations in the given subcluster

get_subcluster_dict(cluster=None)
has_data(request, station_number, type=None, year=None, month=None, day=None)

Check for presence of cosmic ray data

Find out if the given station has measured shower data, either on a specific date, or at all.

Parameters:
  • station_number – a stationn number identifier.
  • type – the data type, either events or weather.
  • year,month,day – the date, this has to be within the time HiSPARC has been operational and can be as specific as you desire.
Returns:

boolean, True if the given station has data, False otherwise.

json_dict(dict)

Create a json HTTPResponse

linear_fit(p, t)

Simple linear function for fitting

man(request)

Give overview of the possible urls

num_events(request, station_number, year=None, month=None, day=None, hour=None)

Get number of events for a station

Retrieve the number of events that a station has measured during its entire operation or during a specific period, which can be a year, month, day or an hour.

Parameters:
  • station_number – a stationn number identifier.
  • year,month,day,hour – the date, this has to be within the time HiSPARC has been operational and can be as specific as you desire.
Returns:

integer containing the total number of events ever recorded by the given station.

station(request, station_number, year=None, month=None, day=None)

Get station info

Retrieve general information about a station. If no date if given the latest valid info will be sent, otherwise the latest on or before the given date.

Parameters:
  • station_number – a station number identifier.
  • year – the year part of the date.
  • month – the month part of the date.
  • day – the day part of the date.
Returns:

dictionary containing info about the station. Most importantly, this contains information about the location of the station GPS and the relative locations of the individual scintillators.

stations(request, subcluster_number=None)

Get station list

Retrieve a list of all stations or all stations in a subcluster.

Parameters:subcluster_number – a subcluster number identifier. If given, only stations belonging to that subcluster will be included in the list.
Returns:list containing dictionaries which consist of the name and number of each station (matching the subcluster).
stations_with_data(request, type=None, year=None, month=None, day=None)

Get stations with event or weather data

Retrieve a list of all stations which have recorded events or weather data in the given year, month, day or at all.

Parameters:
  • type – data type to check for, either weather or events.
  • year,month,day – the date, this has to be within the time HiSPARC has been operational and can be as specific as you desire.
Returns:

list of dictionaries containing the name and number of each station that has measured weather data in the given year.

subclusters(request, cluster_number=None)

Get subcluster list

Retrieve a list of all subclusters or all subclusters in a specific cluster.

Parameters:cluster_number – a cluster number identifier, give this to only get subclusters from this cluster.
Returns:list of dictionaries containing the name and number of all subclusters that matched the given parameters.
validate_date(date)

Check if date is outside HiSPARC project range

If not valid, a 404 (Not Found) should be returned to the user.

Returns:boolean, True if the date is in the range, False otherwise.

Contents: