Skip to content

FlatTrace: possible points of confusion when editing existing object #126

Open
@kecnry

Description

@kecnry

For example, shifting edits the internal trace, but not trace_pos, but changes to trace_pos and trace do not affect each other:

from specreduce.utils.synth_data import make_2dspec_image
from specreduce.tracing import FlatTrace

img = make_2dspec_image()

trace = FlatTrace(img, 10)
print(trace.trace_pos, trace.trace[0])
# 10, 10

trace_shifted = trace + 10
print(trace_shifted.trace_pos, trace_shifted.trace[0])
# 10, 20

trace_shifted.trace_pos = 15
print(trace_shifted.trace_pos, trace_shifted.trace[0])
# 10, 20

Updating the trace_pos during a shift (or addition) can be done easily by overloading Trace.shift. Do we also want to implement a setter on the trace_pos attribute to update trace.trace? What about vice-versa? Or do we make trace.trace read-only and require any edits to be by setting trace_pos or shifting?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions