[racket] Hello and a few questions

From: Neil Toronto (neil.toronto at gmail.com)
Date: Wed Feb 4 12:31:45 EST 2015

Awesome! It's great to have you with us.

On 02/04/2015 05:28 AM, Marmaduke Woodman wrote:
>
> [...]
>
> 1) The plotting library doesn't seem to have the equivalent of
> MATLAB/MatPlotLib's imagesc/imshow, which simply plots a rectangular
> colormap of the matrix. [1]

You can use Plot and `images/flomap` together to do this, but it would 
be nice to make it easier.

To get you started, here's an adaptation of the plotting example from 
the "Overview" section of the flomap docs:


#lang racket

(require images/icons/misc  ; for bomb-flomap
          plot/utils         ; for color-seq
          images/flomap
          plot)

(define icon-fm (bomb-flomap #:bomb-color "orange" #:height 64))
(flomap->bitmap icon-fm)

(define-values (icon-width icon-height) (flomap-size icon-fm))

;; Plot the red channel
(plot (contour-intervals
        (λ (x y) (flomap-bilinear-ref icon-fm 1 x (- icon-height y)))
        #:levels 10
        #:colors (λ (ivls) (color-seq "black" "white" (length ivls)))
        #:contour-styles '(transparent)
        #:samples (+ 1 icon-height)
        -0.5 (+ 0.5 icon-width)
        -0.5 (+ 0.5 icon-height)))

> 2) Arbitrary meshes in 3D: say I have a set of vertices and triangles.
> How can I plot the mesh and change edge & face properties? Given that 3D
> surface plotting is possible, plotting meshes seems necessarily possible
> but is not documented. Do I need to use GL for this?

Previously, Plot could only handle meshes that had two dimensions 
aligned to a grid. Now it has a decent 3D backend that can handle any 
mesh, but I haven't added a `triangles` function to it yet.

The "pict3d" package, which uses OpenGL, can do this easily, but it's 
not ready for serious use yet. I just got it to run on all 3 of our 
officially supported platforms (Windows, Mac, Linux).

> 3) The array & linear algebra libraries were a happy find. Is there any
> way I can contribute there?

Yes. Very yes! We most need a `math/signal` module, and matrix LUP, SVD, 
and Eigen decompositions.

I'd like to hook the matrix library into LAPACK on systems where it's 
available. But defining FFIs as an advanced task, worth trying only 
after you've programmed in Racket for a while.

> Are there plans to flesh out a larger set of
> scientific libraries as in SciPy (optimization, signal processing, for
> example)

Yes! If you'd like to work on any of these, we'd love it if you'd 
contribute.

Be aware that, like SciPy, we can't accept anything derived from 
GPL-licensed code such as the GNU Scientific Library or R's standard 
library. We *can* accept anything derived from code licensed at least as 
permissively as ours (which is LGPL), such as SciPy (which is BSD) or 
C++'s Boost (which has its own permissive license).

> 4) Do any signal processing packages currently exist? I couldn't find
> anything on planet. Specifically I'd just like to design and apply a
> Butterworth filter to data, so maybe I can write that up myself, but
> existing work is welcome.

The "rsound" package does signal processing. I don't know how much of it 
is in its public API. The only signal-processing-related functions in 
Racket's standard library are in `math/array`: `array-fft` and its 
inverse, and corresponding per-axis FFT functions.

Again, we'd love to get contributions, and welcome to the club!

Neil ⊥


Posted on the users mailing list.