def _write_table(self, data_out, table): # if any non-numeric independent variables, use bins of unit width and centred on integers (1, 2, 3, etc.) for ii, independent_variable in enumerate(table.independent_variables): if False in ObjectWrapper.is_number_var(independent_variable): for i, value in enumerate(independent_variable['values']): table.independent_variables[ii]['values'][i] = { 'low': i + 0.5, 'high': i + 1.5 } table_num = str(table.index) if self.hepdata_doi: table_doi = 'doi:' + self.hepdata_doi + '/t' + table_num else: table_doi = table.name f = ObjectFactory(self.class_list, table.independent_variables, table.dependent_variables) for idep, graph in enumerate(f.get_next_object()): rivet_identifier = 'd' + table_num.zfill(2) + '-x01-y' + str( idep + 1).zfill(2) # Allow the standard Rivet identifier to be overridden by a custom value specified in the qualifiers. if 'qualifiers' in table.dependent_variables[idep]: for qualifier in table.dependent_variables[idep]['qualifiers']: if qualifier['name'] == 'Custom Rivet identifier': rivet_identifier = qualifier['value'] rivet_path = '/REF/' + self.rivet_analysis_name + '/' + rivet_identifier graph.setTitle(table_doi) graph.setPath(rivet_path) graph.setAnnotation('IsRef', '1') yoda.core.writeYODA(graph, data_out) data_out.write('\n')
def _write_table(self, data_out, table): data_out.mkdir(table.name) data_out.cd(table.name) # if no independent variables, use bins of unit width and centred on integers (1, 2, 3, etc.) if not table.independent_variables and table.dependent_variables: if table.dependent_variables[0]['values']: table.independent_variables.append({'header': {'name': 'Bin number'}, 'values': []}) for i, value in enumerate(table.dependent_variables[0]['values']): table.independent_variables[0]['values'].append({'low': i+0.5, 'high': i+1.5}) # if any non-numeric independent variable values, use bins of unit width and centred on integers (1, 2, 3, etc.) # store original variables as alphanumeric labels to be passed to ROOT histograms for ii, independent_variable in enumerate(table.independent_variables): if False in ObjectWrapper.is_number_var(independent_variable): independent_variable_bins = \ {'header': {'name': independent_variable['header']['name'] + ' bin'}, 'values': [], 'labels': []} for i, value in enumerate(independent_variable['values']): independent_variable_bins['values'].append({'low': i + 0.5, 'high': i + 1.5}) if 'value' in value: independent_variable_bins['labels'].append(str(value['value'])) else: independent_variable_bins['labels'].append(str(value['low']) + '-' + str(value['high'])) table.independent_variables[ii] = independent_variable_bins if self.hepdata_doi: table_doi = 'doi:' + self.hepdata_doi + '/t' + str(table.index) else: table_doi = table.name f = ObjectFactory(self.class_list, table.independent_variables, table.dependent_variables) for graph in f.get_next_object(): graph.SetTitle(table_doi) graph.Write()
def _write_table(self, data_out, table): data_out.mkdir( table.name.replace('/', '-').replace('$', '').replace('\\', '')) data_out.cd( table.name.replace('/', '-').replace('$', '').replace('\\', '')) # if no independent variables, use bins of unit width and centred on integers (1, 2, 3, etc.) if not table.independent_variables and table.dependent_variables: if table.dependent_variables[0]['values']: table.independent_variables.append({ 'header': { 'name': 'Bin number' }, 'values': [] }) for i, value in enumerate( table.dependent_variables[0]['values']): table.independent_variables[0]['values'].append({ 'low': i + 0.5, 'high': i + 1.5 }) # if any non-numeric independent variable values, use bins of unit width and centred on integers (1, 2, 3, etc.) # store original variables as alphanumeric labels to be passed to ROOT histograms for ii, independent_variable in enumerate(table.independent_variables): if False in ObjectWrapper.is_number_var(independent_variable): independent_variable_bins = \ {'header': {'name': independent_variable['header']['name'] + ' bin'}, 'values': [], 'labels': []} for i, value in enumerate(independent_variable['values']): independent_variable_bins['values'].append({ 'low': i + 0.5, 'high': i + 1.5 }) if 'value' in value: independent_variable_bins['labels'].append( str(value['value'])) else: independent_variable_bins['labels'].append( str(value['low']) + '-' + str(value['high'])) table.independent_variables[ii] = independent_variable_bins if self.hepdata_doi: table_doi = 'doi:' + self.hepdata_doi + '/t' + str(table.index) else: table_doi = table.name f = ObjectFactory(self.class_list, table.independent_variables, table.dependent_variables) for graph in f.get_next_object(): graph.SetTitle(table_doi) graph.Write()
def _write_table(self, data_out, table): # if any non-numeric independent variables, use bins of unit width and centred on integers (1, 2, 3, etc.) for ii, independent_variable in enumerate(table.independent_variables): if False in ObjectWrapper.is_number_var(independent_variable): for i, value in enumerate(independent_variable['values']): table.independent_variables[ii]['values'][i] = {'low': i + 0.5, 'high': i + 1.5} table_num = str(table.index) if self.hepdata_doi: table_doi = 'doi:' + self.hepdata_doi + '/t' + table_num else: table_doi = table.name f = ObjectFactory(self.class_list, table.independent_variables, table.dependent_variables) for idep, graph in enumerate(f.get_next_object()): graph.title = table_doi graph.path = '/REF/' + self.rivet_analysis_name + '/' \ + 'd' + table_num.zfill(2) + '-x01-y' + str(idep + 1).zfill(2) graph.setAnnotation('IsRef', '1') yoda.core.writeYODA(graph, data_out)