astropy / astropy/specreduce

FlatTrace: possible points of confusion when editing existing object

Open
#126 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
69
Forks
43
Avg merge
4d 22h
Merged PRs (30d)
3

Description

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?

Contributor guide

Open the contributing guide

Research direction

Start by reading FlatTrace and the behavior of Trace.shift shown in the example. Resolve a consistent editing contract for trace_pos and trace, including whether trace is writable, then verify the chosen behavior against the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.