def __init__(self,
                 name,
                 soma_map,
                 soma_config,
                 minute_interval,
                 window_interval,
                 collection="occurrence_rates"):
        self.topo_map = None
        self.soma_map = soma_map
        self.soma_config = soma_config
        self.minute_interval = minute_interval
        self.window_interval = window_interval
        self.rotm = RegionObservationTimeManager(soma_map, soma_config)
        self.tre = TrajectoryRegionEstimate(soma_map, soma_config,
                                            minute_interval)
        self.tof = TrajectoryOccurrenceFrequencies(
            soma_map,
            soma_config,
            minute_interval=minute_interval,
            window_interval=window_interval)
        self.gs = GeoSpatialStoreProxy('geospatial_store', 'soma')

        rospy.loginfo("Connect to database collection %s..." % collection)
        self._ms = MessageStoreProxy(collection=collection)
        self._soma_db = MessageStoreProxy(collection="soma_roi")
        rospy.loginfo("Create a service %s/service..." % name)
        self.service = rospy.Service(name + '/service',
                                     TrajectoryOccurrenceRate, self.srv_cb)
        rospy.loginfo("Create an action server %s..." % name)
        self._as = actionlib.SimpleActionServer(name,
                                                OccurrenceRateLearningAction,
                                                execute_cb=self.execute,
                                                auto_start=False)
        self._as.start()
Exemple #2
0
 def __init__(self,
              soma_map,
              soma_config,
              minute_interval=1,
              window_interval=10):
     """
         Initialise analysis for trajectory periodicity.
         Initialise trajectory occurrence frequencies from database.
     """
     self.tof = TrajectoryOccurrenceFrequencies(soma_map, soma_config,
                                                minute_interval,
                                                window_interval)
     self.periodic_type = self.tof.periodic_type
     self.length_of_periodicity = len(self.tof.periodic_days)
     self.minute_interval = minute_interval
     self.window_interval = window_interval
     self.tof.load_tof()
     self.tof = self.tof.tof
     self.regions = self.tof.keys()
     self.spectrum_selection = 0
     self.addition_technique = True
    def __init__(self, soma_map, soma_config, minute_interval=1, window_interval=10):
        """
            Initialize plotting, it needs the name of the soma map, specific soma configuration,
            the minute interval between two different occurrence rate, and the window interval that
            acts as bins.
        """
        self.tof = TrajectoryOccurrenceFrequencies(soma_map, soma_config, minute_interval, window_interval)
        self.xticks = time_ticks(minute_interval, window_interval, self.tof.periodic_type)
        self.x = np.arange(len(self.xticks))
        self.minute_interval = minute_interval
        self.window_interval = window_interval
        self.periodic_length = len(self.tof.periodic_days)
        self.tof.load_tof()
        self.tof = self.tof.tof
        self.regions = self.tof.keys()
        self.colors = [
            (0., 0., 0.), (0., 0., 1.), (0., 1., 0.), (0., 1., 1.),
            (1., 0., 0.), (1., 0., 1.), (1., 1., 0.), (.75, .75, .75),
            (0., 0., 0.), (0., 0., .5), (0., .5, 0.), (0., .5, .5),
            (.5, 0., 0.), (.5, 0., .5), (.5, .5, 0.), (.25, .25, .25)

        ]