Exemple #1
0
def add_erroneous_drift_towards_a_value_to_sensor(sensor, probability_of_erroneous_reading, number_of_erroneous_points):
    """
	This function adds erroneous drift to a single sensor time series. 
	This function modifies the sensor's original time series.
	"""
    time_series = sensor.get_time_series()
    erroneous_reading = add_erroneous_drift_towards_a_value(
        time_series, probability_of_erroneous_reading, number_of_erroneous_points
    )
    sensor.set_time_series(erroneous_reading)
Exemple #2
0
def gather_time_series_from_sensors(lattice_of_sensors):
    """
	This function collects the time series from the sensors in the lattice.
	"""
    collection_of_time_series = []
    for group_of_sensors in lattice_of_sensors:
        for sensor in group_of_sensors:
            sensor_data = sensor.get_time_series()
            collection_of_time_series.append(sensor_data)
    return collection_of_time_series
Exemple #3
0
def add_erroneous_reading_to_sensor(sensor, probability_of_erroneous_reading, erroneous_reading_standard_deviation):
    """
	This function adds erroneous readings to a single sensor time series. 
	This function modifies the sensor's original time series.
	"""
    time_series = sensor.get_time_series()
    erroneous_reading = add_erroneous_reading_to_time_series(
        time_series, probability_of_erroneous_reading, erroneous_reading_standard_deviation
    )
    sensor.set_time_series(erroneous_reading)
Exemple #4
0
def add_continous_erroneous_reading_to_sensor(
    sensor, probability_of_erroneous_reading, number_of_continous_erroneous_readings
):
    """
	This function adds a sequence erroneous readings to a single sensor time series. 
	This function modifies the sensor's original time series.
	"""
    time_series = sensor.get_time_series()
    erroneous_reading = add_erroneous_continuous_sequence_to_time_series(
        time_series, probability_of_erroneous_reading, number_of_continous_erroneous_readings
    )
    sensor.set_time_series(erroneous_reading)
	def change_sensor_time_series_to_rare_series(sensor, loudness_of_the_area, start_index, end_index):
		sensor_time_series = sensor.get_time_series()

		cropped_sensor_time_series = crop_time_series(sensor_time_series, start_index, end_index)
		cropped_rare_event_song = crop_time_series(rare_event_song, start_index, end_index)

		merged_series = tstools.merge_series([cropped_rare_event_song, cropped_sensor_time_series], 
		[loudness_of_the_area, 1])

		new_series = sensor_time_series[:]
		#to append previous valus to the new time series
		for i in range(len(merged_series)):
			new_series[start_index + i] = merged_series[i]

		new_series = tstools.normalize_to_range(new_series, 1.0) #normalize to 1
		sensor.set_time_series(new_series)
def add_erroneous_drift_towards_a_value_to_sensor(sensor, 
	probability_of_erroneous_reading, number_of_erroneous_points, 
	random_generator):
	"""
	This function adds erroneous drift to a single sensor time series. 
	This function modifies the sensor's original time series.
	"""
	time_series = sensor.get_time_series()

	erroneous_reading = \
	error_generator.add_erroneous_drift_towards_a_value(time_series, 
		probability_of_erroneous_reading, number_of_erroneous_points, 
		random_generator)

	#normalize
	erroneous_reading = tstools.normalize_to_range(erroneous_reading, 1.0) 
	sensor.set_time_series(erroneous_reading)
	return erroneous_reading
def add_erroneous_reading_to_sensor(sensor, 
	probability_of_erroneous_reading, 
	erroneous_reading_standard_deviation, warmup_time, random_generator):
	"""
	This function adds erroneous readings to a single sensor time series. 
	This function modifies the sensor's original time series.
	"""
	time_series = sensor.get_time_series()
	erroneous_reading, number_of_errors_inserted, \
	list_of_errors_inserted = \
	error_generator.add_erroneous_reading_to_time_series(time_series, 
		probability_of_erroneous_reading, 
		erroneous_reading_standard_deviation, warmup_time, 
		random_generator)
	
	#normalize to be between 0 and 1
	erroneous_reading = tstools.normalize_to_range(erroneous_reading, 1.0) 
	sensor.set_time_series(erroneous_reading)
	return erroneous_reading, number_of_errors_inserted, list_of_errors_inserted
def add_continous_erroneous_reading_to_sensor(sensor, 
	probability_of_erroneous_reading, 
	number_of_continous_erroneous_readings, warmup_time, 
	random_generator):
	"""
	This function adds a sequence erroneous readings to a single sensor 
	time series. This function modifies the sensor's original 
	time series.
	"""
	time_series = sensor.get_time_series()
	
	erroneous_reading = \
	error_generator.add_erroneous_continuous_sequence_to_time_series(
		time_series, probability_of_erroneous_reading, 
		number_of_continous_erroneous_readings, warmup_time, 
		random_generator)

	erroneous_reading = tstools.normalize_to_range(erroneous_reading, 1.0)
	sensor.set_time_series(erroneous_reading)
	return erroneous_reading
	def change_sensor_time_series_to_rare_series(sensor, loudness_of_the_area):
		sensor_time_series = sensor.get_time_series()
		new_series = merge_series([rare_event_song, sensor_time_series], 
		[loudness_of_the_area, 1])
		new_series = normalize_to_range(new_series, 1.0) #normalize to 1
		sensor.set_time_series(new_series)