def get_reference_data(self): # super(LayeSite, self).get_reference_data(reference_type) reference_bins = OrderedDict([('Age Bin', self.metadata['age_bins']), ('PfPR Bin', self.metadata['parasitemia_bins'])]) reference_data = season_channel_age_density_json_to_pandas( self.reference_dict, reference_bins).reset_index() reference_data = reference_data.rename(columns={'Season': 'Date'}) reference_data['Date'] = reference_data['Date'].apply( lambda x: list(self.metadata['seasons_by_month'].keys())[ self.metadata['seasons_by_month'].values().index(x)]) reference_data['Date'] = reference_data['Date'].apply( lambda x: (list(calendar.month_name).index(x) - 1) * 30 + 15) reference_data = reference_data.sort( ['Channel', 'Date', 'Age Bin', 'PfPR Bin']) counts_tot_list = list( reference_data.groupby(['Channel', 'Date', 'Age Bin'])['Counts'].apply(np.sum)) counts_tot = [[a] * len(self.metadata['parasitemia_bins']) for a in counts_tot_list] reference_data['Counts_tot'] = [ item for sublist in counts_tot for item in sublist ] reference_data['Counts'] = reference_data.groupby( ['Channel', 'Date', 'Age Bin'])['Counts'].apply(lambda x: x / float(x.sum())) return reference_data, self.metadata
def get_reference_data(self, reference_type): super(DapelogoCalibSite, self).get_reference_data(reference_type) reference_bins = OrderedDict([('Age Bin', self.metadata['age_bins']), ('PfPR Bin', self.metadata['parasitemia_bins'])]) reference_data = season_channel_age_density_json_to_pandas( self.reference_dict, reference_bins) return reference_data