Ejemplo n.º 1
0
def test_redacted_consecutive_trips_od_matrix_column_names(
        get_column_names_from_run):
    assert get_column_names_from_run(
        RedactedConsecutiveTripsODMatrix(
            consecutive_trips_od_matrix=ConsecutiveTripsODMatrix(
                subscriber_locations=SubscriberLocations(
                    "2016-01-01 13:30:30", "2016-01-07 16:25:00")))) == [
                        "location_id_from", "location_id_to", "value"
                    ]
Ejemplo n.º 2
0
def test_consecutive_trips_od_matrix_counts(get_dataframe):
    """
    Values test for consecutive trips counts.
    """
    trips = ConsecutiveTripsODMatrix(subscriber_locations=SubscriberLocations(
        "2016-01-01 13:30:30", "2016-01-07 16:25:00"))
    df = get_dataframe(trips).set_index(["location_id_from", "location_id_to"])
    assert df.loc["0RIMKYtf", "ZOsVSeQS"].value == 17
    assert df.loc["0RIMKYtf", "YrCNbyNK"].value == 2
Ejemplo n.º 3
0
    def _flowmachine_query_obj(self):
        """
        Return the underlying flowmachine object.

        Returns
        -------
        Query
        """
        return RedactedConsecutiveTripsODMatrix(
            consecutive_trips_od_matrix=ConsecutiveTripsODMatrix(
                SubscriberLocations(
                    self.start_date,
                    self.end_date,
                    spatial_unit=self.aggregation_unit,
                    table=self.event_types,
                    subscriber_subset=self.subscriber_subset,
                    hours=self.hours,
                )))