geminiplanetimager / gpi_pipeline

Gemini Planet Imager Data Reduction Pipeline
Other
8 stars 6 forks source link

Contrast measurements do not work with polarimetry data #18

Open dsavransky opened 8 years ago

dsavransky commented 8 years ago

I get this error when I choose the Contrast button from the ImageInfo menu when looking at a Stokes Data Cube:

% Unable to dereference NULL pointer: <POINTER ()>.

% Execution halted at: GPITV::CONTRPROF_REFRESH 18406 /Users/Max/Library/GPI/gpitv/gpitv__define.pro

% GPITV::CONTRAST 18715 /Users/Max/Library/GPI/gpitv/gpitv__define.pro

% GPITV::TOPMENU_EVENT 1512 /Users/Max/Library/GPI/gpitv/gpitv__define.pro

% GPITVO_MENU_EVENT 530 /Users/Max/Library/GPI/gpitv/gpitv__define.pro

% $MAIN$

mperrin commented 8 years ago

Legacy issue migrated from redmine issue tracker. Originally filed by @maxwellmb on 2013-04-02

We certainly have a working setup for measuring contrast in pol mode today so I think we can just close this. @maxwellmb agreed?

dsavransky commented 8 years ago

Recovering rm journals for issue:

dsavransky: Don't actually know how to calculate contrast for stokes cubes, so, for now, GPItv doesn't do contrasts for non-WAVE mode cubes (commit 1513), preventing this error. Also now clears CWV_ptr on new image so you don't have spectral cubes' wavelength vectors hanging around when you load a pol cube.

mperrin: I'm going to call this a New Feature Request rather than a bug.

mperrin: Raising the priority on this one since Pascale wants it for monitoring data quality during pol mode observations at Gemini.

mperrin: We should aim to do this in over this coming semester.

maxmb: With Sebastian's work, code I have and existing code I think I can get this done pretty soon.

mperrin: One thing we will need to be clear about is defining what's meant by contrast in polarimetry mode! Contrast for a point source, contrast for an extended source, contrast for a 100% polarized vs 50% polarized source, etc. It may be the case that we should output multiple different metrics

At least one of the contrast metrics should aim to be as close as possible to the contrast metric given in spectral mode, i.e. the point source contrast in total intensity. This would be intended primarily as an aid to the instrument scientist (i.e. Pascale or Fredrik) in understanding the relative level of AO performance in a given image. Then we could have additional polarization-sensitive metrics perhaps, but we need to think about that more.

Thanks.

mperrin: Max: Code is there and working, "pretty much done", needs to be added to default recipes. Feasible for 1.4.

mperrin: I believe this is working now, as of the 2015 October run. Is there any more action needed on this one or can we mark it complete?

maxmb: I think the final step is to properly integrate it with GPItv. The primitive works fine from the pipeline, but I think originally I created this feature request for GPItv.

Marshall, how hard is it to port it from a primitive to GPItv?

mperrin: Shouldn't be too hard; probably just slightly tedious in getting the variable names and data structures consistent.

Actually now that I look at the code I think this will be very straightforward. The relevant function in gpitv is gpitv::contrprof_refresh, which is pretty much a merged copy of the relevant portion of the 'gpi_measure_contrast' primitive. The actual calculation happens in some calls to radial_profile (line 20169 in gpitv__define as of today) which match up with the calls to your 'radial_profile_pol' function that I see inside 'gpi_measure_contrast_pol.pro'. So it may be as simple as adding an if statement there to switch which function gets called, plus copying over some of the setup code that calculates the 'ctr_cube' from the input Stokes or Radial Stokes datacube.

kfollette: Any updates on this one Max?

maxmb: Unfortunately, I'm pretty swamped with finishing thesis things in the next two months, and I don't think I can make this a priority until after that. Unless there are any strong objections, I'm going to vote for punting this to version 1.5.

kfollette: No worries! Consider it officially punted on

mperrin commented 8 years ago

@maxwellmb FYI I know you're moving right now so ignore this until you are settled in Pasadena! I am just updating issues and tags during hack day.