add function to check timesteps in numpy date array
This commit is contained in:
parent
5c499bebee
commit
689aed305e
8
drees.py
8
drees.py
@ -547,6 +547,13 @@ def plot_bar_vaccine_status_distribution_by_age_field(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def check_timestep(np_date: np.ndarray):
|
||||||
|
# get the difference between each element (return timedelta64 array)
|
||||||
|
np_diff = np.diff(np_date)
|
||||||
|
# check if all timestep are equals
|
||||||
|
assert np.all(np_diff == np_diff[0]), "some timesteps missing !"
|
||||||
|
|
||||||
|
|
||||||
def get_age_vac_args() -> List[Tuple[AgeGroup, VacStatus]]:
|
def get_age_vac_args() -> List[Tuple[AgeGroup, VacStatus]]:
|
||||||
"""
|
"""
|
||||||
build pool age and vac status arguments
|
build pool age and vac status arguments
|
||||||
@ -669,6 +676,7 @@ if __name__ == "__main__":
|
|||||||
np_data, np_date = get_np_data(dic_data)
|
np_data, np_date = get_np_data(dic_data)
|
||||||
|
|
||||||
lst_analyse_data = analyse(np_data)
|
lst_analyse_data = analyse(np_data)
|
||||||
|
check_timestep(np_date)
|
||||||
|
|
||||||
if not args.no_plot:
|
if not args.no_plot:
|
||||||
os.makedirs(OUTPUT_REPOSITORY, exist_ok=True)
|
os.makedirs(OUTPUT_REPOSITORY, exist_ok=True)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user