Skip to content
Snippets Groups Projects
Commit d8d87c7d authored by Julian Rüstig's avatar Julian Rüstig
Browse files

multi: make field names more robust

In case that two pointings are different but have the same field identifier,
the beam creation would have siliently exchanged the field ids.
Now, a unique pointing will get its own field id.
parent 65be715e
No related branches found
No related tags found
1 merge request!50Draft: Mosaic imaging
...@@ -75,6 +75,20 @@ def _filter_pointings_generator(observations): ...@@ -75,6 +75,20 @@ def _filter_pointings_generator(observations):
yield obs yield obs
def _create_field_name(
ii: int,
observation: Observation,
beam_directions: dict
) -> str:
field_name = observation.direction.name
field_name = f'fld_{ii:04}' if field_name == '' else field_name
if field_name in beam_directions:
field_name = f"{field_name}_{ii}"
return field_name
def build_sky_beamer( def build_sky_beamer(
sky_domain: ift.DomainTuple, sky_domain: ift.DomainTuple,
sky_center: SkyCoord, sky_center: SkyCoord,
...@@ -135,8 +149,7 @@ def build_sky_beamer( ...@@ -135,8 +149,7 @@ def build_sky_beamer(
beam = ift.makeField(sky_domain, beam) beam = ift.makeField(sky_domain, beam)
field_name = oo.direction.name field_name = _create_field_name(ii, oo, beam_directions)
field_name = f'fdl_{ii:03}' if field_name == '' else field_name
beam_directions[field_name] = dict( beam_directions[field_name] = dict(
dx=dx, dy=dy, beam=beam, direction=oo.direction) dx=dx, dy=dy, beam=beam, direction=oo.direction)
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment