Keck-DataReductionPipelines / KAI

Keck AO Imaging DRP
https://keck-datareductionpipelines.github.io/KAI/
7 stars 10 forks source link

Bug with directories when running reduce.go() #5

Closed dchu808 closed 2 years ago

dchu808 commented 2 years ago

I found a bug when running reduce.go() regarding the directory structure of the data. When running in the reduce/ directory, it looks for data in the following raw/ directory, which it thinks is in the reduce/ directory: 20aug23os/reduce/raw/

When I change to the above directory 20aug23os/, reduce.go() is able to run through the IMCOMBINE step and make a sky file. However, it then looks for the file in the following location: 20aug23os/kp/calib/masks/supermask.fits, which should be in the reduce/ directory (and more specifically, the reduce/kp/calib/masks/ directory.

Thanks for the help!

abhimat commented 2 years ago

Hi Devin, can you share a copy of your reduce template script? It would be helpful to debug this to see exactly how the keywords are called in your example to cause this bug

dchu808 commented 2 years ago

Hi Abhimat, sure that's a good idea. I'm attaching the code I have in a .txt file since I don't think I can attach the original .py version. Hopefully this works. reduce_template_osiris.txt

abhimat commented 2 years ago

I think the issue is that the following lines to manually make and switch to a filter directory are no longer necessary when calling the clean(), calcStrehl(), and the combine() functions. These functions internally take care of the necessary directory creation now, and no longer require the user to do this themself. Can you try running your script by removing the following lines and see if it works?

    util.mkdir('kp')
    # os.chdir('../')
    os.chdir('kp')
    os.chdir('../')

If this works, then we should remove these manual directory creation lines if they exist in any of the example scripts included in the repo

abhimat commented 2 years ago

Also, just to clarify, all reduction scripts are designed to be run in the reduce/ directory

dchu808 commented 2 years ago

Thank you! After removing these directory related lines, go() was able to run without the directory issues. I think that solved it. I can remove these lines from the code in the repository.