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

user facing bit packing routine pseudocode #18

Open
sdtaylor opened this issue Sep 8, 2021 · 1 comment
Open

user facing bit packing routine pseudocode #18

sdtaylor opened this issue Sep 8, 2021 · 1 comment
Labels

Comments

@sdtaylor
Copy link
Owner

sdtaylor commented Sep 8, 2021

outlines for functions to reverse unpack_to_array and unpack_to_dict()

def pack_from_dict(flag_dict, product, num_bits):
    """
    Where keys are flag names, values are arrays all the same shape. 
    product is a custom product spec. num_bits should be 8,16, or 32
    """
    
    qa_array = np.empty(shaped like input, dtyp = product[numbits])
    
    for flag in products:
        if 1 bit:
            qa_array[flag_bit] = qa_dict[flag]
    
        if > 1 bit:
            # ie. take an array of possible values 0,1,2,3 and convert to two bits.
            temp_qa_array = unpackbits(qa_dict(flag))
            for ii in bits:
                qa_array[flag_bit] = temp_qa_array[flag_bit] # or something like that
@sdtaylor sdtaylor added the notes label Sep 8, 2021
@sdtaylor
Copy link
Owner Author

maybe have a validate flag here, where no checking is done in input so that it's slightly faster.

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

No branches or pull requests

1 participant