{"action":"opened","issue":{"url":"https://api.github.com/repos/jamos125/Trendy/issues/1","labels_url":"https://api.github.com/repos/jamos125/Trendy/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/jamos125/Trendy/issues/1/comments","events_url":"https://api.github.com/repos/jamos125/Trendy/issues/1/events","html_url":"https://github.com/jamos125/Trendy/issues/1","id":65824377,"number":1,"title":"bug in gentrends","user":{"login":"fraka6","id":142440,"avatar_url":"https://avatars.githubusercontent.com/u/142440?v=3","gravatar_id":"","url":"https://api.github.com/users/fraka6","html_url":"https://github.com/fraka6","followers_url":"https://api.github.com/users/fraka6/followers","following_url":"https://api.github.com/users/fraka6/following{/other_user}","gists_url":"https://api.github.com/users/fraka6/gists{/gist_id}","starred_url":"https://api.github.com/users/fraka6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fraka6/subscriptions","organizations_url":"https://api.github.com/users/fraka6/orgs","repos_url":"https://api.github.com/users/fraka6/repos","events_url":"https://api.github.com/users/fraka6/events{/privacy}","received_events_url":"https://api.github.com/users/fraka6/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-02T02:55:58Z","updated_at":"2015-04-02T02:55:58Z","closed_at":null,"body":"Hi Jacob,\r\n\r\nI found a small bug in gentrends. \r\nin your section\"# Find the indexes of these maxima in the data# Find the indexes of these maxima in the data\", you forget that the min or max value can be found before segment starting point.\r\nHere is the fix. \r\n\r\n# Implement trendlines\r\n    # Find the indexes of these maxima in the data\r\n    segments = int(segments)\r\n    maxima = np.ones(segments)\r\n    minima = np.ones(segments) \r\n    x_maxima = np.ones(segments)\r\n    x_minima = np.ones(segments)\r\n    segsize = int(len(y)/segments)\r\n    for i in range(1, segments+1):\r\n        ind2 = i*segsize\r\n        ind1 = ind2 - segsize\r\n        seg = y[ind1:ind2]\r\n        maxima[i-1] = max(seg)\r\n        minima[i-1] = min(seg)\r\n        x_maxima[i-1] = ind1 + (np.where(seg == maxima[i-1])[0][0])\r\n        x_minima[i-1] = ind1 + (np.where(seg == minima[i-1])[0][0])\r\n\r\nFrancis"}}