@@ -897,6 +897,15 @@ def parse_new_metadata(metadata_file, observable_name, variant=None):
897897 return metadata
898898
899899
900+ def _check_if_statistical (col ):
901+ """Receives the header of a column of the uncertainties dataframe which includes:
902+ (name of the uncertainty, treatment, type)
903+ Returns true if and only if the column name stats with "stat",
904+ its treatment is additive and it is not correlated (type == UNCORR)
905+ """
906+ return col [0 ].lower ().startswith ("stat" ) and col [1 ] == "ADD" and col [2 ] == "UNCORR"
907+
908+
900909def load_commondata (metadata ):
901910 """
902911
@@ -936,9 +945,7 @@ def load_commondata(metadata):
936945 kin_df = metadata .load_kinematics ()
937946
938947 # Once we have loaded all uncertainty files, let's check how many sys we have
939- nsys = len (
940- [i for i in uncertainties_df .columns .get_level_values (0 ) if not i .startswith ("stat" )]
941- )
948+ nsys = len ([i for i in uncertainties_df .columns if not _check_if_statistical (i )])
942949
943950 # Backwards-compatibility
944951 # Finally, create the commondata by merging the dataframes in the old commondata_table
@@ -955,7 +962,7 @@ def load_commondata(metadata):
955962 new_columns = []
956963 systypes = {"treatment" : [], "name" : []}
957964 for col in uncertainties_df .columns :
958- if col [ 0 ]. startswith ( "stat" ):
965+ if _check_if_statistical ( col ):
959966 new_columns .append ("stat" )
960967 else :
961968 # if it is syst add the ADD/MULT information
0 commit comments