bglomb.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:OpenAPS 作者: medicinexlab 项目源码 文件源码
def _make_data_array_helper(bg_df, time_array, value_array, data_gap_start_time, data_gap_end_time, start_index, index, curr, last, num_extra_added, col_one_name, col_two_name, item_str):
    new_time = int((bg_df.iloc[index]['created_at'] - bg_df.iloc[start_index]['created_at']) / np.timedelta64(1, 'm'))
    new_value = bg_df.iloc[index][col_one_name][col_two_name][item_str]
    old_time = time_array[last]
    old_value = value_array[last]

    #If it is a data gap, store the start and stop time for later removal
    if new_time - old_time > MAX_DATA_GAP_MINUTES:
        data_gap_start_time.append(old_time)
        data_gap_end_time.append(new_time)

    #keep track of the curr value before passing into _fill_data_gaps
    start_curr = curr
    curr = _fill_data_gaps(old_time, new_time, old_value, new_value, time_array, value_array, curr)

    #Find the number of extra entries num_extra_added
    num_extra_added += curr - start_curr - 1
    last = curr - 1

    return time_array, value_array, data_gap_start_time, data_gap_end_time, curr, last, num_extra_added


#Function to make the data array for lomb-scargle given the bg_df dataframe, the start_index, the end_index, and the item_str, which is the column that you want to get
#Can put any start and end index as a parameter
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号