void spigot2sigprocfb(SPIGOT_INFO * spigot, sigprocfb * fb, char *filenmbase) { int h_or_d, m; double s; strncpy(fb->inpfile, filenmbase, 40); strncpy(fb->source_name, spigot->object, 80); fb->nifs = 1; if (spigot->num_samplers == 1) strncpy(fb->ifstream, "YXXX", 8); else if (spigot->num_samplers == 2) strncpy(fb->ifstream, "YYXX", 8); fb->tstart = spigot->MJD_obs + spigot->elapsed_time / SECPERDAY; fb->tsamp = spigot->dt_us / 1e6; hours2hms(spigot->ra / 15.0, &h_or_d, &m, &s); fb->src_raj = h_or_d * 10000.0 + m * 100.0 + s; deg2dms(spigot->dec, &h_or_d, &m, &s); fb->src_dej = abs(h_or_d) * 10000.0 + abs(m) * 100.0 + fabs(s); if (spigot->dec < 0) fb->src_dej = -fb->src_dej; fb->az_start = spigot->az; fb->za_start = 90.0-spigot->el; fb->nchans = spigot->lags_per_sample; fb->foff = spigot->bandwidth / fb->nchans; fb->fch1 = spigot->freq_ctr + (fb->nchans / 2 - 0.5) * fb->foff; fb->foff = -fb->foff; // Here is where we chop the bottom 1/4 (200MHz) of the band fb->nchans = fb->nchans - fb->nchans/4; fb->machine_id = 7; fb->telescope_id = 6; fb->nbits = 8; fb->sumifs = spigot->summed_pols; if (fb->sumifs) fb->nifs = 1; else { if (spigot->num_samplers == 2) fb->nifs = 2; else fb->nifs = 1; } /* The following are not necessary for writing filterbank files */ fb->headerlen = 0; fb->N = spigot->samples_per_file; }
void spectra_info_to_inf(struct spectra_info *s, infodata *idata) // Convert a spectra_info structure into an infodata structure { int ii, index = 2; char ctmp[100]; struct passwd *pwd; strncpy(idata->object, s->source, 80); hours2hms(s->ra2000 / 15.0, &(idata->ra_h), &(idata->ra_m), &(idata->ra_s)); deg2dms(s->dec2000, &(idata->dec_d), &(idata->dec_m), &(idata->dec_s)); strcpy(idata->telescope, s->telescope); strcpy(idata->instrument, s->backend); idata->num_chan = s->num_channels; idata->dt = s->dt; // DATEOBS_to_MJD(s->date_obs, &(idata->mjd_i), &(idata->mjd_f)); idata->mjd_i = (int)(s->start_MJD[0]); idata->mjd_f = s->start_MJD[0] - idata->mjd_i; idata->N = s->N; idata->freqband = s->BW; idata->chan_wid = s->df; idata->freq = s->lo_freq; idata->fov = s->beam_FWHM * 3600.0; // in arcsec idata->bary = 0; idata->numonoff = 0; strcpy(idata->band, "Radio"); pwd = getpwuid(geteuid()); strcpy(idata->analyzer, pwd->pw_name); strncpy(idata->observer, s->observer, 80); if (s->summed_polns) sprintf(ctmp, "2 polns were summed. Samples have %d bits.", s->bits_per_sample); else sprintf(ctmp, "%d polns were not summed. Samples have %d bits.", s->num_polns, s->bits_per_sample); sprintf(idata->notes, "Project ID %s, Date: %s.\n %s\n", s->project_id, s->date_obs, ctmp); // If we have more than one input file, see it we need onoff bins if (s->num_files == 1 && s->num_pad[0] == 0) { idata->numonoff = 0; return; } /* Determine the topocentric onoff bins */ idata->numonoff = 1; idata->onoff[0] = 0.0; idata->onoff[1] = s->num_spec[0] - 1.0; for (ii = 1; ii < s->num_files; ii++) { if (s->num_pad[ii - 1]) { idata->onoff[index] = idata->onoff[index - 1] + s->num_pad[ii - 1]; idata->onoff[index + 1] = idata->onoff[index] + s->num_spec[ii]; idata->numonoff++; index += 2; } else { idata->onoff[index - 1] += s->num_spec[ii]; } } if (s->num_pad[s->num_files - 1]) { idata->onoff[index] = idata->onoff[index - 1] + s->num_pad[s->num_files - 1]; idata->onoff[index + 1] = idata->onoff[index]; idata->numonoff++; } }
void spigot2sigprocfb(SPIGOT_INFO * spigot, sigprocfb * fb, char *filenmbase, int lokill, int hikill, int downsamp, int update_posn, double time_offset) { int h_or_d, m; double s, dt; /* Set the time offset for the posn calc */ if (update_posn){ dt = time_offset; } else { dt = 0.0; } strncpy(fb->inpfile, filenmbase, 40); strncpy(fb->source_name, spigot->object, 80); fb->nifs = 1; if (spigot->num_samplers == 1) strncpy(fb->ifstream, "YXXX", 8); else if (spigot->num_samplers == 2) strncpy(fb->ifstream, "YYXX", 8); fb->tstart = spigot->MJD_obs + spigot->elapsed_time / SECPERDAY; fb->tsamp = spigot->dt_us / 1e6 * downsamp; hours2hms(spigot->ra / 15.0, &h_or_d, &m, &s); fb->src_raj = h_or_d * 10000.0 + m * 100.0 + s; deg2dms(spigot->dec, &h_or_d, &m, &s); fb->src_dej = abs(h_or_d) * 10000.0 + abs(m) * 100.0 + fabs(s); if (spigot->dec < 0) fb->src_dej = -fb->src_dej; fb->az_start = spigot->az; fb->za_start = 90.0-spigot->el; fb->nchans = spigot->lags_per_sample; fb->foff = spigot->bandwidth / fb->nchans; fb->fch1 = spigot->freq_ctr + (fb->nchans / 2 - 0.5) * fb->foff; fb->fch1 -= fb->foff * hikill; fb->nchans -= (hikill + lokill); fb->foff = -fb->foff; fb->machine_id = 7; fb->telescope_id = 6; fb->nbits = 8; fb->sumifs = spigot->summed_pols; if (fb->sumifs) fb->nifs = 1; else { if (spigot->num_samplers == 2) fb->nifs = 2; else fb->nifs = 1; } /* The following are not necessary for writing filterbank files */ fb->headerlen = 0; fb->N = spigot->samples_per_file; /* Update the position if the GBT was not tracking */ /* (i.e. for the driftscan surveys) */ if (update_posn && !spigot->tracking) { int N=0; char scope[10]={"GBT"}, type[]={"A"}; char name[40]; double MJD, lon, lat, hgt, microns, az, zd, rap, dap, rmn, dmn; double dtmp=0.0, atm=1010.0, temp=283.0; double humid=0.5, tlr=0.0065, eq=2000.0; /* Compute the RA/DEC using SLALIB from the Az/El */ slaObs(N,scope,name,&lon,&lat,&hgt); if (fabs(hgt-880.0) > 0.01) { printf("Warning!: SLALIB is not correctly identifying the GBT!\n\n"); } //printf("slalib: %d '%s' '%s' %f %f %f\n", // N, scope, name, lon, lat, hgt); lon = -lon; az = fb->az_start * DEGTORAD; zd = fb->za_start * DEGTORAD; microns = 3e8/(spigot->freq_ctr*1e6)*1e6; MJD = fb->tstart + dt/86400.0; slaOap(type,az,zd,MJD,dtmp,lon,lat,hgt, dtmp,dtmp,temp,atm,humid,microns,tlr,&rap,&dap); //printf("slalib: %.15f %.15f\n", rap, dap); slaAmp(rap,dap,MJD,eq,&rmn,&dmn); //printf("slalib: %.15f %.15f\n", rmn, dmn); /* Now update the positions */ hours2hms(rmn * RADTODEG / 15.0, &h_or_d, &m, &s); fb->src_raj = h_or_d * 10000.0 + m * 100.0 + s; deg2dms(dmn * RADTODEG, &h_or_d, &m, &s); fb->src_dej = abs(h_or_d) * 10000.0 + abs(m) * 100.0 + fabs(s); if (dmn < 0) fb->src_dej = -fb->src_dej; } }