Commits
Jorge Lopez authored 86e60ce6f3d
715 715 | """ |
716 716 | This is a task to plot bandpass and Tsys calibration tables faster and more |
717 717 | flexibly than plotcal, including the ability to overlay the atmospheric |
718 718 | transmission, and to create multi-page plots as pngs and combine them |
719 719 | into single PDF documents. |
720 720 | It works with both the old style and new style cal tables. The source code |
721 721 | is in task_plotbandpass.py. For more detailed help, see examples at: |
722 722 | http://casaguides.nrao.edu/index.php?title=Plotbandpass |
723 723 | -- Todd Hunter |
724 724 | """ |
725 - | axes = dict() # keep track of already created axes |
726 725 | def safe_pb_subplot(xframe): |
727 726 | """ |
728 727 | CAS-12786: old pyplots (up to CASA 5.6.1 used to accept "220" in the pos parameter |
729 728 | Newer pyplots won't. Assume the index effectively used was 1 ("221") |
730 - | |
731 - | CAS-13276: pb.subplot will return a different instance in future matplotlib versions rather than |
732 - | the same instance. We need to keep track of the axes that have been already created; otherwise, we will lose plots. |
733 729 | """ |
734 - | if (axes.get(xframe) != None): |
735 - | return axes.get(xframe) |
736 - | |
737 - | if str(xframe).endswith('0'): |
738 - | adesc = pb.subplot(xframe + 1) |
739 - | else: |
740 - | adesc = pb.subplot(xframe) |
741 - | |
742 - | axes[xframe] = adesc |
743 - | return adesc |
730 + | xf = (xframe + 1) if str(xframe).endswith('0') else xframe |
731 + | return pb.subplot(xframe) |
744 732 | |
745 733 | def safe_pb_clf(): |
746 - | # https://open-jira.nrao.edu/browse/CAS-13722 |
747 734 | pb.clf() |
748 - | axes.clear() |
749 735 | |
750 736 | casalog.origin('plotbandpass') |
751 737 | casalogPost(debug,"%s" % (PLOTBANDPASS_REVISION_STRING)) |
752 738 | DEBUG = debug |
753 739 | help = False |
754 740 | vm = '' # unused variable, now that msmd is available in casa |
755 741 | if (help): |
756 742 | print("Usage: plotbandpass(caltable='', antenna='', field='', spw='', yaxis='amp',") |
757 743 | print(" xaxis='chan', figfile='', plotrange=[0,0,0,0], caltable2='',") |
758 744 | print(" overlay='', showflagged=False, timeranges='', buildpdf=False, caltable3='',") |