ArfcnCorrelator

class sitchlib.ArfcnCorrelator(feed_dir, whitelist, power_threshold, device_id)[source]

The ArfcnCorrelator compares ARFCN metadata against feeds and threshold.

The feed data is put in place by the FeedManager class, prior to instantiating the ArfcnCorrelator.

classmethod arfcn_from_scan(scan_type, scan_doc)[source]

Pull the ARFCN from different scan types.

Parameters:
  • scan_type (str) – “kal_channel”, “gsm_modem_channel”, or “gps”.
  • scan_doc (dict) – Scan document
Returns:

ARFCN from scan, or None if scan is unrecognized or

unsupported.

Return type:

str

arfcn_over_threshold(arfcn_power)[source]

Compare the ARFCN power against the thresholdset on instantiation.

Parameters:arfcn_power (float) – If this isn’t a float already, it will be coerced to float.
Returns:True if arfcn_power is over threshold, False if not.
Return type:bool
compare_arfcn_to_feed(arfcn, site_name, sensor_name)[source]

Wrap other functions that dig into the FCC license DB.

This relies on the observed_arfcn instance variable for caching, to skip DB comparison, that way we (probably) won’t end up with a forever-increasing queue size.

Parameters:arfcn (str) – This is the text representation of the ARFCN we want to compare against the FCC license database.
Returns:
You get back a list of alerts as tuples, where position 0 is
’sitch_alert’ and position 1 is the actual alert.
Return type:list
correlate(scan_bolus)[source]

Entrypoint for correlation, wraps individual checks.

Parameters:scan_bolus (tuple) – Position 0 contains a string defining scan type. If it’s type ‘gps’, the geo_state instance variable will be updated with Position 1’s contents. If the scan type is ‘kal_channel’, we perform feed and threshold comparison. any other scan type will be compared against the feed only.
Returns:
Returns a list of alerts. If no alerts are generated, an
empty list is returned.
Return type:list
feed_alert_generator(arfcn, site_name, sensor_name)[source]

Wrap the yield_arfcn_from_feed function, and generates alerts.

Parameters:arfcn (str) – This is the string representation of the ARFCN to be correlated.
Returns:This returns a list of alert tuples.
Return type:list
classmethod is_in_range(item_gps, state_gps)[source]

Return True if items are within 40km.

manage_arfcn_lists(direction, arfcn, aspect)[source]

Manage the instance variable lists of ARFCNs.

This is necessary to maintain an accurate state over time, and reduce unnecessary noise.

Parameters:
  • direction (str) – Only will take action if this is “in” or “out”
  • arfcn (str) – This is the ARFCN that will be moved in or our of the list
  • aspect (str) – This is used to match the ARFCN with the list it should be moved in or out of. This should be either “threshold” or “not_in_range”.
match_arfcn_against_feed(arfcn, state_gps)[source]

Get a match for the ARFCN within range of the sensor.

Parameters:arfcn (str) – Absolute Radio Frequency Channel Number
Returns:True if there is an ARFCN in range, False if not.
Return type:bool