Unhandled exception thrown in AveragedCrossspectrum constructor
See original GitHub issueIf we create two lightcurves and then create an AveragedCrossspectrum
without specifying the segment size. The following exception gets thrown: TypeError: unsupported operand type(s) for /: ‘NoneType’ and ‘float’.
The full traceback:
File "\<stdin\>", line 1, in <module>
File "\~/stingray/crossspectrum.py", line 541, in __init__
Crossspectrum.__init__(self, lc1, lc2, norm, gti=gti)
File "\~/stingray/crossspectrum.py", line 137, in __init__
self._make_crossspectrum(lc1, lc2)
File "\~/stingray/crossspectrum.py", line 606, in _make_crossspectrum
self._make_segment_spectrum(lc1, lc2, self.segment_size)
File "\~/stingray/crossspectrum.py", line 573, in _make_segment_spectrum
dt=lc1.dt)
File "\~/stingray/gti.py", line 597, in bin_intervals_from_gtis
nbin = np.long(chunk_length / dt)
TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Eclipse says "unhandled exception" in a constructor method ...
You are throwing an exception inside constructor, but didn't specify throws clause in method signature, which is compile time error, ...
Read more >Can Constructors Throw Exceptions in Java - Rollbar
The short answer is yes! Of course, properly implementing exceptions in your constructors is essential to getting the best results.
Read more >Function try block handlers (C++ only) - IBM
A function try block on main() does not catch exceptions thrown in destructors of objects with static storage duration, or constructors of namespace...
Read more >Throwing Exceptions in Constructors - Baeldung
It's not uncommon to throw an exception during the instantiation of an object. In this article, we'll examine all the details about throwing...
Read more >AWS Lambda function errors in C# - AWS Lambda
Syntax. In the initialization phase, exceptions can be thrown for invalid handler strings, a rule-breaking type or method (see Lambda function handler ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@matteobachetti So for now, best solution is to make
segment_size
a non-optional parameter. That way user will at least have an interpretable error message.@haroonrashid235 @omargamal8 I would rather force the user to specify it. I think that this is a parameter that users should choose explicitly and carefully. Also, it should not be separated from the bin time! We might easily create memory overflows or useless results. We might set a default value based on a certain number of bins, and check that we don’t go further than the GTIs in the observation… In summary, it’s more complicated than it seems, and for now I would just tell the user to act responsibly 😄
(@dhuppenkothen: what do you think about this?)