def set_snapshot_weights(ratio_dict,
orig_rng,
eg_range):
'''Determine the job distribution ratios to carry forward during
the ratio condition application period using actual jobs held ratios.
likely called at implementation month by main job assignment function
Count the number of jobs held by each of the ratio groups for each of the
affected job level numbers. Set the weightings in the distribute function
accordingly.
inputs
ratio_dict (dictionary)
dictionary containing job levels as keys and ratio groups,
weightings, month_start and month end as values.
orig_rng (numpy array)
month slice of original job array
eg_range (numpy array)
month slice of employee group code array
'''
ratio_dict = copy.deepcopy(ratio_dict)
job_nums = list(ratio_dict.keys())
for job in job_nums:
wgt_list = []
for ratio_group in ratio_dict[job][0]:
wgt_list.append(np.count_nonzero((orig_rng == job) &
(np.in1d(eg_range, ratio_group))))
ratio_dict[job][1] = tuple(wgt_list)
return ratio_dict
# ASSIGN JOBS BY RATIO CONDITION
评论列表
文章目录