def get_smc_sample_iter(filename):
    """Returns the iteration number of an SMC filename"""
    if filename.endswith(".smc.gz"):
        filename = filename[:-len(".smc.gz")]
    elif filename.endswith(".gz"):
        filename = filename[:-len(".gz")]
    i = filename.rindex(".")
    return int(filename[i+1:])