Subject: [Thuban-list] [Patch] Custom+automatic classifiers

From: "Daniel Calvelo Aros" <[email-masked]>
Date: Fri, 20 Feb 2004 19:30:06 -0500

Hi.

And last but not least, the custom breaks classifier. This one needs support
files contained in the tar.gz archive, and this patch should be applied
*after* the previous two.

Changes: general docstringification, more intuitive break-marker movement (I
will not say how those little triangles work; try it please, and tell me if
it's intuitive enough or needs online help).

Daniel.

-- Daniel Calvelo Aros
-- Dirección General de Información Agraria
-- Ministerio de Agricultura del Perú
-- (51-1)424-9001

---

From: "Moritz Lennert" <[email-masked]>
Date: Mon, 23 Feb 2004 10:00:07 +0100 (CET)

> *after* the previous two.

actually it seems to be incompatible with the two other patches (or with
the current (23/2/04) CVS).

After applying the discont patch (on a clean cvs), I get:

patch -p0 < class-custom+auto.patch
patching file thuban/Thuban/Model/classgen.py
Hunk #1 succeeded at 335 (offset -1 lines).
Hunk #2 succeeded at 509 with fuzz 1 (offset -1 lines).
patching file thuban/Thuban/UI/classgen.py
Hunk #1 succeeded at 18 (offset -1 lines).
Hunk #2 FAILED at 27.
Hunk #3 succeeded at 48 (offset -2 lines).
Hunk #4 succeeded at 106 (offset -2 lines).
Hunk #5 succeeded at 234 (offset -2 lines).
Hunk #6 succeeded at 299 (offset -2 lines).
Hunk #7 succeeded at 325 (offset -2 lines).
Hunk #8 succeeded at 971 (offset -2 lines).
Hunk #9 succeeded at 1209 (offset -2 lines).
1 out of 9 hunks FAILED -- saving rejects to file
thuban/Thuban/UI/classgen.py.rej

and thuban/Thuban/UI/classgen.py.rej:

***************
*** 27,38 ****
  from Thuban.Model.range import Range
  from Thuban.UI.common import ThubanBeginBusyCursor, ThubanEndBusyCursor

  import classifier, resource

  from Thuban.Model.color import interpolate_rgb, interpolate_hsv
! from Thuban.Model.classgen import \
!     generate_uniform_distribution, generate_singletons,
generate_quantiles, \
!     generate_ranges_from_list, classify_discont, \
      CustomRamp, grey_ramp, red_ramp, green_ramp, blue_ramp,
green_to_red_ramp, \
      HotToColdRamp, FixedRamp

--- 27,42 ----
  from Thuban.Model.range import Range
  from Thuban.UI.common import ThubanBeginBusyCursor, ThubanEndBusyCursor

+ from Thuban.Model.histogram import bincount, histcount
+ from Thuban.UI.graph import BinHistogram, PointDensityGram
+ from Thuban.UI.sliders import Sliders
+
  import classifier, resource

  from Thuban.Model.color import interpolate_rgb, interpolate_hsv
! from Thuban.Model.classgen import generate_ranges_from_list,\
!     generate_uniform_distribution, generate_singletons,
generate_quantiles,\
!     classify_discont, classify_kmeans, classify_annealing, \
      CustomRamp, grey_ramp, red_ramp, green_ramp, blue_ramp,
green_to_red_ramp, \
      HotToColdRamp, FixedRamp

And after applying the hsv-v2 patch (on a clean cvs):

patch -p0 < class-custom+auto.patch
patching file thuban/Thuban/Model/classgen.py
Hunk #1 FAILED at 336.
Hunk #2 succeeded at 312 with fuzz 2 (offset -198 lines).
1 out of 2 hunks FAILED -- saving rejects to file
thuban/Thuban/Model/classgen.py.rej
patching file thuban/Thuban/UI/classgen.py
Hunk #2 FAILED at 28.
Hunk #3 FAILED at 50.
Hunk #4 FAILED at 108.
Hunk #5 FAILED at 236.
Hunk #6 FAILED at 301.
Hunk #7 FAILED at 327.
Hunk #8 FAILED at 973.
Hunk #9 succeeded at 1068 with fuzz 2 (offset -143 lines).
7 out of 9 hunks FAILED -- saving rejects to file
thuban/Thuban/UI/classgen.py.rej

with thuban/Thuban/Model/classgen.py.rej (just an empty line too much):

***************
*** 336,341 ****
                  [(q, (q - minIndex+1) / float(numValues)) \
                   for q in quantiles])

  # TODO: implement Jenks & Caspall completely.

  if not  __builtins__.has_key("sum"): # Python < 2.3
--- 336,342 ----
                  [(q, (q - minIndex+1) / float(numValues)) \
                   for q in quantiles])

+
  # TODO: implement Jenks & Caspall completely.

  if not  __builtins__.has_key("sum"): # Python < 2.3

and thuban/Thuban/UI/classgen.py.rej attached.

Moritz

---

From: "Moritz Lennert" <[email-masked]>
Date: Mon, 23 Feb 2004 10:22:12 +0100 (CET)

I just tried applying the patch directly to a fresh cvs tree without
applying one of the other two patches and it seems that the
incompatibility is with the cvs tree and not with class-discont.patch:

Hunk #2 succeeded at 311 with fuzz 2 (offset -199 lines).
Hunk #3 FAILED at 49.
Hunk #4 FAILED at 107.
Hunk #5 FAILED at 235.
Hunk #6 FAILED at 300.
Hunk #7 FAILED at 326.
Hunk #8 FAILED at 972.
Hunk #9 succeeded at 1066 with fuzz 2 (offset -145 lines).

with thuban/Thuban/Model/classgen.py.rej:

***************
*** 336,341 ****

+

So, Daniel, would it be possible to create one patch containing all your
latest changes against a fresh CVS tree ? Right now, I cannot combine the
new version of the discont method with your other classification methods,
not with the hsv patch.

Moritz

Moritz

---

From: "Daniel Calvelo" <[email-masked]>
Date: Thu, 26 Feb 2004 19:01:36 -0500

On Mon, 23 Feb 2004 10:22:12 +0100 (CET), Moritz Lennert wrote
> incompatibility is with the cvs tree and not with class-discont.patch:
[...]
> latest changes against a fresh CVS tree ? Right now, I cannot 
> combine the new version of the discont method with your other 
> classification methods, not with the hsv patch.
> 
> Moritz

Ok, attached are a big patch for HSV and all four classifiers, and a tar.gz
for the supplemental files neeeded to make the custom classifier work. I
tested against CVS from 20040218 and it works. Be sure to decompress the
tar.gz in ../thuban.

Daniel.

-- Daniel Calvelo Aros

---

From: "Moritz Lennert" <[email-masked]>
Date: Fri, 27 Feb 2004 16:01:42 +0100 (CET)

> tested against CVS from 20040218 and it works. Be sure to decompress the

Thank you !

Now everything is very easy and works great !

Moritz