Replace ZERO with NaN for heatmap

replace/61c25077fe6afd63434712b64a49557916030cec
Meng Li 2019-12-17 17:07:35 -05:00
parent 545d8a5ffe
commit 96394a0468
2 changed files with 7 additions and 1 deletions

View File

@ -37,5 +37,8 @@ else:
phone_sensed_bins = phone_sensed_bins.resample("1D").asfreq().fillna(0)
# get dates and compliance_matrix
dates, compliance_matrix = getDatesComplianceMatrix(phone_sensed_bins)
# convert compliance_matrix from list to np.array and replace 0 with np.nan
compliance_matrix = np.asarray(compliance_matrix)
compliance_matrix = np.where(compliance_matrix == 0, np.nan, compliance_matrix)
# get heatmap
getComplianceHeatmap(dates, compliance_matrix, pid, snakemake.output[0], bin_size)

View File

@ -1,4 +1,5 @@
import pandas as pd
import numpy as np
import plotly.io as pio
import plotly.graph_objects as go
import datetime
@ -57,4 +58,6 @@ else:
# Create heatmap
hourly_row_count = getComplianceMatrix(dates, resampled_hourly_bins)
hourly_row_count = np.asarray(hourly_row_count)
hourly_row_count = np.where(hourly_row_count == 0, np.nan, hourly_row_count)
getHourlyRowCountHeatmap(dates, hourly_row_count, sensor_name, pid, snakemake.output[0])