Accesing to Measurements from a Macro

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Accesing to Measurements from a Macro

Alnair
Hi,

I'm writing a macro for AstroImageJ to convert astrometry measurements to Minor Planet Center (MPC) format.

After getting a Measurements Table I don't know how to access it from a macro.

However if I save Measurements and import like a Results table (File=>Import=>Results) I can access to information
with getResult function, and nResults have the number of rows.

There are a way to access directly to a Measurements Table from a macro?

I attach my macro for reference.

Regards,
  Ferran

MPC_Report.txt (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Accesing to Measurements from a Macro

karenacollins
Administrator
Hi Ferran,

I had not tried this before, but from experimentation with the macro you provided, it appears that the table must be named "Results" (note the capital R) for the results table macro functions to work. If you have an AIJ generated measurements table open, go to the menus above the table and select File->Rename... and rename the table to "Results". Your macro seemed to work after the renaming step.

Does that work on your end? Would that workflow be acceptable to you?

Karen
Reply | Threaded
Open this post in threaded view
|

Re: Accesing to Measurements from a Macro

Alnair
Thanks Karen,

I realized there exists this function:
IJ.renameResults(oldName,newName) - Changes the title of a results table from oldName to newName. Requires 1.46g.

So, maybe I can automate the rename step.
I will give a try.

Regards,
  Ferran


2014-12-29 12:48 GMT+01:00 karenacollins [via AstroImageJ] <[hidden email]>:
Hi Ferran,

I had not tried this before, but from experimentation with the macro you provided, it appears that the table must be named "Results" (note the capital R) for the results table macro functions to work. If you have an AIJ generated measurements table open, go to the menus above the table and select File->Rename... and rename the table to "Results". Your macro seemed to work after the renaming step.

Does that work on your end? Would that workflow be acceptable to you?

Karen


If you reply to this email, your message will be added to the discussion below:
http://astroimagej.1065399.n5.nabble.com/Accesing-to-Measurements-from-a-Macro-tp211p212.html
To start a new topic under AstroImageJ, email [hidden email]
To unsubscribe from AstroImageJ, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: Accesing to Measurements from a Macro

karenacollins
Administrator
Excellent find. Let us know if that works.

Karen

Reply | Threaded
Open this post in threaded view
|

Re: Accesing to Measurements from a Macro

Alnair
Hi Karen,

It basically works.

One caveats:
After load a saved Measurements, the windows name is "Measurements in Measurements.xls", so the macro it only works just after measuring.

I added a text box asking for Results windows name, with default name to "Measurements". Not ideal, but working.

There is some reason to call Result Window "Measurements"? I had read window called "Results" is the active one, and the others are "freeze" in ImageJ, so seems "Results" is the "standard" name for new Results Window.

Also would be great if this macro was included in future AIJ versions. I attach the modified macro.

On the other hand, "Multiple aperture" tool is great for stars photometry, but is not so for minor planets and comets.
Because with such objects "target" moves from one image to another, copying all apertures to the same relative position is not convenient.
It would be great to add the option to position target(s) independently from comparison apertures.

Best wishes,
  Ferran
 

2014-12-29 20:13 GMT+01:00 karenacollins [via AstroImageJ] <[hidden email]>:
Excellent find. Let us know if that works.

Karen




If you reply to this email, your message will be added to the discussion below:
http://astroimagej.1065399.n5.nabble.com/Accesing-to-Measurements-from-a-Macro-tp211p214.html
To start a new topic under AstroImageJ, email [hidden email]
To unsubscribe from AstroImageJ, click here.
NAML


MPC_Report.txt (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Accesing to Measurements from a Macro

karenacollins
Administrator
Hi Ferran,

How much change in position is there typically from one image to the
next for the minor planets and comets? Also, how many images are
typically in the time series when you are following minor planets or
comets? There is probably no concrete answer for either of these
questions, but I am just trying to get a feel for the best way to
address the minor planets and comet photometry issue.

The centroid function works off of the fixed aperture size, even in
variable aperture mode. So, for instance, if you can make the fixed
aperture radius large enough to encompass the change in the moving
target from frame to frame, I think one solution would be to use a
larger fixed aperture radius, and enable variable aperture to shrink the
aperture radius to some factor times the fwhm of the image for the
photometry measurement. For this idea to work the best, you should make
your target star something other than T1, since T1 is used to help find
the relative offsets of all the other target/comp stars from image to
image. As an example, create a C1 (by holding shift when clicking near
the first star), C2 (no shift), C3, C4, and then T5 (by holding shift
when clicking near the target star). Then if T5 doesn't move by more
then the fixed aperture radius from image to image, the centroid feature
should automatically track the moving target while keeping the other
apertures fixed.

That is just one idea. I'll decide on the best solution once I get your
response to the above questions. I'm also considering how to include the
macro you wrote. If I can find time, I'll translate it into java and
include the function as a menu item under the Multi-plot main 'File'
menu (it is harder to add it to the table 'File' menu). Then I can
search for all open tables and automatically select the first one found
(with the option to select another one, if more than one table is open).

Karen
Reply | Threaded
Open this post in threaded view
|

Re: Accesing to Measurements from a Macro

Alnair
Hi Karen,

Including the function in Java like you describe would be great. Thanks.

The "T5" solution could work (and be very practical) for some cases, were object movement is slow and the field is not very crowded of stars.

Objects can move from less than 1 pixel from image to image to a large extend of the field for near earth asteroids.
The number of images in a time series can vary a lot. From 3 to 10 are the usual for astrometric purposes which can include
photometric measures. But for minor planet rotation detection, it can fall in the order of hundreds (1 image every 1-2 minutes during 3-8 hours).

We can take advantage than objects move at uniform speed and in straight line (during a single observing session) so a very convenient way to handle
this would be to mark object position in the first and the last image and recalculate the position in the rest of images taking into account the hour of each image.

Regards,
  Ferran


2014-12-30 13:40 GMT+01:00 karenacollins [via AstroImageJ] <[hidden email]>:
Hi Ferran,

How much change in position is there typically from one image to the
next for the minor planets and comets? Also, how many images are
typically in the time series when you are following minor planets or
comets? There is probably no concrete answer for either of these
questions, but I am just trying to get a feel for the best way to
address the minor planets and comet photometry issue.

The centroid function works off of the fixed aperture size, even in
variable aperture mode. So, for instance, if you can make the fixed
aperture radius large enough to encompass the change in the moving
target from frame to frame, I think one solution would be to use a
larger fixed aperture radius, and enable variable aperture to shrink the
aperture radius to some factor times the fwhm of the image for the
photometry measurement. For this idea to work the best, you should make
your target star something other than T1, since T1 is used to help find
the relative offsets of all the other target/comp stars from image to
image. As an example, create a C1 (by holding shift when clicking near
the first star), C2 (no shift), C3, C4, and then T5 (by holding shift
when clicking near the target star). Then if T5 doesn't move by more
then the fixed aperture radius from image to image, the centroid feature
should automatically track the moving target while keeping the other
apertures fixed.

That is just one idea. I'll decide on the best solution once I get your
response to the above questions. I'm also considering how to include the
macro you wrote. If I can find time, I'll translate it into java and
include the function as a menu item under the Multi-plot main 'File'
menu (it is harder to add it to the table 'File' menu). Then I can
search for all open tables and automatically select the first one found
(with the option to select another one, if more than one table is open).

Karen



If you reply to this email, your message will be added to the discussion below:
http://astroimagej.1065399.n5.nabble.com/Accesing-to-Measurements-from-a-Macro-tp211p216.html
To start a new topic under AstroImageJ, email [hidden email]
To unsubscribe from AstroImageJ, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: Accesing to Measurements from a Macro

karenacollins
Administrator
Hi Ferran,

Regarding the MPC formatting macro, I have a few questions before I try to make it a permanent part of AIJ:

1) Is there a webpage that describes the data in the lines prior to the lines for each individual measurement, similar to the one the describes the individual measurement lines (i.e. http://www.minorplanetcenter.net/iau/info/OpticalObs.html)? I couldn't seem to spot it on the minorplanetcenter.net website.

2) Do you prefer that the output is sent to a log window as in the macro, or do you prefer that it is written to a text file?

3) For general purpose use, do users need access to the following fields, or should they be hard-coded to the values in your macro?
Discovery = " "; // 1 Char
Note1 = " "; // 1 Char
Note2 = "C"; // 1 Char
Magnitude = "     "; // 5 chars F5.2
Filter = " ";  //1 char

4) Should the user have access to add something to the following lines, as is allowed with the COD line:
print("COD " + Observatory);
print("CON ");
print("OBS ");
print("MEA ");
print("TEL ");
print("ACK ");

5) Is the NET parameter always fixed at "USNO-B1.0"?
print("NET USNO-B1.0");


I tried to digest the formatting info at http://www.minorplanetcenter.net, but it is quite flexible, which translates to quite complex.

Thanks,
Karen
Reply | Threaded
Open this post in threaded view
|

Re: Accesing to Measurements from a Macro

karenacollins
Administrator
In reply to this post by Alnair
Hi Ferran,

Could you try the new MPC formatting capability that is in the current 'daily build'?
Instructions for updating to the daily build are here:
http://astroimagej.1065399.n5.nabble.com/After-a-fresh-installation-of-AIJ-be-sure-to-update-to-the-latest-build-td142.html

Before starting the MPC format, you need to decide whether you want to submit a fixed value for magnitude for all rows in the measurements table or if you want to use a custom value for each row derived from something like rel_flux_T1. A constant magnitude value can be entered directly into the MPC user interface. To create a custom value for each row, you will need to know the offset from the zero-centered relative magnitude. Then you will add that value to the plotted magnitude value. To do that, follow these steps, otherwise jump to 'Setting Up MPC Formatting' near the bottom:

1) Open the measurements table into AIJ and start the Multi-plot function, which will load the open table for plotting. Alternatively, open Multi-plot by clicking the icon on the AIJ toolbar and then drag and drop the table onto one of the plot control windows.
2) Plot the data in magnitude by enabling the "Out Mag" option on the appropriate row of the Multi-Plot_Y-data panel .
3) In the "then Shift" box, add the offset. For example, if the offset is 12 magnitudes, enter 12 like this . To work in magnitudes rather than milli-magnitudes, make sure the 'Y x 1E' setting is '0' on the Multi-plot Main panel, and make sure the 'scale' value on the appropriate plot row of the Multi-plot Y-data panel is set to '1'.
4) On the left-hand side of that row, click the "New Col"icon to add a new data column to the table that contains the magnitude value plus the shift value. A dialog panel will open and allow you to accept the default new column name or you can change it as desired. Press OK to save the new column(s). Here is an example of the dialog:


5) Now that you have the magnitude numbers for each row of the table, you can proceed to MPC formatting below.


Setting Up MPC Formatting:
--------------------------------------
1) If you haven't already done so above, open the measurements table into AIJ and start the Multi-plot function, which will automatically load the open table for plotting. Alternatively, open Multi-plot by clicking the icon on the AIJ toolbar and then drag and drop the table onto any one of the plot control windows.

2) Open the new MPC formatting function at Multi-plot_Main->File->'Create Minor Planet Center (MPC) format...'.

2) File out the data as desired and select the JD UTC, RA, and Dec data columns. If you want to use a constant magnitude value, set 'Select magnitude column' to 'blank' and enter the magnitude value in the fixed magnitude box below the column selector. To use the new magnitude column added to the table from above, select the new magnitude column name (rel_flux_T1(mag) in the example above).

3) Click OK and the MPC formatted data will be written to a log window from which it can be cut and pasted into a submission email.

4) All of the settings are remembered between sessions, which should save setup time after the first run.

Let me know if this does what you need. I'm still thinking about how to solve the problem of doing photometry on a target star that is moving relative to the comp stars.

Karen