fatpack icon indicating copy to clipboard operation
fatpack copied to clipboard

Error in find_rainflow_ranges for boundary cases

Open abhijeet-pandey opened this issue 3 years ago • 5 comments

find_rainflow_ranges gives error for arbitrary numpy array. For example if the array doesn't contain any cycles - fatpack.find_rainflow_ranges(np.array([1,2,3,4,5]), return_means=True, k=2**14) produces error.

image

abhijeet-pandey avatar Oct 25 '22 00:10 abhijeet-pandey

Hey @abhijeet-pandey,

Since you mention "arbitrary": Are there more cases which gives error than if an array does not contain any cycles?

For the case of no cycles in the array, there should at the very least be a different error (FatpackError?) and more descriptive error message. A better solution would perhaps be if an empty array was returned since there are no cycles. I will think a bit more on this issue, but I welcome any help or comments.

Best regards, Gunnstein

Gunnstein avatar Nov 01 '22 09:11 Gunnstein

I agree, that in case of no cycles - it should return empty array or None. Yes, I did observe this error on a long data set (gigabyte size) that I had which is hard to share. One characteristic of the data was that it had sections with no cycles. Hence, I tried fatpack with artificial data with no cycles and was able to reproduce the same error. I hacked myself out of this error by using a try-except block over the if statement throwing the error and do nothing (do a "pass") in case of an exception. This may not be a correct approach though.

abhijeet-pandey avatar Nov 01 '22 23:11 abhijeet-pandey

Just thinking out loud but would a strain history of np.array([1,2,3,4,5] result in a single residual/half cycle as there is a cycle initiated but not closed.

wweijtje avatar Jun 26 '23 09:06 wweijtje

Half cycle as per the pagoda method.

On Mon, 26 June 2023, 19:43 wweijtje, @.***> wrote:

Just thinking out loud but would a strain history of np.array([1,2,3,4,5] result in a single residual/half cycle as there is a cycle initiated but not closed.

— Reply to this email directly, view it on GitHub https://github.com/Gunnstein/fatpack/issues/14#issuecomment-1607097499, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF3LUVYPYRRDJ67XDK3NXOLXNFKVBANCNFSM6AAAAAARNPHLZI . You are receiving this because you were mentioned.Message ID: @.***>

abhijeet-pandey avatar Jun 27 '23 10:06 abhijeet-pandey