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

Trouble reading BC03 .ised files #5

Closed
boada opened this issue Apr 1, 2019 · 2 comments · Fixed by #6
Closed

Trouble reading BC03 .ised files #5

boada opened this issue Apr 1, 2019 · 2 comments · Fixed by #6

Comments

@boada
Copy link
Contributor

boada commented Apr 1, 2019

I'm having some trouble reading these files under python3.6. In the utils.py there is some reading of the binary files, line

junk = _read_binary(fh, type='c', number=80)
. The typecode c is deprecated after python3.5. I changed them to b, now I am getting another error.


IndexError Traceback (most recent call last)
in
----> 1 model2 = ezgal.model('/home/boada/Projects/BC2003/bc03/newiseds/1_0gyr_hr_m62_salp.ised')

~/.local/lib/python3.6/site-packages/ezgal/ezgal.py in init(self, model_file, is_ised, is_fits, is_ascii, has_masses, units, age_units, skip_load)
207 has_masses=has_masses,
208 units=units,
--> 209 age_units=age_units)
210
211 #####################

~/.local/lib/python3.6/site-packages/ezgal/ezgal.py in _load(self, model_file, is_ised, is_fits, is_ascii, has_masses, units, age_units)
247 # test for a bruzual-charlot binary ised file
248 if model_file[len(model_file) - 5:] == '.ised' or is_ised:
--> 249 self._load_ised(self.filename)
250 else:
251 # And then the rest.

~/.local/lib/python3.6/site-packages/ezgal/ezgal.py in _load_ised(self, file)
2507
2508 # read ised file
-> 2509 (seds, ages, vs) = utils.read_ised(file)
2510
2511 # store ages

~/.local/lib/python3.6/site-packages/ezgal/utils.py in read_ised(file)
477 sinds = vs.argsort()
478
--> 479 return (seds[sinds, :], ages, vs[sinds, :])

IndexError: too many indices for array

So now there is some indexing problems... @cmancone do you have a minute to look at this?

@boada
Copy link
Contributor Author

boada commented Apr 2, 2019

If I leave everything as is, I still get the same issue. This time with python2.7.


IndexError Traceback (most recent call last)
in ()
----> 1 model = ezgal.model('/home/boada/Projects/BC2003/bc03/newiseds/1_0gyr_hr_m62_salp.ised')

/home/boada/.local/lib/python2.7/site-packages/ezgal/ezgal.pyc in init(self, model_file, is_ised, is_fits, is_ascii, has_masses, units, age_units, skip_load)
207 has_masses=has_masses,
208 units=units,
--> 209 age_units=age_units)
210
211 #####################

/home/boada/.local/lib/python2.7/site-packages/ezgal/ezgal.pyc in _load(self, model_file, is_ised, is_fits, is_ascii, has_masses, units, age_units)
247 # test for a bruzual-charlot binary ised file
248 if model_file[len(model_file) - 5:] == '.ised' or is_ised:
--> 249 self._load_ised(self.filename)
250 else:
251 # And then the rest.

/home/boada/.local/lib/python2.7/site-packages/ezgal/ezgal.pyc in _load_ised(self, file)
2507
2508 # read ised file
-> 2509 (seds, ages, vs) = utils.read_ised(file)
2510
2511 # store ages

/home/boada/.local/lib/python2.7/site-packages/ezgal/utils.pyc in read_ised(file)
475 sinds = vs.argsort()
476
--> 477 return (seds[sinds, :], ages, vs[sinds, :])

IndexError: too many indices for array

@boada
Copy link
Contributor Author

boada commented Apr 2, 2019

It seems the problem is in this line

return (seds[sinds, :], ages, vs[sinds, :])

vs is a 1d array, so the ,: bit is causing the problem. If you remove that bit and just return return (seds[sinds, :], ages, vs[sinds]) then I am getting NaNs everywhere when I try to calculate things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant