Commits

Ajay Vibhute authored 01339a549fd Merge
Pull request #1446: PIPE-2487: fixed a bug in get_vla_corrlist_from_spw

Merge in PIPE/pipeline from PIPE-2487-fix-ms.get_vla_corrlist_from_spw to main * commit '6e6a3595f61d31bb971afc6d5afe3744fa8890ab': PIPE-2487: using self.data_descriptions in get_vla_corrstring method PIPE-2487: fixed a bug in get_vla_corrlist_from_spw

pipeline/domain/measurementset.py

Modified
868 868 key=operator.itemgetter(1))
869 869 return earliest.start_time
870 870
871 871 @property
872 872 def end_time(self) -> dict:
873 873 """Return end time for this measurement set as CASA 'epoch' measure dictionary."""
874 874 latest, _ = max([(scan, utils.get_epoch_as_datetime(scan.end_time)) for scan in self.scans],
875 875 key=operator.itemgetter(1))
876 876 return latest.end_time
877 877
878 -
879 878 def get_vla_corrstring(self) -> str:
880 879 """Get correlation string for VLA
881 880
882 881 Returns:
883 882 corrstring: string value of correlation
884 883 """
885 884 # Prep string listing of correlations from dictionary created by method buildscans
886 885 # For now, only use the parallel hands. Cross hands will be implemented later.
887 886
888 - corrstring_list = self.polarizations[0].corr_type_string if len(self.polarizations) > 0 else []
887 + corrstring_list = self.polarizations[self.data_descriptions[0].pol_id].corr_type_string if len(self.polarizations) and len(self.data_descriptions) > 0 else []
889 888 removal_list = ['RL', 'LR', 'XY', 'YX']
890 889 corrstring_list = sorted(set(corrstring_list).difference(set(removal_list)))
891 890 corrstring = ','.join(corrstring_list)
892 891
893 892 return corrstring
894 893
895 894 def get_vla_corrlist_from_spw(self, spw: str | None = None) -> list:
896 895 """Get all VLA correlation labels as a list of string from selected spw(s).
897 896
898 897 Args:
899 898 spw: a spw selection string or None. Defaults to None.
900 899
901 900 Returns:
902 901 list: a list of correlation labels.
903 902 """
904 903
905 904 corrs = set()
906 - for lspw in self.spectral_windows:
907 - if spw in ('', '*', None) or (isinstance(spw, str) and str(lspw.id) in spw.split(',')):
908 - corrs = corrs.union(self.polarizations[lspw.id].corr_type_string)
905 + for dd in self.data_descriptions:
906 + if spw in ('', '*', None) or (isinstance(spw, str) and str(dd.spw.id) in spw.split(',')):
907 + corrs = corrs.union(self.polarizations[dd.pol_id].corr_type_string)
909 908
910 909 return sorted(corrs)
911 910
912 911 def get_alma_corrstring(self) -> str:
913 912 """Get correlation string for ALMA for the science spectral windows.
914 913
915 914 Returns:
916 915 corrstring: string value of correlation
917 916 """
918 917 sci_spwlist = self.get_spectral_windows(science_windows_only=True)

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut