Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DL2 production with standard dark NSB models #275

Open
morcuended opened this issue Feb 7, 2024 · 1 comment
Open

DL2 production with standard dark NSB models #275

morcuended opened this issue Feb 7, 2024 · 1 comment

Comments

@morcuended
Copy link
Member

There is interest in resuming the DL2 production using the all-sky dark NSB standard MC. This will speed up the preliminary next-day analysis.

As an example, this is a piece of code that looks for the closest declination line. Should be integrated in lstosa

def convert_dec_string(dec_str):
    # Split the string into parts
    parts = dec_str.split('_')

    # Extract the sign, degrees, and minutes
    sign = 1 if 'min' not in parts else -1
    degrees = int(parts[-1])

    # Calculate the numerical value
    dec_value = sign * (degrees / 100)

    return dec_value  # deg


def get_corresponding_string(list1, list2):
    corresponding_dict = {}
    for index, element in enumerate(list2):
        corresponding_dict[element] = list1[index]
    return corresponding_dict


@click.command()
@click.option("--target-name", type=str, required=True)
def main(target_name: str):    
    source_coordinates = SkyCoord.from_name(target_name)
    
    dec_list = os.listdir("/fefs/aswg/data/mc/DL0/LSTProd2/TrainingDataset/Protons")
    config = paths_config.PathConfigAllSkyFull('all_decs', dec_list)
    
    
    # Convert each string in the list to numerical values
    dec_values = [convert_dec_string(dec) for dec in dec_list]
    
    # Print the resulting numerical values
    print("List of declinations:")
    for dec_str, dec_value in zip(dec_list, dec_values):
        print(f'{dec_str}: {dec_value}')

    print("\n")
    
    closest_declination = min(dec_values, key=lambda x: abs(x - source_coordinates.dec.value))
    
    print(f"The declination closest to {source_coordinates.dec.value:.2f} is: {closest_declination}")
    
    corresponding_dict = get_corresponding_string(dec_list, dec_values)
    corresponding_string = corresponding_dict[closest_declination]
    
    list_nodes = sorted(BASE_MODELS.rglob(corresponding_string), key=os.path.getmtime)

    print("\nPaths:")
    for path in list_nodes:
        print(path)
@moralejo
Copy link

moralejo commented Feb 7, 2024

I remember (unfortunately could not find any details) that we had some trouble when training with an MC line which culminated at larger zenith than the source being analyzed.
It is perhaps safer to take the closest declination line among those which culminate closer to zenith.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants