Skip to content

Commit

Permalink
Remove a mutable default and correct mapping usage to allow tuple map…
Browse files Browse the repository at this point in the history
…pings
  • Loading branch information
erogers-dstl committed May 5, 2020
1 parent 5478aaa commit b52a273
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions stonesoup/feeder/geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ class LongLatToUTMConverter(Feeder):
"""

mapping = Property(
[float, float], default=[0, 1],
doc="Indexes of long, lat. Default [0, 1]")
(float, float), default=(0, 1),
doc="Indexes of long, lat. Default (0, 1)")
zone_number = Property(
int, default=None,
doc="UTM zone number to carry out conversion. Default `None`, where it"
Expand All @@ -109,7 +109,7 @@ def detections_gen(self):
utm_detections = set()
for detection in detections:
easting, northing, zone_num, northern = utm.from_latlon(
*detection.state_vector[self.mapping[::-1]],
*detection.state_vector[self.mapping[::-1], :],
self.zone_number)
if self.zone_number is None:
self.zone_number = zone_num
Expand Down
6 changes: 3 additions & 3 deletions stonesoup/models/measurement/nonlinear.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def inverse_function(self, detection, **kwargs):
xyz = inv_rotation_matrix @ xyz

res = np.zeros((self.ndim_state, 1)).view(StateVector)
res[self.mapping] = xyz + self.translation_offset
res[self.mapping, :] = xyz + self.translation_offset

return res

Expand Down Expand Up @@ -355,7 +355,7 @@ def inverse_function(self, detection, **kwargs):
xy = xyz[0:2]

res = np.zeros((self.ndim_state, 1)).view(StateVector)
res[self.mapping] = xy + self.translation_offset
res[self.mapping, :] = xy + self.translation_offset

return res

Expand Down Expand Up @@ -503,7 +503,7 @@ def function(self, state, noise=False, **kwargs):
noise = 0

# Account for origin offset
xyz = state.state_vector[self.mapping] - self.translation_offset
xyz = state.state_vector[self.mapping, :] - self.translation_offset

# Rotate coordinates
xyz_rot = self._rotation_matrix @ xyz
Expand Down

0 comments on commit b52a273

Please sign in to comment.