[FIBERALLOC-38] Run ets_fiber_assigner iteratively to avoid trajectory collisions Created: 17/Dec/20 Updated: 19/Jun/22 Resolved: 19/Jun/22 |
|
| Status: | Won't Fix |
| Project: | Target to fiber allocation and configuration |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Normal |
| Reporter: | Martin Reinecke | Assignee: | chyan |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | EngRun | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Description |
|
Currently the ets_fiber_assigner only avoids endpoint collisions of cobra tips with other tips or elbows. By running a provisional solution through the the collision simulator from ics_cobraOps, we can detect trajectory collisions as well. With this information, we can add constraints that disallow simultaneous observation of the problematic paits of targets and re-run the fiber assignment step. There are a few caveats to this approach that need to be kept in mind:
|
| Comments |
| Comment by Martin Reinecke [ 17/Dec/20 ] |
|
A first implementation is available on the branch tickets/ mxhf , it would be great if you could have a look! At the moment, I'm re-running the entire assignment if trajectory collisions are detected. Shortcuts may be possible, but have the potential to introduce further complications. My hope is that, at least once we switch to radial moves, trajectory collisions will be extremely rare, so that we might be able to afford to do the full recomputation. |
| Comment by mxhf [ 17/Dec/20 ] |
|
just checked it out .... Works well. Though with the new XML I do get an error in the simulator.
Optimal solution found (tolerance 1.00e-04) Best objective 8.190310002886e+11, best bound 8.190310002886e+11, gap 0.0000% Checking for trajectory collisions /Users/mxhf/.pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/ics.cobraOps-0.0.0-py3.6.egg/ics/cobraOps/CobraGroup.py:186: RuntimeWarning: invalid value encountered in true_divide /Users/mxhf/.pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/ics.cobraOps-0.0.0-py3.6.egg/ics/cobraOps/CobraGroup.py:186: RuntimeWarning: invalid value encountered in arccos /Users/mxhf/.pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/ics.cobraOps-0.0.0-py3.6.egg/ics/cobraOps/CobraGroup.py:314: RuntimeWarning: divide by zero encountered in true_divide /Users/mxhf/.pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/ics.cobraOps-0.0.0-py3.6.egg/ics/cobraOps/CobraGroup.py:314: RuntimeWarning: invalid value encountered in true_divide /Users/mxhf/.pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/ics.cobraOps-0.0.0-py3.6.egg/ics/cobraOps/CobraGroup.py:314: RuntimeWarning: invalid value encountered in arccos /Users/mxhf/.pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/ics.cobraOps-0.0.0-py3.6.egg/ics/cobraOps/CobraGroup.py:315: RuntimeWarning: invalid value encountered in true_divide /Users/mxhf/.pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/ics.cobraOps-0.0.0-py3.6.egg/ics/cobraOps/CobraGroup.py:315: RuntimeWarning: invalid value encountered in arccos --------------------------------------------------------------------------- ValueError Traceback (most recent call last) ~/ownCloudRZG/work/MPE/pfs/src/ets_fiberalloc/demo_netflow_ASIAA.py in <module> 139 140 simulator = CollisionSimulator(bench, TargetGroup(selectedTargets, ids)) --> 141 simulator.run() 142 if np.any(simulator.endPointCollisions): 143 print("ERROR: detected end point collision, which should be impossible")
~/.pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/ics.cobraOps-0.0.0-py3.6.egg/ics/cobraOps/CollisionSimulator.py in run(self, solveCollisions) 96 97 # Calculate the cobra trajectories ---> 98 self.calculateTrajectories() 99 100 # Detect cobra collisions during the trajectory
~/.pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/ics.cobraOps-0.0.0-py3.6.egg/ics/cobraOps/CollisionSimulator.py in calculateTrajectories(self) 267 finalFiberPositions=self.finalFiberPositions, 268 movementDirections=self.movementDirections, --> 269 movementStrategies=self.movementStrategies) 270 271
~/.pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/ics.cobraOps-0.0.0-py3.6.egg/ics/cobraOps/TrajectoryGroup.py in _init_(self, nSteps, stepWidth, bench, finalFiberPositions, movementDirections, movementStrategies) 72 73 # Calculate the cobra trajectories ---> 74 self.calculateCobraTrajectories() 75 76
~/.pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/ics.cobraOps-0.0.0-py3.6.egg/ics/cobraOps/TrajectoryGroup.py in calculateCobraTrajectories(self) 138 initOffset = np.pi + startPhi[c] if posPhiMovement[c] else np.abs(startPhi[c]) 139 stepLimits = np.interp([initOffset, initOffset + np.abs(deltaPhi[c])], phiOffsets, phiSteps) --> 140 stepMoves = np.concatenate((np.arange(stepLimits[0], stepLimits[1], self.stepWidth), [stepLimits[1]])) 141 phiMoves = np.interp(stepMoves, phiSteps, phiOffsets) 142 phiMoves = phiMoves - np.pi if posPhiMovement[c] else -phiMoves
ValueError: arange: cannot compute length
|
| Comment by jgracia [ 24/Dec/20 ] |
|
Hi, I updated the cobraOps master branch and now it should work with the new XML files. Use this demo as an example: https://github.com/Subaru-PFS/ics_cobraOps/blob/master/python/ics/demos/demo2.py Note that now some cobras have problems, so they are not moved and remain in the home position in simulation. You can use bench.cobras.hasProblem to get the cobras with problems.
Another thing is that I constrain the cobras phi angle to be between -pi and 0. Otherwise the (x,y) --> (tht, phi) calculation is degenerate and it requires a more clever way to calculate it. cobraCharmer can handle these situations, but I didn't implement it yet in the simulator code, so I force the phi angle to be between -pi and 0.
I hope it now works! |
| Comment by jgracia [ 24/Dec/20 ] |
|
I forgot to add that some cobras have very long link lengths. I guess it's a measure problem, but it creates a lot of trajectory collisions.
And finally, I didn't implement yet the radial moves, so the simulator will predict more collisions than with the radial move. |
| Comment by mxhf [ 27/Dec/20 ] |
|
Thank you very much for fixing this Javier & Martin! @Javier: demo2 works on my machine, only I noticed a new dependency on ics_cobraCharmer. For this ticket: I just committed to
Please check the attached allocations file as first version for ASIAA. It was generated with the following commands. > python target_generator.py --plot -o data/test_sci.dat -r 100000 mv output.txt pfi_alloc_test_20201227.txt
|
| Comment by mxhf [ 29/Dec/20 ] |
|
The most recent netflow_asiaa.py now also writes a PfsDesign fits file. This is an example (pfsdesign_test_20201228.fits Max |
| Comment by mxhf [ 11/Jan/21 ] |
|
This images corroborates the issue in the most recent 2020-10-15-theta-slow.xml I think.
Max
|
| Comment by Martin Reinecke [ 08/Mar/21 ] |
|
mxhf I'm currently working at turning the PFSDesign I/O into library functions. So far I'm making good progress; output is more or less done (thanks to your work in demo_asiaa.py!), but for the input I'm wondering where we are supposed to get the exposure times from... The pfsDesign file describes telescope pointing and orientation, but not the observation duration. Any ideas? |
| Comment by yuki.moritani [ 16/Mar/22 ] |
|
Recently this ticked was discussed at the informal meeting between ASIAA, Hassan and PO. By the time of November run, Martin and Max implemented a functionality to write pfsDesign. Some of pfsDesign files were made using (the most) latest version of pfs_utils after the Nov run (and after fixing a few Bug.)
/work/pfs/ets/kiyoyabe/test_2022jan/fiber_allocation/commissioning/design 0x65d65dc76164ff80 --> agcc_20211120_0424219 0x0514a60eadf01a87 --> agcc_20211120_2042567 0x47dcd57b6af5aa53 --> agcc_20211120_2057506 0x5d2e53852a8d7d35 --> agcc_20211120_2254174 0x691e373818a88a23 --> agcc_20211120_2303420 0x0513dafb2d419f9f --> agcc_20211121_1831017 0x316c25cd18ca62b2 --> agcc_20211121_2331497 chyan could you try either 0x5d2e53852a8d7d35 or 0x316c25cd18ca62b2? They are several science targets. Most of the cobras are not assigned, but I hope it is OK to test.. (If not, let's have one.) |
| Comment by hassan [ 10/Jun/22 ] |
|
This will be closed based on testing done during the May Eng Run. |
| Comment by chyan [ 19/Jun/22 ] |
|
The design file generated and populated in system is always checked by ETS. Therefore I would close this ticket. If there is any other problem, we should open another ticket to address the question. |