Ejemplo n.º 1
0
 def _getTimeSeries(self):
     if self.data_source == 'instagram':
         its = InstagramTimeSeries(self.region, self.data_backward, self.current_time)
     elif self.data_source == 'twitter':
         pass
     ts = its.buildTimeSeries()
     return ts
Ejemplo n.º 2
0
def run():
    coordinates = [InstagramConfig.photo_min_lat,
            InstagramConfig.photo_min_lng,
            InstagramConfig.photo_max_lat,
            InstagramConfig.photo_max_lng
                 ]
    huge_region = Region(coordinates)
    
    alarm_region_size = 25

    regions = huge_region.divideRegions(alarm_region_size,alarm_region_size)
    filtered_regions = huge_region.filterRegions( regions)
    
    regions = filtered_regions
    test_cnt = 0
    print 'all regions',len(regions)
    for region in regions:
        #delete the last 7*24*3600 to set it back to Dec 1st
        start_of_time =  1354320000 #+ 7*24*3600
        end_of_time = 1354320000 + 7*24*3600 #+ 7*24*3600
        series =  InstagramTimeSeries( region, start_of_time, end_of_time)
        series =  series.buildTimeSeries()
        region.display()
        for t in series.index:
            print t,',',series[t]
        print '\n'
Ejemplo n.º 3
0
def run():
    coordinates = [
        InstagramConfig.photo_min_lat, InstagramConfig.photo_min_lng,
        InstagramConfig.photo_max_lat, InstagramConfig.photo_max_lng
    ]
    huge_region = Region(coordinates)

    alarm_region_size = 25

    regions = huge_region.divideRegions(alarm_region_size, alarm_region_size)
    filtered_regions = huge_region.filterRegions(regions)

    regions = filtered_regions
    test_cnt = 0
    print 'all regions', len(regions)
    for region in regions:
        #delete the last 7*24*3600 to set it back to Dec 1st
        start_of_time = 1354320000  #+ 7*24*3600
        end_of_time = 1354320000 + 7 * 24 * 3600  #+ 7*24*3600
        series = InstagramTimeSeries(region, start_of_time, end_of_time)
        series = series.buildTimeSeries()
        region.display()
        for t in series.index:
            print t, ',', series[t]
        print '\n'
Ejemplo n.º 4
0
    def _computeVariation(self):
        values = [0]*24
        ts = InstagramTimeSeries(self.region, self.training_start_time, self.training_end_time)
        instagram_ts = ts.buildTimeSeries()
        M = np.zeros([1000,24])
        initial_date = instagram_ts.index[0]
        for idx in instagram_ts.index:
            if not pd.isnull( instagram_ts[idx] ):
                day_dif = (idx - initial_date).days
                M[day_dif, idx.hour] = instagram_ts[idx]
        max_day = (instagram_ts.index[len(instagram_ts)-1] - initial_date ).days

        M = M[0:max_day, :]
        return np.mean(M, axis=0), np.std(M,axis=0)
Ejemplo n.º 5
0
    def _computeVariation(self):
        values = [0] * 24
        ts = InstagramTimeSeries(self.region, self.training_start_time,
                                 self.training_end_time)
        instagram_ts = ts.buildTimeSeries()
        M = np.zeros([1000, 24])
        initial_date = instagram_ts.index[0]
        for idx in instagram_ts.index:
            if not pd.isnull(instagram_ts[idx]):
                day_dif = (idx - initial_date).days
                M[day_dif, idx.hour] = instagram_ts[idx]
        max_day = (instagram_ts.index[len(instagram_ts) - 1] -
                   initial_date).days

        M = M[0:max_day, :]
        return np.mean(M, axis=0), np.std(M, axis=0)