amusecode / amuse

Astrophysical Multipurpose Software Environment. This is the main repository for AMUSE
http://www.amusecode.org
Apache License 2.0
157 stars 99 forks source link

Errors in textbook examples #533

Closed rieder closed 2 years ago

rieder commented 5 years ago

I am finding several problems with the Textbook examples (which really all should work for a clean, full AMUSE installation), at least in the Python3 version (PR #193). These should be fixed. I did not test with codes like MESA and Mocassin nor did I run very long scripts, so there could be more problems.

This is a tracker issue.

Causes for the scripts to fail include:

ipelupessy commented 5 years ago

with the exception of some str <-> unicode errors, they don't look python3 specific.. random comments:

ipelupessy commented 5 years ago

the TypeError: slice indices must be integers is caused by an integer devision becoming float targetN in evrard_test.py)

ipelupessy commented 5 years ago

the hydrodynamicsclass problem is caused by setting something (gas_particles) that is also defined a property..

ipelupessy commented 5 years ago

(i think, but not tested, that the property must be removed)

rieder commented 5 years ago
  • I don't think the scripts have a reason to import or use AmuseExceptions..

Actually, this error originates higher up, in amuse.io.store_v1. Fixed now.

rieder commented 5 years ago

hydro_grid_minimal.py needs work. It's simply not working at some point (a line that's literally "xxx"). I'm replacing that with an exit() for now.

rieder commented 5 years ago

fixed some of the issues now.

gekaremi commented 5 years ago

Good day!

Most likely both of these questions are very stupid, but:

  1. Is there any list of updated and reliable examples that can be used as a reference and which are definitely functional?

  2. Is it possible to use examples as very computationally expensive tests to check the computational reproducibility of different versions of AMUSE on different devices?

Thank you very much for your attention!

rieder commented 5 years ago

Hi @gekaremi, Re 1): there is no such list. All examples should work, hence this issue. Re 2): you can certainly use the examples as such tests, but they are definitely not designed to be "very computationally expensive". A small comment: please could you next time open a new issue for questions? This helps us in keeping track of different issues/questions/bugs.

rieder commented 5 years ago
ipelupessy commented 5 years ago

@rieder do you know the line in store_v1/2 where this is a problem?

ipelupessy commented 5 years ago

ok, I see it is not a problem of store_v1..I would adapt the 2017.. script to match the byte string type:

        if hasattr(bi, "name") and numpy.bytes_("gas") in bi.name:
            disk.add_particles(bi.copy())
        elif numpy.bytes_("Star") in bi.name:
            stars.add_particles(bi.copy())

the code is a bit ugly anyway..

ipelupessy commented 5 years ago

I am not sure what happens to string attributes that are saved with python3 store now; I think the also be byte strings now, but I am not sure that is the case...

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 28 days if no further activity occurs. Thank you for your contributions.

ipelupessy commented 2 years ago

The only remaining issue is with strings in amuse stores now?

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 28 days if no further activity occurs. Thank you for your contributions.

ipelupessy commented 2 years ago

open new issue for any remaining