pyuvdata
                                
                                 pyuvdata copied to clipboard
                                
                                    pyuvdata copied to clipboard
                            
                            
                            
                        speed up _key2inds
Right now the limiting factor in accessing the data quickly is looking up the indices corresponding to a given key. This would be substantially reduced if we can store the key -> index mapping, rather than computing it every time it's needing.
Should be cached as it is called, not on read.
Also might be faster to assign everything once rather than searching through the baseline array for each key.
We might be able to use functools.lru_cache to generate a cache of key to ind values. then we can have a function that just clears the cache of keys whenever the state of the object changes (add, read, select, etc)
the cache I mentioned before will not work for us because the UVData object itself is unhashable.
I have tried this successfully on a branch, but it would just add another dependency. https://pypi.org/project/memoization/