Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate negative flux errors #24

Open
juanep97 opened this issue Oct 10, 2023 · 1 comment
Open

Investigate negative flux errors #24

juanep97 opened this issue Oct 10, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@juanep97
Copy link
Owner

juanep97 commented Oct 10, 2023

Sometimes a negative flux is saved in the database as aperphot result. This gives an error downstream as in:

2023-10-10 20:42:11 - iop4lib.telescopes.cahat220 [cahat220.py:343] - DEBUG - Computing relative polarimetry for <AstroSource S4 0954+65 4>.                                                                2023-10-10 20:42:11 - iop4lib.telescopes.cahat220 [cahat220.py:417] - WARNING - polarimetry_group=[ReducedFit.objects.get(id=52269), ReducedFit.objects.get(id=52272), ReducedFit.objects.get(id=52271), ReducedFit.objects.get(id=52270)]: negative flux mean encountered while relative polarimetry for astrosource=AstroSource.objects.get(name='S4 0954+65 4') ??!! It will be nan, but maybe we should look into th
is...                                                                                                                                                                                                       
Traceback (most recent call last):                                                                                                                                                                          
  File "/home/vhega/miniconda3/envs/iop4/bin/iop4", line 8, in <module>                                                                                                                                     
    sys.exit(main())                                                                                                                                                                                        
  File "/home/vhega/iop4/iop4lib/iop4.py", line 195, in main                                                                                                                                                
    process_epochs(epochs_to_process, args.force_rebuild, check_remote_list=~args.skip_remote_file_list)                                                                                                    
  File "/home/vhega/iop4/iop4lib/iop4.py", line 65, in process_epochs                                                                                                                                       
    epoch.compute_relative_polarimetry()                                                                                                                                                                    
  File "/home/vhega/iop4/iop4lib/db/epoch.py", line 674, in compute_relative_polarimetry                                                                                                                    
    return list(map(f, clusters_L))                                                                                                                                                                         
  File "/home/vhega/iop4/iop4lib/db/epoch.py", line 672, in <lambda>                                                                                                                                        
    f = lambda x: Telescope.by_name(self.telescope).compute_relative_polarimetry(x, *args, **kwargs)                                                                                                        
  File "/home/vhega/iop4/iop4lib/telescopes/cahat220.py", line 419, in compute_relative_polarimetry                                                                                                         
    mag_inst = -2.5 * math.log10(flux_mean)                                                                                                                                                                 
ValueError: math domain error                                                                                                                                                                               
(iop4) vhega@quasar:~$     

Also, this error is not catched anywhere and breaks the pipeline execution.

Ocurrences (IOP4 version main @ d9d65f2).

  • During relative photo-polarimetry reduction for source "S4 0954+65 4" in CAHA-T220/2023-10-09/caf-20231010-03:36:55-sci-agui.fit.
@juanep97 juanep97 added the bug Something isn't working label Oct 10, 2023
@juanep97 juanep97 self-assigned this Oct 10, 2023
@juanep97 juanep97 pinned this issue Oct 10, 2023
juanep97 added a commit that referenced this issue Oct 11, 2023
iop4 was stopping when flux_counts < 0 encountered

decided i is better to continue after the error so no good data is lost

changed math.log10 to np.log10 so it continues, returning nans instead of errors

debugging still necessary to be sure about the origin of these errors 

we keep issue #24 open for this reason
@morcuended
Copy link
Collaborator

Let's write here whatever instances of this kind of errors we find and debug, so we can make an informed decision about how to treat them.

@juanep97 juanep97 unpinned this issue Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants