1

First a bit of background.This is a problem that we are facing while making the software pipeline of a newly launched spacecraft. The telescopes on board are looking at a specific target. However as you might expect the the telescope is not exactly stable an wobbles slightly. Hence at different time instants it is looking at SLIGHTLY different portions of the sky.

To fix for this we have a lab made template (basically a 2-d array of zeros and ones) that tells us which portion of the sky is being looked at a specific time instant(lets say t). It looks like this.

Template

Here the white portion signifies the part of the telescope that is actually observing. This array is actually 2400x2400(for accuracy. Cant be reduced because it will cause loss of information. Also it is not an array of 0s and 1s, but instead real numbers because of other effects). Now knowing the wobbles of the telescope, we also know that this template will wobble by the same amount. Hence we need to shift(using np.roll) the array in either by x or y direction(sometimes even rotate if the spacecraft is rotating) accordingly and accumulate(so that we know which portion of the sky has been observed for how long. However this process is EXTREMELY time consuming and lengthy(even with numpy implementation of add and roll). Moreover we need to do this in the pipeline at least 500 times a second. Is there a way to avoid it ? We are looking for an algorithmic solution maybe a fundamentally new way of approaching the whole problem. Any help is welcome. Also if any part is unclear let me know. I will happily explain it further. A previous question related to the same topic: Click Here

We are implementing the pipeline in python(I know a bad choice probably)

Community
  • 1
  • 1
Anirban Dutta
  • 195
  • 2
  • 11

1 Answers1

0

If you want to use shifted array contents for some calculation (apply mask etc), you don't need to move it physically - just use modified index scheme to address the same elements.

For example, to virtually shift array by dx to the right, use in calculations A[y][x-dx] instead of A[y][x]

This method becomes some more complex when rotation takes place, but still solvable (one should compare time for real array rotation and coordinate recalculations)

MBo
  • 77,366
  • 5
  • 53
  • 86