Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if self.flux_unit is not None:
stokes_use *= units.Unit(self.flux_unit)
other = {}
if self.spectral_type in ['full', 'subband']:
other['freq_array'] = self.freq_array * units.Hz
if self.spectral_type == 'spectral_index':
other['reference_frequency'] = self.reference_frequency * units.Hz
other['spectral_index'] = self.spectral_index
if self.component_type == 'healpix':
other['nside'] = self.nside
other['hpx_inds'] = self.hpx_inds
else:
other['name'] = self.name
return pyradiosky.SkyModel(
ra=ra_use, dec=dec_use, stokes=stokes_use,
spectral_type=self.spectral_type, **other
)
if isinstance(array_location, MoonLocation):
localframe = 'lunartopo'
mock_keywords['world'] = 'moon'
else:
localframe = 'altaz'
mock_keywords['world'] = 'earth'
source_coord = SkyCoord(alt=Angle(alts, unit=units.deg), az=Angle(azs, unit=units.deg),
obstime=time, frame=localframe, location=array_location)
icrs_coord = source_coord.transform_to('icrs')
ra = icrs_coord.ra
dec = icrs_coord.dec
names = np.array(['src' + str(si) for si in range(Nsrcs)])
stokes = np.zeros((4, 1, Nsrcs))
stokes[0, :] = fluxes
catalog = pyradiosky.SkyModel(names, ra, dec, stokes, 'flat')
if return_data:
catalog = SkyModelData(catalog)
if get_rank() == 0 and save:
np.savez('mock_catalog_' + arrangement, ra=ra.rad, dec=dec.rad, alts=alts, azs=azs,
fluxes=fluxes)
return catalog, mock_keywords
warnings.warn(
"Warning: No julian date given for mock catalog. Defaulting to first time step."
)
else:
raise ValueError(
"input_uv must be supplied if using mock catalog without specified julian date"
)
time = mock_keywords.pop('time')
sky, mock_keywords = create_mock_catalog(time, **mock_keywords)
mock_keyvals = [str(key) + str(val) for key, val in mock_keywords.items()]
source_list_name = 'mock_' + "_".join(mock_keyvals)
elif isinstance(catalog, str):
source_list_name = os.path.basename(catalog)
sky = pyradiosky.SkyModel()
if not os.path.isfile(catalog):
catalog = os.path.join(param_dict['config_path'], catalog)
if catalog.endswith("txt"):
sky.read_text_catalog(catalog)
elif catalog.endswith('vot'):
if 'gleam' in catalog:
if "spectral_type" in source_params:
spectral_type = source_params["spectral_type"]
else:
warnings.warn("No spectral_type specified for GLEAM, using 'flat'.")
spectral_type = "flat"
sky.read_gleam_catalog(
catalog, spectral_type=spectral_type
)
else:
vo_params = {}