Giter Club home page Giter Club logo

Comments (7)

xanthospap avatar xanthospap commented on September 26, 2024

Same issue with Python 3.x.
Created branch issue22 for solving it

from straintool.

xanthospap avatar xanthospap commented on September 26, 2024

Bug description:
(for now handle only positive ranges):
input: x_min=18.75, x_max=30.25, x_step=2
the Grid class, will divide the range, to see how many points on the axis, i.e.
xpts = (x_max-x_min)/x_step = 5.75!!
But we cannot have 5.75 points. We can either have 5 points in which case the range will actually be:
[18.75, 28.75] or 6 points in which case the range will be [18.75, 30.75].
What do we want to do?
Options for solving:

  1. Always leave the max limit out (round towards the previous integer). That is if the number of points is 5.75 or 5.15 or 5.95, make it 5
  2. Always take the max limit in (round towards the next integer). That is if the number of points is 5.75 or 5.15 or 5.95, make it 6
  3. Depend on number of points (round towards the nearest integer). That is if the number of points > 5.5 make it 6, else make them 5.
    We should not chose 2 probably, but 1 and 3 are equally ok.
    Μητς τι λες;;

from straintool.

demanasta avatar demanasta commented on September 26, 2024

As a first solution, I think is better to follow option 1 (leave the max limit out) so that the grid will not come out of the point area.. ee??

from straintool.

xanthospap avatar xanthospap commented on September 26, 2024

OK.
Έκανα τη λύση που είπαμε, άρα πάντα στο grid: x_min + xpts * x_step <= x_max (και ομοίως για τα y), άρα πάντα το μαξ είναι αυστηρό (δεν το υπερβαίνουμε ποτέ). Από την άλλη, μπορεί να είμαστε έως και x_step πιο πρίν από αυτό (σε μία ακραία περίπτωση, μπορεί κανονικά η διαίρεση (x_max-x_min)/x_step να έβγαινε 5.999.... το οποίο θα γίνει 5 ακριβώς, οπότε θα είμαστε 0.999*x_step πρίν το x_max)
Έκανα τις αλλαγές σε ένα καινούριο branch το issue22. Κάνε pull, επιβεβαίωσε κι εσύ κανα δύο παραδείγματα και αν είναι κομπλέ κάνουμε merge και κλείνουμε το issue.

from straintool.

demanasta avatar demanasta commented on September 26, 2024

First run ...

Traceback (most recent call last):
  File ".\StrainTensor.py", line 257, in <module>
    print('[DEBUG] {:5d}/{:7d}'.format(node_nr+1, grd.xpts*grd.ypts), end="\r")
ValueError: Unknown format code 'd' for object of type 'float'

Αν το ξεπεράσουμε αυτό το Print κολλάει στο επόμενο :

Traceback (most recent call last):
  File "./../bin/StrainTensor.py", line 263, in <module>
    sstr.estimate()
  File "build/bdist.linux-x86_64/egg/pystrain/strain.py", line 774, in estimate
  File "/usr/lib/python2.7/dist-packages/numpy/linalg/linalg.py", line 1915, in lstsq
    0, work, -1, iwork, 0)
TypeError: a float is required

from straintool.

xanthospap avatar xanthospap commented on September 26, 2024

Λοιπόν,
το πρώτο λάθος ήταν λόγω διαφοράς python2.x με python3.x στη συνάρτηση floor() --να το θυμόμαστε για το μέλλον· η μία επιστρεφει float η άλλη int--. Διορθώθηκε ώστε να δουλεύει και με τις δύο.
Το δεύτερο, είναι άσχετο. Είχα βάλει μια παράμετρο στη συνάρτηση numpy.linalg.lstsq() για να μη βγαίνει αυτό το FutureWarning (δε ξέρω αν βγαίνει και σε σενα, είναι απλά warning και όχι error). Στο δικό μου pc έπιασε αλλά σε εσένα δεν πιάνει οπότε κάτι παίζει με τις εκδόσεις πάλι (python ή scipy).
Το ξαναέβγαλα, να είναι όπως πρίν και θα ανοίξω ένα καινούριο issue ώστε να το λύσουμε κάποια στιγμή.
Για κάνε pull, test, merge κτλ...

from straintool.

demanasta avatar demanasta commented on September 26, 2024

το τεσταρα και φαίνεται κομπλε οπότε το κάνω merge στο dev-danast και κλείνω μετά το issue

from straintool.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.