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

shorten the desi_proc slurm and log filenames using new name convention #928

Merged
merged 3 commits into from Mar 20, 2020

Conversation

akremin
Copy link
Member

@akremin akremin commented Mar 20, 2020

Shorten filename of slurm scripts and log files for desi_proc using create_camword. Corresponding function decrypt_camword can convert back to a list of cameras/spectrographs.

create_camword(cameras):

    Function that takes in a list of cameras and creates a succinct listing                                                      
    of all spectrographs in the list with cameras. It uses "a" followed by                                                       
    numbers to mean that "all" (b,r,z) cameras are accounted for for those numbers.                                              
    b, r, and z represent the camera of the same name. All trailing numbers                                                      
    represent the spectrographs for which that camera exists in the list.                                                        
                                                                                                                                 
    Args:                                                                                                                        
       cameras (1-d array or list): iterable containing strings of                                                               
                                     cameras, e.g. 'b0','r1',...                                                                 
    Returns (str):                                                                                                               
       A string representing all information about the spectrographs/cameras                                                     
       given in the input iterable, e.g. a01234678b59z9   

decode_camword(camword):

    Function that takes in a succinct listing                                                                                    
    of all spectrographs and outputs a 1-d numpy array with a list of all                                                        
    spectrograph/camera pairs. It uses "a" followed by                                                                           
    numbers to mean that "all" (b,r,z) cameras are accounted for for those numbers.                                             
    b, r, and z represent the camera of the same name. All trailing numbers                                                     
    represent the spectrographs for which that camera exists in the list.                                                       
                                                                                                                                
    Args:                                                                                                                        
       camword (str): A string representing all information about the spectrographs/cameras           e.g. a01234678b59z9 
                   
    Returns (np.ndarray, 1d):  an array containing strings of cameras     e.g. 'b0','r1',...        

…reate_camword. Corresponding function decrypt_camword can convert back to a list of cameras/spectrographs
@akremin akremin requested a review from sbailey March 20, 2020 19:23
@sbailey
Copy link
Contributor

sbailey commented Mar 20, 2020

This looks good; I tried a bunch of combinations and wasn't able to break it, and confirmed that round trips create_camword -> decode_camword work.

Partially for practice, please add some unit tests to py/desispec/test/test_io.py to test that various combinations produce the expected results with missing cameras, full b/r/z sets, round trips of create_camword -> decode_camword -> create_camword work, etc.

Copy link
Contributor

@sbailey sbailey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks. Will merge once Travis finishes.

@sbailey sbailey merged commit 393f10f into master Mar 20, 2020
@sbailey sbailey deleted the shorten_camword branch March 20, 2020 23:16
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

Successfully merging this pull request may close these issues.

None yet

2 participants