icecube-skyreader 1.3.1__tar.gz → 1.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. {icecube-skyreader-1.3.1 → icecube-skyreader-1.3.2}/PKG-INFO +1 -1
  2. {icecube-skyreader-1.3.1 → icecube-skyreader-1.3.2}/icecube_skyreader.egg-info/PKG-INFO +1 -1
  3. {icecube-skyreader-1.3.1 → icecube-skyreader-1.3.2}/skyreader/__init__.py +1 -1
  4. {icecube-skyreader-1.3.1 → icecube-skyreader-1.3.2}/skyreader/plot/plot.py +36 -32
  5. {icecube-skyreader-1.3.1 → icecube-skyreader-1.3.2}/skyreader/plot/plotting_tools.py +3 -3
  6. {icecube-skyreader-1.3.1 → icecube-skyreader-1.3.2}/LICENSE +0 -0
  7. {icecube-skyreader-1.3.1 → icecube-skyreader-1.3.2}/README.md +0 -0
  8. {icecube-skyreader-1.3.1 → icecube-skyreader-1.3.2}/icecube_skyreader.egg-info/SOURCES.txt +0 -0
  9. {icecube-skyreader-1.3.1 → icecube-skyreader-1.3.2}/icecube_skyreader.egg-info/dependency_links.txt +0 -0
  10. {icecube-skyreader-1.3.1 → icecube-skyreader-1.3.2}/icecube_skyreader.egg-info/requires.txt +0 -0
  11. {icecube-skyreader-1.3.1 → icecube-skyreader-1.3.2}/icecube_skyreader.egg-info/top_level.txt +0 -0
  12. {icecube-skyreader-1.3.1 → icecube-skyreader-1.3.2}/setup.cfg +0 -0
  13. {icecube-skyreader-1.3.1 → icecube-skyreader-1.3.2}/setup.py +0 -0
  14. {icecube-skyreader-1.3.1 → icecube-skyreader-1.3.2}/skyreader/event_metadata.py +0 -0
  15. {icecube-skyreader-1.3.1 → icecube-skyreader-1.3.2}/skyreader/plot/__init__.py +0 -0
  16. {icecube-skyreader-1.3.1 → icecube-skyreader-1.3.2}/skyreader/py.typed +0 -0
  17. {icecube-skyreader-1.3.1 → icecube-skyreader-1.3.2}/skyreader/result.py +0 -0
  18. {icecube-skyreader-1.3.1 → icecube-skyreader-1.3.2}/skyreader/utils/__init__.py +0 -0
  19. {icecube-skyreader-1.3.1 → icecube-skyreader-1.3.2}/skyreader/utils/areas.py +0 -0
  20. {icecube-skyreader-1.3.1 → icecube-skyreader-1.3.2}/skyreader/utils/handle_map_data.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: icecube-skyreader
3
- Version: 1.3.1
3
+ Version: 1.3.2
4
4
  Summary: An API for Results Produced by SkyDriver & the Skymap Scanner
5
5
  Home-page: https://github.com/icecube/skyreader
6
6
  Download-URL: https://pypi.org/project/icecube-skyreader/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: icecube-skyreader
3
- Version: 1.3.1
3
+ Version: 1.3.2
4
4
  Summary: An API for Results Produced by SkyDriver & the Skymap Scanner
5
5
  Home-page: https://github.com/icecube/skyreader
6
6
  Download-URL: https://pypi.org/project/icecube-skyreader/
@@ -17,7 +17,7 @@ __all__ = [
17
17
  # is zero for an official release, positive for a development branch,
18
18
  # or negative for a release candidate or beta (after the base version
19
19
  # number has been incremented)
20
- __version__ = "1.3.1"
20
+ __version__ = "1.3.2"
21
21
  version_info = (
22
22
  int(__version__.split(".")[0]),
23
23
  int(__version__.split(".")[1]),
@@ -626,8 +626,7 @@ class SkyScanPlotter:
626
626
  contour_colors,
627
627
  contours_by_level
628
628
  ):
629
- contour_label = contour_label + ' - area: {0:.2f} sqdeg'.format(
630
- contour_area_sqdeg)
629
+ contour_label = contour_label + f' - area: {contour_area_sqdeg:.2f} sqdeg'
631
630
  first = True
632
631
  for contour in contours:
633
632
  theta, phi = contour.T
@@ -746,7 +745,7 @@ class SkyScanPlotter:
746
745
  # convert to square-degrees
747
746
  bounding_contour_area *= (180.*180.)/(np.pi*np.pi)
748
747
  contour_label = r'90% Bounding rectangle' + \
749
- ' - area: {0:.2f} sqdeg'.format(bounding_contour_area)
748
+ f' - area: {bounding_contour_area:.2f} sqdeg'
750
749
  healpy.projplot(
751
750
  bounding_theta,
752
751
  bounding_phi,
@@ -755,30 +754,6 @@ class SkyScanPlotter:
755
754
  linestyle='dashed',
756
755
  label=contour_label
757
756
  )
758
- # Output contours in RA, dec instead of theta, phi
759
- saving_contours: list = []
760
- for contours in contours_by_level:
761
- saving_contours.append([])
762
- for contour in contours:
763
- saving_contours[-1].append([])
764
- theta, phi = contour.T
765
- ras = phi
766
- decs = np.pi/2 - theta
767
- for tmp_ra, tmp_dec in zip(ras, decs):
768
- saving_contours[-1][-1].append([tmp_ra, tmp_dec])
769
- # Save the individual contours, send messages
770
- for i, val in enumerate(["50", "90"]):
771
- ras = list(np.asarray(saving_contours[i][0]).T[0])
772
- decs = list(np.asarray(saving_contours[i][0]).T[1])
773
- tab = {"ra (rad)": ras, "dec (rad)": decs}
774
- savename = unique_id + ".contour_" + val + ".txt"
775
- try:
776
- LOGGER.info("Dumping to {savename}")
777
- ascii.write(tab, savename, overwrite=True)
778
- except OSError:
779
- LOGGER.error(
780
- "OS Error prevented contours from being written, "
781
- "maybe a memory issue. Error is:\n{err}")
782
757
 
783
758
  uncertainty = [(ra_minus, ra_plus), (dec_minus, dec_plus)]
784
759
  fits_header = format_fits_header(
@@ -835,11 +810,6 @@ class SkyScanPlotter:
835
810
  linestyle=cont_sty
836
811
  )
837
812
  plt.legend(fontsize=6, loc="lower left")
838
- # Dump the whole contour
839
- path = unique_id + ".contour.pkl"
840
- print("Saving contour to", path)
841
- with open(path, "wb") as f:
842
- pickle.dump(saving_contours, f)
843
813
 
844
814
  # save flattened map
845
815
  equatorial_map, column_names = prepare_flattened_map(
@@ -878,6 +848,40 @@ class SkyScanPlotter:
878
848
  bbox_inches='tight'
879
849
  )
880
850
 
851
+ self._save_contours(contours_by_level, unique_id)
881
852
  LOGGER.info("done.")
882
853
 
883
854
  plt.close()
855
+
856
+ def _save_contours(self, contours_by_level, unique_id) -> None:
857
+ # Output contours in RA, dec instead of theta, phi
858
+ saving_contours: list = []
859
+ for contours in contours_by_level:
860
+ saving_contours.append([])
861
+ for contour in contours:
862
+ saving_contours[-1].append([])
863
+ theta, phi = contour.T
864
+ ras = phi
865
+ decs = np.pi/2 - theta
866
+ for tmp_ra, tmp_dec in zip(ras, decs):
867
+ saving_contours[-1][-1].append([tmp_ra, tmp_dec])
868
+
869
+ # Save the individual contours
870
+ for i, val in enumerate(["50", "90"]):
871
+ ras = list(np.asarray(saving_contours[i][0]).T[0])
872
+ decs = list(np.asarray(saving_contours[i][0]).T[1])
873
+ tab = {"ra (rad)": ras, "dec (rad)": decs}
874
+ savepath = self.output_dir / f"{unique_id}.contour_{val}.txt"
875
+ try:
876
+ LOGGER.info(f"Dumping to {savepath}")
877
+ ascii.write(tab, savepath, overwrite=True)
878
+ except OSError:
879
+ LOGGER.error(
880
+ "OS Error prevented contours from being written, "
881
+ "maybe a memory issue. Error is:\n{err}")
882
+
883
+ # Dump the whole contour
884
+ path = self.output_dir / f"{unique_id}.contour.pkl"
885
+ print("Saving contour to", path)
886
+ with open(path, "wb") as f:
887
+ pickle.dump(saving_contours, f)
@@ -33,7 +33,7 @@ def format_fits_header(
33
33
  ('EVENTID', event_id),
34
34
  ('SENDER', 'IceCube Collaboration'),
35
35
  ('EventMJD', mjd),
36
- ('I3TYPE', '%s'%event_type,'Alert Type'),
36
+ ('I3TYPE', f'{event_type}','Alert Type'),
37
37
  ('RA', np.round(ra,2),'Degree'),
38
38
  ('DEC', np.round(dec,2),'Degree'),
39
39
  ('RA_ERR_PLUS', np.round(uncertainty[0][1],2),
@@ -99,12 +99,12 @@ def hp_ticklabels(zoom=False, lonra=None, latra=None, rot=None, bounds=None):
99
99
  pe = [path_effects.Stroke(linewidth=1.5, foreground='white'),
100
100
  path_effects.Normal()]
101
101
  for _ in lats:
102
- healpy.projtext(lon_offset, _, "{:.0f}$^\circ$".format(_),
102
+ healpy.projtext(lon_offset, _, f"{_:.0f}$^\\circ$",
103
103
  lonlat=True, path_effects=pe, fontsize=10)
104
104
  if zoom:
105
105
  for _ in lons:
106
106
  healpy.projtext(_, lat_offset,
107
- "{:.0f}$^\circ$".format(_), lonlat=True,
107
+ f"{_:.0f}$^\\circ$", lonlat=True,
108
108
  path_effects=pe, fontsize=10)
109
109
  else:
110
110
  ax.annotate(r"$\bf{-180^\circ}$", xy=(1.7, 0.625), size="medium")