d-chambers / Detex

A Python package for subspace detection and waveform similarity clustering
Other
32 stars 6 forks source link

Report 'list' object has no attribute 'tolist' error and failed to write ss_info to SubSpace.db #26

Open gnpang opened 8 years ago

gnpang commented 8 years ago

When I run ss.detex with after ss.SVD(threshold =0.15), it failed to write the ss_info to the SubSpace.db and report error: 'list' object has no attribute 'tolist'. I check the code and it seems that the self.histSubSpace[sta][skey] will return a list not an array. image image image I run ss.detex before with the whole year continuous data and threshold in SVD is none, it worked well and didn't report this error. This time I run ss.detex just in April which station US.HILD has no continuous data in this month, the error occurred. Now, I'm running ss.detex in the April data with threshold in SVD equal none and see if this error would occur again.

d-chambers commented 8 years ago

I will look into this. It is probably just a mater of explicitly casting the output of the previous function as a list or array, I am not sure at the moment. The ss_info table contains information of the processing (filters, decimation factors, data type etc.) but the detection info should have been written to the database. Can you initiate a SSResults instance on the database even though the ss_info table wasn't written or does that cause an error?

gnpang commented 8 years ago

I tried threshold=None in SVD for April data for all five stations, it still reports this error. In these five stations, US.HLID has no continuous data in whole April. image Interesting thing is that I run another case just with MB.MOMT and MB.MCMT these two station, this error didn't show. Maybe the data-miss in US.HLID caused this error. I still can create a SSResults instance but miss the ss_info, sg_info, ss_hist and sg_hist. I'll try running this without US.HLID to see if this error would occur again. image

gnpang commented 8 years ago

After I removed the US.HLID from StationKey, which has no continuous data in April, it worked well. It seems that it will return a list to ss_hist when some stations have no continuous data in the periods input to the detex.

d-chambers commented 8 years ago

For now I am going to wrap the json.dumps call in a try except until I get to writing automated tests for this part of detex. I will push the current (experimental) version of detex to the develop branch. It should fix many of the issues you were having, but of course there may still be some things to work out.