Keck-DataReductionPipelines / KCWI_DRP

KCWI python DRP
BSD 3-Clause "New" or "Revised" License
9 stars 14 forks source link

Confusion of the correct trace when reducing multiple instrument configurations simultaneously #136

Open yuguangchen1 opened 2 years ago

yuguangchen1 commented 2 years ago

Hi!

There is a bug about which trace table to use when multiple instrument configurations are reduced together.

In "ExtractArcs.py", the following code is causing the issue:

        if hasattr(self.context, 'trace'):
            trace = self.context.trace
        else:
            trace = read_table(
                input_dir=os.path.join(self.config.instrument.cwd,
                                       self.config.instrument.output_directory),
                file_name=original_filename)
            self.context.trace = {}
            for key in trace.meta.keys():
                self.context.trace[key] = trace.meta[key]

This is fine when only one instrument configuration is used. However, when multiple configurations are reduced at the same time, self.context.trace is overwritten by another configuration before it is used to extract arcs. Therefore, the trace tables should always be read from the directory.

We provide a hotfix at: https://github.com/prusinski/KCWI_DRP/commit/16ca8e8dac2b5ae5f7ca71c880f94feb90718991