@@ -113,8 +113,7 @@ def __init__(self, data1=None, data2=None, cids1=None, cids2=None):
113113
114114 if (wcs1 .world_axis_physical_types .count (None ) == wcs1 .world_n_dim or
115115 wcs2 .world_axis_physical_types .count (None ) == wcs2 .world_n_dim ):
116- raise IncompatibleWCS ("Can't create WCS link between {0} and {1}" .format (data1 .label , data2 .label ))
117-
116+ raise IncompatibleWCS (f"Can't create WCS link between { data1 .label } and { data2 .label } " )
118117
119118 forwards = backwards = None
120119 if wcs1 .pixel_n_dim == wcs2 .pixel_n_dim and wcs1 .world_n_dim == wcs2 .world_n_dim :
@@ -133,8 +132,6 @@ def __init__(self, data1=None, data2=None, cids1=None, cids2=None):
133132 self ._physical_types_1 = wcs1 .world_axis_physical_types
134133 self ._physical_types_2 = wcs2 .world_axis_physical_types
135134
136-
137-
138135 if not forwards or not backwards :
139136 # A generalized APE 14-compatible way
140137 # Handle also the extra-spatial axes such as those of the time and wavelength dimensions
@@ -173,14 +170,15 @@ def __init__(self, data1=None, data2=None, cids1=None, cids2=None):
173170 wcs2_sliced_physical_types = wcs2_celestial_physical_types
174171
175172 for i , physical_type1 in enumerate (wcs1 .world_axis_physical_types ):
176- for j , physical_type2 in enumerate (wcs2 .world_axis_physical_types ):
177- if physical_type1 == physical_type2 :
178- if physical_type1 not in wcs1_sliced_physical_types :
179- slicing_axes1 .append (wcs1 .world_n_dim - i - 1 )
180- wcs1_sliced_physical_types .append (physical_type1 )
181- if physical_type2 not in wcs2_sliced_physical_types :
182- slicing_axes2 .append (wcs2 .world_n_dim - j - 1 )
183- wcs2_sliced_physical_types .append (physical_type2 )
173+ if physical_type1 is not None :
174+ for j , physical_type2 in enumerate (wcs2 .world_axis_physical_types ):
175+ if physical_type1 == physical_type2 :
176+ if physical_type1 not in wcs1_sliced_physical_types :
177+ slicing_axes1 .append (wcs1 .world_n_dim - i - 1 )
178+ wcs1_sliced_physical_types .append (physical_type1 )
179+ if physical_type2 not in wcs2_sliced_physical_types :
180+ slicing_axes2 .append (wcs2 .world_n_dim - j - 1 )
181+ wcs2_sliced_physical_types .append (physical_type2 )
184182
185183 slicing_axes1 = sorted (slicing_axes1 , key = str , reverse = True )
186184 slicing_axes2 = sorted (slicing_axes2 , key = str , reverse = True )
@@ -215,7 +213,7 @@ def __init__(self, data1=None, data2=None, cids1=None, cids2=None):
215213 self ._physical_types_2 = wcs2_sliced_physical_types
216214
217215 if pixel_cids1 is None :
218- raise IncompatibleWCS ("Can't create WCS link between {0 } and {1}" . format ( data1 . label , data2 .label ) )
216+ raise IncompatibleWCS (f "Can't create WCS link between { data1 . label } and { data2 .label } " )
219217
220218 super (WCSLink , self ).__init__ (pixel_cids1 , pixel_cids2 ,
221219 forwards = forwards , backwards = backwards )
@@ -243,8 +241,7 @@ def description(self):
243241 'two datasets using the World Coordinate System (WCS) '
244242 'coordinates defined in the files.<br><br>The physical types '
245243 'of the coordinates linked in the first dataset are: '
246- '<ul>{0}</ul>and in the second dataset:<ul>{1}</ul>'
247- .format (types1 , types2 ))
244+ f'<ul>{ types1 } </ul>and in the second dataset:<ul>{ types2 } </ul>' )
248245
249246 def as_affine_link (self , n_samples = 1000 , tolerance = 1 ):
250247 """
0 commit comments