Page 1 of 1

Reversed "astro" function

Posted: Sun Mar 25, 2018 3:51 pm
by en1940
Hi folks!

what would be best way to reverse "astro" function?

for example - I want to use as input: mercury, geo, location values, longitude value, etc, etc
and get back array of dates and times when mercury is at position with longitude equal to input value....

Any ideas?

Regards,
Ev

Re: Reversed "astro" function

Posted: Mon Mar 26, 2018 4:08 pm
by sbank
Hi Ev,

I am not sure I understand what you mean by "input value." You can just do a simple plot of something like this:

Code: Select all

wave_long = astro(year, month, day, time, astro_mercury, true, astro_long , true);
plot1 = wave_long;   
Then when applied to a daily chart, you can see the jump when going retrograde. But I don't think this is really what you are looking for...

Mercury.png
Mercury.png (27.25 KiB) Viewed 15131 times

Re: Reversed "astro" function

Posted: Mon Mar 26, 2018 5:05 pm
by en1940
Big pardon for broken english )

I need to know date and time when helio Merc is 237.35 degrees (for example) to draw trendlines backwards from there

Re: Reversed "astro" function

Posted: Mon Mar 26, 2018 5:21 pm
by earik
Hi Ev,

You're asking for an aspectarian. That's sort of what the ephemeris does in the panel on the right. But to do it from a chart, you'd have to write a script to solve for the aspects you were looking for, then spit that information out to a file or the print log. It would involve setting up a loop, sort of like this:

Code: Select all

if (barnum == barsback) {

# use julian days for a loop. this example goes from the year 2000 to 2020
jd1 = julianday(2000,1,1,1200);
jd2 = julianday(2020,1,1,1200);

old_mercury = 0; # holds previous value of mercury
mercury = astro(2000,1,1,1200,astro_mercury,true,astro_rd,true);; # holds current value of mercury
aspect_to_find = 237.35;

for (jd = jd1 to jd2) {
   y = julian_to_year(jd);
   m = julian_to_month(jd);
   d = julian_to_day(jd);

   old_mercury = mercury;
   mercury = astro(y,m,d,1200,astro_mercury,true,astro_rd,true);
  
   # look for the conditions
   have_an_aspect = false;
   if ((mercury >= aspect_to_find) and (old_mercury < aspect_to_find)) #direct motion trigger
      have_an_aspect = true;
   if ((mercury <= aspect_to_find) and (old_mercury > aspect_to_find)) #retrograde motion trigger
      have_an_aspect = true;

   #if we have a hit, record it somewhere
   if (have_an_aspect == true) 
      print("Aspect on ",y," ",m," ",d);
}

}

plot1= close; # put this in there so you know when you're done
I just wrote that off the top of my head to give you a starting point, so there might be typos in there, but it should be pretty close. Basically, you are using an indicator to run a loop where you search for your aspects. It's going to take some time, so you only want to do it once, which is why I stuffed it all inside the "if (barnum == barsback)" section.

It's not exactly what QScript was meant for, which is why it can be a little clunky, but it's definitely doable.

Hope that helps.

Earik