eeveetza / Py1812

Python Implementation of Recommendation ITU-R P.1812
GNU General Public License v3.0
7 stars 1 forks source link

AttributeError due to Non-existent 'now' Attribute in NumPy Module #2

Closed drcaguiar closed 7 months ago

drcaguiar commented 7 months ago

I encountered an issue in line 205 of the script, where the following code is used to open a log file:

fid_log = open('P1812_' + str(np.floor(np.now*1e10)) + '_log.csv','w')

This results in an AttributeError:

AttributeError: module 'numpy' has no attribute 'now'

It seems that the intention is to create a timestamp for the log file name, but np.now is not a valid attribute of the numpy module. I believe the correct function should be datetime.now() from the datetime module, which would provide the current timestamp.

The correct line of code would likely be:

fid_log = open('P1812_' + datetime.datetime.now().strftime('%Y%m%d%H%M%S%f') + '_log.csv', 'w')

This would use the current date and time to generate a unique file name for the log file.

eeveetza commented 7 months ago

Thank you very much for the correction. It has been applied in the dev branch and I think that the issue can be closed.