Esempio n. 1
0
File: main.c Progetto: ajmas/NewSRT
void zerospectra(int mode)
{
    int i, j, yr, da, hr, mn, sc;
    double az, el, secs, ra, dec;
    secs = d1.secs;

    if (!mode) {
        for (i = 0; i < d1.nfreq; i++)
            avspec[i] = avspecoff[i] = avspecon[i] = 0;
        d1.pwron = d1.pwroff = 0;
        d1.numon = d1.numoff = d1.integ = 0;
    }

    if (d1.cmdfl && secs > d1.secstop && !d1.slew && !d1.scan && !d1.docal && mode)
        d1.secstop = cmdfile();

    d1.vlsr = 0.0;
    az = -1;
    for (i = 0; d1.track >= 0 && i < d1.nsou; i++) {
        if (strstr(sounam[i], soutrack) && soutrack[0]) {
            toyrday(secs, &yr, &da, &hr, &mn, &sc);
            d1.year = yr;
            if (strstr(sounam[i], "Sun") || strstr(sounam[i], "Moon")) {
                if (strstr(sounam[i], "Sun"))
                    sunradec(secs, &ra, &dec);
                else
                    moonradec(secs, &ra, &dec);
                radec_azel(gst(secs) - ra - d1.lon, dec, d1.lat, &az, &el);
            } else if (soutype[i]) {
                az = ras[i] * PI / 180.0;
                el = decs[i] * PI / 180.0;
                azel_to_radec(secs, ras[i], decs[i], &ra, &dec);
            } else {
                precess(ras[i], decs[i], &ra, &dec, epoc[i], d1.year);
                radec_azel(gst(secs) - ra - d1.lon, dec, d1.lat, &az, &el);
            }
            d1.vlsr = vlsr(secs, ra, dec);
            sprintf(souinfo, "%s %4d", to_radecp(ra, dec), yr);
        }
    }
    if (d1.track && az >= 0.0) {
        if (d1.scan > 0) {
            i = (d1.scan - 1) / 5;
            j = (d1.scan - 1) % 5;
            d1.eloff = (i - 2) * d1.beamw * 0.5;
            d1.azoff = (j - 2) * d1.beamw * 0.5 / cos(el + d1.eloff * PI / 180.0);
            d1.scan++;
            if (d1.scan > 26) {
                d1.scan = 0;
                if (d1.displ)
                    gtk_tooltips_set_tip(tooltips, button_npoint, "click to start npoint scan", NULL);
                d1.azoff = d1.eloff = 0;
                d1.domap = 1;
            }
        }
        if (d1.bsw == 1)
            d1.bswint = 0;
        if (d1.bsw > 0 && d1.bswint == 0) {
            if (d1.bsw == 1)
                d1.clearint = 1;
            i = (d1.bsw - 1) % 4;
            j = 0;
            if (i == 1)
                j = -1;
            if (i == 3)
                j = 1;
            d1.azoff = j * d1.beamw / cos(el);
            d1.bsw++;
        }
    }
    if (az >= 0 && d1.stow != 1) {
        d1.azcmd = az * 180.0 / PI + d1.azoff;
        d1.elcmd = el * 180.0 / PI + d1.eloff;
//     printf("inzero azcmd %f ellim2 %f\n",d1.azcmd,d1.ellim2);
    } else {
        azel_to_radec(secs, d1.azcmd, d1.elcmd, &ra, &dec);
        d1.vlsr = vlsr(secs, ra, dec);
    }
    if (mode == 0) {
        d1.integ = 0.0;
        pwr = 0.0;
    }
}
Esempio n. 2
0
/* get jupiter info in md[0], moon info in md[1..J_NMOONS-1].
 * if !dir always use meeus model.
 * if !jop caller just wants md[] for names
 * N.B. we assume sop and jop are updated.
 */
void
jupiter_data (
double Mjd,		/* mjd */
char dir[],             /* dir in which to look for helper files */
Obj *sop,               /* Sun */
Obj *jop,		/* jupiter */
double *sizep,		/* jup angular diam, rads */
double *cmlI, double *cmlII,		/* central meridian longitude, rads */
double *polera, double *poledec,	/* pole location */
MoonData md[J_NMOONS])	/* return info */
{
        double JD;

	/* always copy back at least for name */
	memcpy (md, jmd, sizeof(jmd));

	/* pole */
	if (polera) *polera = POLE_RA;
	if (poledec) *poledec = POLE_DEC;

	/* nothing else if repeat call or just want names */
	if (Mjd == mdmjd || !jop) {
	    if (jop) {
		*sizep = sizemjd;
		*cmlI = cmlImjd;
		*cmlII = cmlIImjd;
	    }
	    return;
	}
	JD = Mjd + MJD0;

	/* planet in [0] */
	md[0].ra = jop->s_ra;
	md[0].dec = jop->s_dec;
	md[0].mag = get_mag(jop);
	md[0].x = 0;
	md[0].y = 0;
	md[0].z = 0;
	md[0].evis = 1;
	md[0].svis = 1;

	/* size is straight from jop */
	*sizep = degrad(jop->s_size/3600.0);

	/* mags from JPL ephemeris */
	md[1].mag = 5.7;
	md[2].mag = 5.8;
	md[3].mag = 5.3;
	md[4].mag = 6.7;

	/* get moon data from BDL if possible, else Meeus' model.
	 * always use Meeus for cml
	 */
	if (use_bdl (JD, dir, md) == 0)
	    meeus_jupiter (Mjd, cmlI, cmlII, NULL);
	else
	    meeus_jupiter (Mjd, cmlI, cmlII, md);

	/* set visibilities */
	moonSVis (sop, jop, md);
	moonPShad (sop, jop, md);
	moonEVis (md);
	moonTrans (md);

	/* fill in moon ra and dec */
	moonradec (*sizep, md);

	/* save */
	mdmjd = Mjd;
	sizemjd = *sizep;
	cmlImjd = *cmlI;
	cmlIImjd = *cmlII;
	memcpy (jmd, md, sizeof(jmd));
}