dalejn / cleanBib

Probabilistically assign gender and race proportions of first/last authors pairs in bibliography entries
MIT License
149 stars 31 forks source link

Error with Step 4 #28

Closed eapower closed 3 years ago

eapower commented 3 years ago

Hi all, Thanks for putting together this great tool!

Here's the error I'm getting when trying to run Step 4:

/srv/conda/envs/notebook/lib/python3.7/site-packages/numpy/core/fromnumeric.py:3373: RuntimeWarning: Mean of empty slice.
  out=out, **kwargs)
/srv/conda/envs/notebook/lib/python3.7/site-packages/numpy/core/_methods.py:170: RuntimeWarning: invalid value encountered in double_scalars
  ret = ret.dtype.type(ret / rcount)

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-625af8419025> in <module>
    175         idx = idx + 1
    176 
--> 177 mm,wm,mw,ww = np.mean(gender,axis=0)*100
    178 WW,aw,wa,aa = np.mean(race,axis=0)*100
    179 

TypeError: cannot unpack non-iterable numpy.float64 object

Any help troubleshooting would be great!

Thanks!

dalejn commented 3 years ago

Hi, thanks so much for using this tool! Could you send a Dropbox link to the .bib file or attach it here? I'll try to recreate the error and see what the issue might be.

eapower commented 3 years ago

Of course! Here's a Dropbox download link: https://www.dropbox.com/t/80MHN5XBYi1JSXl1

If it matters, the first and last authors are both women. The bib file was showing as clean.

dalejn commented 3 years ago

Hi, thanks again for checking out this tool! It looks like the problem was that we hadn't had a user create the .bib file using BibDesk before. It looks like they output the field variable names capitalized. In the .bib file, if I Ctrl+F 'Author' and replace all cases with 'author' the code works. In the next patch, we'll replace the field search to be less brittle and not case-sensitive.

After that, there seemed to be some issue with the bradbury1998principles citation in particular--I replaced it with the following from Google Scholar:

@article{bradbury1998principles, title={Principles of animal communication}, author={Bradbury, Jack W and Vehrencamp, Sandra L}, year={1998} }

I've emailed you the outputs of the code which should be in the right ballpark--you may want to re-run it, because I wasn't sure who the first author was and so used your name as first and last author.