mrghg / agage-archive

Code for producing AGAGE archival files
MIT License
3 stars 0 forks source link

integer check for get_instrument_type fails for int8 #79

Closed joe-pitt closed 3 months ago

joe-pitt commented 3 months ago

In definitions.py the functions get_instrument_type() and get_instrument_number() check for an integer using: isinstance(instrument_numbers, int) This returns false for np.int8, which is what is you get from: instrument_numbers = list(np.unique(ds_combined.instrument_type.values))[0] in the combination code in io.py

Need to work out another comparison... This is separate to issue #77

joe-pitt commented 3 months ago

I am using numpy v1.26.4 in case that is relevant here.

joe-pitt commented 3 months ago

Changing get_instrument_type to this works:

    # If instrument_numbers is a list, return a list of strings
    if isinstance(instrument_numbers, list):
        instrument_type = [k for k, v in instrument_number.items() if v in instrument_numbers]
    else:
        instrument_type = [k for k, v in instrument_number.items() if v == instrument_numbers][0]

    return instrument_type

But then we lose the test, so it might not be ideal

mrghg commented 3 months ago

Fixed in #81