@@ -887,6 +887,41 @@ def _set_nsky_parts(Nsrcs, cat_nfreqs, Nsky_parts):
887
887
return Nsky_parts
888
888
889
889
890
+ def _check_uvdata (input_uv ):
891
+ """Perform UVData checks for run_uvdata_uvsim.
892
+
893
+ Moved checks to reduce complexity.
894
+
895
+ Parameters
896
+ -----------
897
+ input_uv : :class:`pyuvdata.UVData` instance
898
+ Provides baseline/time/frequency information.
899
+
900
+ Returns
901
+ -------
902
+ the UVData ordering convention
903
+ """
904
+ if not isinstance (input_uv , UVData ):
905
+ raise TypeError ("input_uv must be UVData object" )
906
+
907
+ if not (
908
+ (input_uv .Npols == 4 )
909
+ and (input_uv .polarization_array .tolist () == [- 5 , - 6 , - 7 , - 8 ])
910
+ ):
911
+ raise ValueError ("input_uv must have XX,YY,XY,YX polarization" )
912
+
913
+ if not input_uv .future_array_shapes :
914
+ input_uv .use_future_array_shapes ()
915
+
916
+ input_order = input_uv .blt_order
917
+ if input_order != ("time" , "baseline" ):
918
+ input_uv .reorder_blts (order = "time" , minor_order = "baseline" )
919
+
920
+ return input_order
921
+
922
+
923
+ # this function is very complex according to flake8.
924
+ # too many ifs, we can swing back to this later.
890
925
def run_uvdata_uvsim (
891
926
input_uv ,
892
927
beam_list ,
@@ -986,21 +1021,7 @@ def run_uvdata_uvsim(
986
1021
beam_dict = comm .bcast (beam_dict , root = 0 )
987
1022
catalog .share (root = 0 )
988
1023
989
- if not isinstance (input_uv , UVData ):
990
- raise TypeError ("input_uv must be UVData object" )
991
-
992
- if not (
993
- (input_uv .Npols == 4 )
994
- and (input_uv .polarization_array .tolist () == [- 5 , - 6 , - 7 , - 8 ])
995
- ):
996
- raise ValueError ("input_uv must have XX,YY,XY,YX polarization" )
997
-
998
- if not input_uv .future_array_shapes :
999
- input_uv .use_future_array_shapes ()
1000
-
1001
- input_order = input_uv .blt_order
1002
- if input_order != ("time" , "baseline" ):
1003
- input_uv .reorder_blts (order = "time" , minor_order = "baseline" )
1024
+ input_order = _check_uvdata (input_uv )
1004
1025
1005
1026
# The root node will initialize our simulation
1006
1027
# Read input file and make uvtask list
0 commit comments