@@ -629,7 +629,7 @@ def C_model(self, key, model='empirical', time_index=None, known_cov=None, inclu
629629 """
630630 # type check
631631 assert isinstance (key , tuple ), "key must be fed as a tuple"
632- assert isinstance (model , ( str , np . str ) ), "model must be a string"
632+ assert isinstance (model , str ), "model must be a string"
633633
634634 # parse key
635635 dset , bl = self .parse_blkey (key )
@@ -720,7 +720,7 @@ def cross_covar_model(self, key1, key2, model='empirical',
720720 # type check
721721 assert isinstance (key1 , tuple ), "key1 must be fed as a tuple"
722722 assert isinstance (key2 , tuple ), "key2 must be fed as a tuple"
723- assert isinstance (model , ( str , np . str ) ), "model must be a string"
723+ assert isinstance (model , str ), "model must be a string"
724724
725725 # parse key
726726 dset1 , bl1 = self .parse_blkey (key1 )
@@ -1390,7 +1390,7 @@ def get_G(self, key1, key2, exact_norm=False, pol=False):
13901390 raise ValueError ("Number of delay bins should have been set"
13911391 "by now! Cannot be equal to None" )
13921392
1393- G = np .zeros ((self .spw_Ndlys , self .spw_Ndlys ), dtype = np . complex )
1393+ G = np .zeros ((self .spw_Ndlys , self .spw_Ndlys ), dtype = complex )
13941394 R1 = self .R (key1 )
13951395 R2 = self .R (key2 )
13961396
@@ -1489,16 +1489,16 @@ def get_H(self, key1, key2, sampling=False, exact_norm=False, pol=False):
14891489 raise ValueError ("Number of delay bins should have been set"
14901490 "by now! Cannot be equal to None." )
14911491
1492- H = np .zeros ((self .spw_Ndlys , self .spw_Ndlys ), dtype = np . complex )
1492+ H = np .zeros ((self .spw_Ndlys , self .spw_Ndlys ), dtype = complex )
14931493 R1 = self .R (key1 )
14941494 R2 = self .R (key2 )
14951495 if not sampling :
14961496 nfreq = np .sum (self .filter_extension ) + self .spw_Nfreqs
14971497 sinc_matrix = np .zeros ((nfreq , nfreq ))
14981498 for i in range (nfreq ):
14991499 for j in range (nfreq ):
1500- sinc_matrix [i ,j ] = np . float (i - j )
1501- sinc_matrix = np .sinc (sinc_matrix / np . float (nfreq ))
1500+ sinc_matrix [i ,j ] = float (i - j )
1501+ sinc_matrix = np .sinc (sinc_matrix / float (nfreq ))
15021502
15031503 iR1Q1 , iR2Q2 = {}, {}
15041504 if (exact_norm ):
@@ -1582,7 +1582,7 @@ def get_unnormed_E(self, key1, key2, exact_norm=False, pol=False):
15821582 "by now! Cannot be equal to None" )
15831583 nfreq = self .spw_Nfreqs + np .sum (self .filter_extension )
15841584 E_matrices = np .zeros ((self .spw_Ndlys , nfreq , nfreq ),
1585- dtype = np . complex )
1585+ dtype = complex )
15861586 R1 = self .R (key1 )
15871587 R2 = self .R (key2 )
15881588 if (exact_norm ):
@@ -2227,7 +2227,7 @@ def get_Q_alt(self, mode, allow_fft=True, include_extension=False):
22272227 else :
22282228 phase_correction = 0.
22292229 if (self .spw_Ndlys == nfreq ) and (allow_fft == True ):
2230- _m = np .zeros ((nfreq ,), dtype = np . complex )
2230+ _m = np .zeros ((nfreq ,), dtype = complex )
22312231 _m [mode ] = 1. # delta function at specific delay mode
22322232 # FFT to transform to frequency space
22332233 m = np .fft .fft (np .fft .ifftshift (_m ))
@@ -2426,9 +2426,9 @@ def broadcast_dset_flags(self, spw_ranges=None, time_thresh=0.2,
24262426 Nfreqs = float (flags .shape [1 ])
24272427 # get time- and freq-continguous flags
24282428 freq_contig_flgs = np .sum (flags , axis = 1 ) / Nfreqs > 0.999999
2429- Ntimes_noncontig = np .sum (~ freq_contig_flgs , dtype = np . float )
2429+ Ntimes_noncontig = np .sum (~ freq_contig_flgs , dtype = float )
24302430 # get freq channels where non-contiguous flags exceed threshold
2431- exceeds_thresh = np .sum (flags [~ freq_contig_flgs ], axis = 0 , dtype = np . float ) / Ntimes_noncontig > time_thresh
2431+ exceeds_thresh = np .sum (flags [~ freq_contig_flgs ], axis = 0 , dtype = float ) / Ntimes_noncontig > time_thresh
24322432 # flag channels for all times that exceed time_thresh
24332433 dset .flag_array [bl_inds , :, np .where (exceeds_thresh )[0 ][:, None ], i ] = True
24342434 # for pixels that have flags but didn't meet broadcasting limit
@@ -2695,9 +2695,9 @@ def validate_pol(self, dsets, pol_pair):
26952695 x_orientation = self .dsets [0 ].x_orientation
26962696
26972697 # convert elements to integers if fed as strings
2698- if isinstance (pol_pair [0 ], ( str , np . str ) ):
2698+ if isinstance (pol_pair [0 ], str ):
26992699 pol_pair = (uvutils .polstr2num (pol_pair [0 ], x_orientation = x_orientation ), pol_pair [1 ])
2700- if isinstance (pol_pair [1 ], ( str , np . str ) ):
2700+ if isinstance (pol_pair [1 ], str ):
27012701 pol_pair = (pol_pair [0 ], uvutils .polstr2num (pol_pair [1 ], x_orientation = x_orientation ))
27022702
27032703 assert isinstance (pol_pair [0 ], (int , np .integer )), err_msg
@@ -3081,9 +3081,9 @@ def pspec(self, bls1, bls2, dsets, pols, n_dlys=None,
30813081 # Convert string to pol-integer pair
30823082 p = (uvutils .polstr2num (p , x_orientation = self .dsets [0 ].x_orientation ),
30833083 uvutils .polstr2num (p , x_orientation = self .dsets [0 ].x_orientation ))
3084- if isinstance (p [0 ], ( str , np . str ) ):
3084+ if isinstance (p [0 ], str ):
30853085 p = (uvutils .polstr2num (p [0 ], x_orientation = self .dsets [0 ].x_orientation ), p [1 ])
3086- if isinstance (p [1 ], ( str , np . str ) ):
3086+ if isinstance (p [1 ], str ):
30873087 p = (p [0 ], uvutils .polstr2num (p [1 ], x_orientation = self .dsets [0 ].x_orientation ))
30883088 _pols .append (p )
30893089 pols = _pols
@@ -3285,7 +3285,7 @@ def pspec(self, bls1, bls2, dsets, pols, n_dlys=None,
32853285 # the diagonal norm matrix mode (i.e., norm = 'I')
32863286 if norm == 'I' and not (exact_norm ):
32873287 sa = self .scalar_delay_adjustment (Gv = Gv , Hv = Hv )
3288- if isinstance (sa , ( np . float , float ) ):
3288+ if isinstance (sa , float ):
32893289 pv *= sa
32903290 else :
32913291 pv = np .atleast_2d (sa ).T * pv
@@ -3305,7 +3305,7 @@ def pspec(self, bls1, bls2, dsets, pols, n_dlys=None,
33053305 cov_imag = cov_imag * (scalar )** 2.
33063306
33073307 if norm == 'I' and not (exact_norm ):
3308- if isinstance (sa , ( np . float , float ) ):
3308+ if isinstance (sa , float ):
33093309 cov_real = cov_real * (sa )** 2.
33103310 cov_imag = cov_imag * (sa )** 2.
33113311 else :
@@ -3386,7 +3386,7 @@ def pspec(self, bls1, bls2, dsets, pols, n_dlys=None,
33863386 lst2 .extend (dset2 .lst_array [inds2 ])
33873387
33883388 # insert blpair info
3389- blp_arr .extend (np .ones_like (inds1 , np . int ) \
3389+ blp_arr .extend (np .ones_like (inds1 , int ) \
33903390 * uvputils ._antnums_to_blpair (blp ))
33913391
33923392 # insert into data and wgts integrations dictionaries
@@ -3458,7 +3458,7 @@ def pspec(self, bls1, bls2, dsets, pols, n_dlys=None,
34583458 uvp .Nspwdlys = len (uvp .spw_dly_array )
34593459 uvp .Nspwfreqs = len (uvp .spw_freq_array )
34603460 uvp .Nfreqs = len (np .unique (freqs ))
3461- uvp .polpair_array = np .array (spw_polpair , np . int )
3461+ uvp .polpair_array = np .array (spw_polpair , int )
34623462 uvp .Npols = len (spw_polpair )
34633463 uvp .scalar_array = np .array (sclr_arr )
34643464 uvp .channel_width = dset1 .channel_width # all dsets validated to agree
@@ -3473,11 +3473,11 @@ def pspec(self, bls1, bls2, dsets, pols, n_dlys=None,
34733473 label1 = self .labels [self .dset_idx (dsets [0 ])]
34743474 label2 = self .labels [self .dset_idx (dsets [1 ])]
34753475 uvp .labels = sorted (set ([label1 , label2 ]))
3476- uvp .label_1_array = np .ones ((uvp .Nspws , uvp .Nblpairts , uvp .Npols ), np . int ) \
3476+ uvp .label_1_array = np .ones ((uvp .Nspws , uvp .Nblpairts , uvp .Npols ), int ) \
34773477 * uvp .labels .index (label1 )
3478- uvp .label_2_array = np .ones ((uvp .Nspws , uvp .Nblpairts , uvp .Npols ), np . int ) \
3478+ uvp .label_2_array = np .ones ((uvp .Nspws , uvp .Nblpairts , uvp .Npols ), int ) \
34793479 * uvp .labels .index (label2 )
3480- uvp .labels = np .array (uvp .labels , np . str )
3480+ uvp .labels = np .array (uvp .labels , str )
34813481 uvp .r_params = uvputils .compress_r_params (r_params )
34823482 uvp .taper = taper
34833483 if not return_q :
@@ -3507,7 +3507,7 @@ def pspec(self, bls1, bls2, dsets, pols, n_dlys=None,
35073507 uvp .integration_array = integration_array
35083508 uvp .wgt_array = wgt_array
35093509 uvp .nsample_array = dict (
3510- [ (k , np .ones_like (uvp .integration_array [k ], np . float ))
3510+ [ (k , np .ones_like (uvp .integration_array [k ], float ))
35113511 for k in uvp .integration_array .keys () ] )
35123512
35133513 # covariance
@@ -4030,7 +4030,7 @@ def pspec_run(dsets, filename, dsets_std=None, cals=None, cal_flag=True,
40304030
40314031 # parse psname
40324032 if psname_ext is not None :
4033- assert isinstance (psname_ext , ( str , np . str ) )
4033+ assert isinstance (psname_ext , str )
40344034 else :
40354035 psname_ext = ''
40364036
@@ -4132,7 +4132,7 @@ def pspec_run(dsets, filename, dsets_std=None, cals=None, cal_flag=True,
41324132 assert len (pol_pairs ) > 0 , "no pol_pairs specified"
41334133
41344134 # load beam
4135- if isinstance (beam , ( str , np . str ) ):
4135+ if isinstance (beam , str ):
41364136 beam = pspecbeam .PSpecBeamUV (beam , cosmo = cosmo )
41374137
41384138 # beam and cosmology check
@@ -4472,7 +4472,7 @@ def _load_dsets(fnames, bls=None, pols=None, logf=None, verbose=True,
44724472
44734473 # read data
44744474 uvd = UVData ()
4475- if isinstance (dset , ( str , np . str ) ):
4475+ if isinstance (dset , str ):
44764476 dfiles = glob .glob (dset )
44774477 else :
44784478 dfiles = dset
@@ -4510,7 +4510,7 @@ def _load_cals(cnames, logf=None, verbose=True):
45104510
45114511 # read data
45124512 uvc = UVCal ()
4513- if isinstance (cfile , ( str , np . str ) ):
4513+ if isinstance (cfile , str ):
45144514 uvc .read_calfits (glob .glob (cfile ))
45154515 else :
45164516 uvc .read_calfits (cfile )
0 commit comments