def calc_vobs(self, ra_2000, dec_2000): x_2000 = [] x = [] x_solar = [] v_earth = [] v_solar = [] solar_tmp = [] #1.85m at nobeyama #glongitude = 138.472153 #nanten2 at atacama (nanten2wiki) glongitude = -67.70308139 #1.85m at nobeyama #glatitude = 35.940874 #nanten2 at atacama (nanten2wiki) glatitude = -22.96995611 #1.85m at nobeyama #gheight = 1386 #nanten2 at atacama gheight = 4863.85 #init a = math.cos(dec_2000) x_2000 = [ a * math.cos(ra_2000), a * math.sin(ra_2000), math.sin(dec_2000) ] tu = (self.t.jd - 2451545.) / 36525. #correction(precession, nutation) sc_fk5 = SkyCoord(ra=ra_2000 * u.radian, dec=dec_2000 * u.radian, frame="fk5") trans = sc_fk5.transform_to( FK5(equinox="J{}".format(2000. + tu * 100.))) ranow = trans.ra.radian delnow = trans.dec.radian x = self.nutation(ranow, delnow) #Earth velocity to object earthloc = EarthLocation(lon=glongitude * u.deg, lat=glatitude * u.deg, height=gheight * u.m) earthloc_gcrs = earthloc.get_gcrs(self.t) sc_earth = SkyCoord(earthloc_gcrs).fk5 v_earth = sc_earth.velocity.d_xyz.value vobs = -(v_earth[0] * x_2000[0] + v_earth[1] * x_2000[1] + v_earth[2] * x_2000[2]) #solar sc_fk4_sol = SkyCoord(ra=18 * 15 * u.deg, dec=30 * u.deg, frame="fk4") trans_sol = sc_fk4_sol.transform_to( FK5(equinox="J{}".format(2000. + tu * 100.))) rasol = trans_sol.ra.radian delsol = trans_sol.dec.radian solar_tmp = self.nutation(rasol, delsol) v_solar = [solar_tmp[0] * 20, solar_tmp[1] * 20, solar_tmp[2] * 20] vobs = -(vobs - (v_solar[0] * x[0] + v_solar[1] * x[1] + v_solar[2] * x[2])) return vobs
# these to create our new header. obstime = Time(header['date-obs']) frequency = header['crval3']*u.Hz ############################################################################### # To create a new `~sunpy.map.Map` header we need convert the reference coordinate # in RA-DEC (that is in the header) to Helioprojective. To do this we will first create # an `astropy.coordinates.SkyCoord` of the reference coordinate from the header information. # We will need the location of the observer (i.e. where the observation was taken). # We first establish the location on Earth from which the observation takes place, in this # case LOFAR observations are taken from Exloo in the Netherlands, which we define in lat and lon. # We can convert this to a SkyCoord in GCRSat the observation time. lofar_loc = EarthLocation(lat=52.905329712*u.deg, lon=6.867996528*u.deg) lofar_gcrs = SkyCoord(lofar_loc.get_gcrs(obstime)) ########################################################################## # We can then define the reference coordinate in terms of RA-DEC from the header information. # Here we are using the ``obsgeoloc`` keyword argument to take into account that the observer is not # at the center of the Earth (i.e. the GCRS origin). The distance here is the Sun-observer distance. reference_coord = SkyCoord(header['crval1']*u.Unit(header['cunit1']), header['crval2']*u.Unit(header['cunit2']), frame='gcrs', obstime=obstime, obsgeoloc=lofar_gcrs.cartesian, obsgeovel=lofar_gcrs.velocity.to_cartesian(), distance=lofar_gcrs.hcrs.distance) ########################################################################## # Now we can convert the ``reference_coord`` to the HPC coordinate frame
# List of fringe recordings: filename, source, start time # TODO: get the length and start time of each file, or better: use metadata obs = (('CasA-fringe-256bins-IQ-float', CasA, Time('2020-10-04 23:55:13') - 3431 * u.s), ('VirA-fringe-256bins-IQ-float', VirA, Time('2020-10-04 22:54:27') - 1776 * u.s), ('CasA-fringe-256bins-IQ-float-2020-10-10-07_10', CasA, Time('2020-10-10 07:35:47') - 1411 * u.s), ('CasA-fringe-256bins-IQ-float2020-10-10 08:58:58.096593', CasA, Time('2020-10-10 11:25:49') - 8794 * u.s), ('CasA-fringe-256bins-IQ-float2020-10-10 12:01:50.510766', CasA, Time('2020-10-10 12:01:50') + 18 * u.s), ('CasA-fringe-256bins-IQ-float2020-10-10 12:35:57.197301', CasA, Time('2020-10-10 15:01:18') - 8702 * u.s)) # Process each scan, printing out the difference between the baseline delay, # and the averaged unwrapped phase (in metres), after subtracting the average offset. # Ideally, this should be flat for every observation. for (fn, source, start) in obs: xc = int_xc(read_xc_data(fn)) phase = np.unwrap(phase_xc(xc)) delay_measured = labda * phase / 2 / np.pi # Calculate the projected baseline for every measured phase second # Add half a second to calculate the midpoint of each integration obstime = start + range(len(delay_measured)) * u.s + 0.5 * u.s baseline_projected = baseline.get_gcrs(obstime).cartesian.xyz.T.dot( source.cartesian.xyz) offset = np.average(delay_measured - baseline_projected) print(*(delay_measured - baseline_projected - offset).value, sep='\n') print() # Two newlines to indicate a new index to gnuplot print()