Comments (7)
Same issue with Python 3.x.
Created branch issue22 for solving it
from straintool.
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:
- 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
- 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
- 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.
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.
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.
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.
Λοιπόν,
το πρώτο λάθος ήταν λόγω διαφοράς python2.x με python3.x στη συνάρτηση floor() --να το θυμόμαστε για το μέλλον· η μία επιστρεφει float η άλλη int--. Διορθώθηκε ώστε να δουλεύει και με τις δύο.
Το δεύτερο, είναι άσχετο. Είχα βάλει μια παράμετρο στη συνάρτηση numpy.linalg.lstsq() για να μη βγαίνει αυτό το FutureWarning (δε ξέρω αν βγαίνει και σε σενα, είναι απλά warning και όχι error). Στο δικό μου pc έπιασε αλλά σε εσένα δεν πιάνει οπότε κάτι παίζει με τις εκδόσεις πάλι (python ή scipy).
Το ξαναέβγαλα, να είναι όπως πρίν και θα ανοίξω ένα καινούριο issue ώστε να το λύσουμε κάποια στιγμή.
Για κάνε pull, test, merge κτλ...
from straintool.
το τεσταρα και φαίνεται κομπλε οπότε το κάνω merge στο dev-danast και κλείνω μετά το issue
from straintool.
Related Issues (20)
- code commenting
- -r / --region switch fails if not set HOT 2
- gmtplots: scale of gridded data not plotted correctly HOT 2
- method Veis: check and readme
- One tensor (barycenter) not working?
- [gmtplots...] bc not woring for windows
- strain.py: calculate sd of second invariant HOT 1
- magnitude of sd
- Multithreading is different between Linux and Windows HOT 1
- generate delaunay tr: more triangles than real
- generate-statistics flag
- sVn sVe must not be zero! HOT 2
- input file duplicate lines stop processing HOT 2
- No Example input file HOT 16
- Invalid UTM Zone HOT 10
- multicore proc error for Windows 10 HOT 2
- Map size changes with different Wt HOT 1
- Bug with Multiple UMT zones and the veis method HOT 2
- Add the main article to the project HOT 1
- straintool HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from straintool.