Misc improvements from N. Besch and P. Jamaux

Benoit Seignovert requested to merge besch-feedback-implementation into main

Closes #9 and #79.

Added

  • Add new utc_range, utc_ranges and utc_ca_range functions analog to et_range, et_ranges and et_ca_range:
>>> utc_range('2033-01-01T00:00:00', '2033-JAN-01 00:00:10', '5 sec')
array(['2033-01-01T00:00:00.000', '2033-01-01T00:00:05.000', '2033-01-01T00:00:10.000'], dtype='datetime64[ms]')
  • New AU unit and au_ticks ticker, with an extended example on the gallery to illustrated how to use it:

Cruise trajectory example

>>> from planetary_coverage.ticks import AU

>>> AU
149,597,870.7  # [km]
  • New math dist function:
>>> from planetary_coverage.math import dist

>>> dist([1, 0, 0], [-1, 0, 0])
2
  • Add scatter plot in equirectangular map prohection:
fig = plt.figure(figsize=(15, 10))
ax = fig.add_subplot(projection=EUROPA)

ax.scatter(flyby, 'inc', s=flyby.alt / 1e2, vmin=0, vmax=90, cmap='turbo_r', cbar=True)

image

  • Add ax.set_view() to zoom on a given area (with/without margins):
fig = plt.figure(figsize=(6, 6))
ax = fig.add_subplot(projection=CALLISTO)

ax.add_patch(roi)

ax.set_view(221.5, 229.5, 40, 46.5, margin=15)  # lon_e_0, lon_e_1, lat_0, lat_1 + 15 % margin

image

It is also possible to do ax.set_view(roi) to zoom on the ROI directly. The same method can be used with any Trajectory object.

  • ax.set_xlim() and ax.set_ylim() now reset the longitude and latitude ticks grid automatically.

Fixes

  • Raise ValueError when stop time is before start time:
>>> tour['2000-01-01':'1999-01-01']
ValueError: Stop time (1999-01-01) should be after start time (2000-01-01)
  • Get a single point value if start time is equal to stop time:
>>> tour['2000-01-01':'2000-01-01']
<SpacecraftTrajectory> Observer: JUICE | Target: GANYMEDE
 - UTC start time: 2000-01-01T00:00:00.000
 - UTC stop time: 2000-01-01T00:00:00.000
 - Nb of pts: 1
  • Temporal numpy array can now be used in TourConfig (raised error before):
tour[np.array(['2000-01-01', '2000-01-02'])]

锔 Warning: numpy mixed type array requires to have an explicit dtype='object':

tour[np.array([123, '2000-01-02'], dtype='object')]
  • Fix km_ticks for large values, eg. 100,000,000 km instead of 1e+07 km before:

Ticks with large values

  • Fix angle function for null vector:
>>> angle([1, 0, 0], [0, 0, 0])
0  # 90 before
  • B茅zier curves control points are replaced by regular polygons (before / after):

image image

The contour of the patch is not correctly reproduced but in most case, the different should be small enough. See this comment for more details.

  • ROI no longer requires to have an explicit name (remove Unnamed default value):
>>> ROI('Amset', lons_e=[180, 180, 185, 185], lats=[-18, -14, -14, -18])
<ROI> Amset
 - Lons E: [180, 180, 185, 185]
 - Lats: [-18, -14, -14, -18]
  • Fix text clipping outside the view area.

  • Fix Juice case in the docs instead of JUICE.

Edited by Benoit Seignovert

Merge request reports