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

data type constraints issue #86

Open
X-Fan-Jack opened this issue Oct 27, 2024 · 1 comment
Open

data type constraints issue #86

X-Fan-Jack opened this issue Oct 27, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@X-Fan-Jack
Copy link

Dear developer,

I am using Python and trying to calculate the soundscape index.

the code is

ssid, excl = sspy.isd.validate(data, allow_paq_na=False)
ssid = sspy.surveys.add_iso_coords(ssid)

Then I found that some records might have date-type issues, which results in a long number, as shown below.
_20241027103555

I'm speculating that the reason for this is that numpy did a big update(v2.1.0) on August 18th. This may lead to an update of some of the underlying methods.
Although users can add their own data type checks, if you can add data type constraints and transformation rules to the library, this will reduce the potential use risk and make the project more robust.

Best regards!

@MitchellAcoustics
Copy link
Owner

Hi, thanks for submitting!

I don't think the numpy update should be the issue - numpy 2.1 should be outside the allowed range based on other dependencies anyway (specifically pandas and numba). I can't even force my environment to install numpy 2.1.0, since the numba version installed with pandas requires numpy<=2.0: ImportError: Numba needs NumPy 2.0 or less. Got NumPy 2.1.

How are you setting up your environment? A fresh install of soundscapy should by default be using less than numpy 2.1.

That said, this isn't really an issue with the data type. The ISO values are floats (float64), which is correct. These just happen to be essentially zero, which I think due to floating point calculations ends up just 'close to' zero. We could solve it by adding a round to the surveys.processing.calculate_iso_coords function, but I'm not sure I see the necessity.

@MitchellAcoustics MitchellAcoustics added bug Something isn't working question Further information is requested and removed question Further information is requested labels Oct 27, 2024
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