# pointpats.SpaceTimeEvents

class pointpats.SpaceTimeEvents(path, time_col, infer_timestamp=False)

  Method for reformatting event data stored in a shapefile for use in calculating metrics of spatio-temporal interaction.

  Parameters:
    path string

      the path to the appropriate shapefile, including the file name and extension

    time string

      column header in the DBF file indicating the column containing the time stamp.

    infer_timestamp bool, optional

      if the column containing the timestamp is formatted as calendar dates, try to coerce them into Python datetime objects (the default is False).

  Examples

  Read in the example shapefile data, ensuring to omit the file extension. In order to successfully create the event data the .dbf file associated with the shapefile should have a column of values that are a timestamp for the events. This timestamp may be a numerical value or a date. Date inference was added in version 1.6.

      >>> import libpysal as lps
      >>> path = lps.examples.get_path("burkitt.shp")
      >>> from pointpats import SpaceTimeEvents

  Create an instance of SpaceTimeEvents from a shapefile, where the temporal information is stored in a column named “T”.

      >>> events = SpaceTimeEvents(path,'T')

  See how many events are in the instance.

      >>> events.n
      188

  Check the spatial coordinates of the first event.

      >>> events.space[0]
      array([300., 302.])

  Check the time of the first event.

      >>> events.t[0]
      array([413.])

  Calculate the time difference between the first two events.

      >>> events.t[1] - events.t[0]
      array([59.])

  New, in 1.6, date support: Now, create an instance of SpaceTimeEvents from a shapefile, where the temporal information is stored in a column named “DATE”.

      >>> events = SpaceTimeEvents(path,'DATE')

  See how many events are in the instance.

      >>> events.n
      188

  Check the spatial coordinates of the first event.

      >>> events.space[0]
      array([300., 302.])

  Check the time of the first event. Note that this value is equivalent to 413 days after January 1, 1900.

      >>> events.t[0][0]
      datetime.date(1901, 2, 16)

  Calculate the time difference between the first two events.

      >>> (events.t[1][0] - events.t[0][0]).days
      59

  Attributes:
    n int

      number of events.

    x array

      (n, 1), array of the x coordinates for the events.

    y array

      (n, 1), array of the y coordinates for the events.

    t array

      (n, 1), array of the temporal coordinates for the events.

    space array

      (n, 2), array of the spatial coordinates (x,y) for the events.

    time array

      (n, 2), array of the temporal coordinates (t,1) for the events, the second column is a vector of ones.

  __init__(path, time_col, infer_timestamp=False)

  Methods

  `__init__`(path, time_col[, infer_timestamp]) |