2
$\begingroup$

The goal is to vary the order parameters in wavelet transforms in the Manipulate environment. The various transformations have arguments of different rank. For example,

HaarWavelet[] has no order argument.

DaubechiesWavelet[m] has a single order argument $m$ and the desire is to present choices for $m$.

BiorthogonalSplineWavelet[m,n] has an order parameter $m$ and a dual order parameter $n$ and the desire is to let the user control $m$ and $n$.

The current state of my effort is this:

data = DiskMatrix[10]; Manipulate[ dwt = DiscreteWaveletTransform[dat32, wavelet]; gdwd = WaveletMatrixPlot[dwt] , {wavelet, {HaarWavelet[], DaubechiesWavelet[], MeyerWavelet[]}}]

enter image description here

The different transforms can be selected, but there is no capability to change the order parameters. How can order parameters be introduced?

$\endgroup$
2
  • $\begingroup$ Related: (7040), (56665) $\endgroup$
    – Mr.Wizard
    Jun 13, 2015 at 2:23
  • $\begingroup$ MrW: valuable insights. Thank you. $\endgroup$
    – dantopa
    Jun 15, 2015 at 14:42

1 Answer 1

4
$\begingroup$

I'm pretty sure there ought to be something cleaner. While we wait for a better answer, you may use this to return the minimum and maximum number of arguments allowed for each wavelet:

nArgs[fun_] := 
 StringCases[ToString@DownValues@fun, 
            Shortest["ArgumentCountQ"~~__~~(n1:NumberString)~~__~~ (n2:NumberString)] :> 
            ToExpression[{n1, n2}]]


{#, nArgs@#} & /@ ToExpression /@ Names["*Wavelet"]

(*
{{BattleLemarieWavelet, {{2, 2}}}, 
 {BiorthogonalSplineWavelet, {{2, 2}}}, 
 {CDFWavelet, {{1, 1}}}, 
 {CoifletWavelet, {{1, 1}}}, 
 {DaubechiesWavelet, {{1, 1}}}, 
 {DGaussianWavelet, {{1, 1}}}, 
 {GaborWavelet, {{1, 1}}}, 
 {HaarWavelet, {{0, 0}}}, 
 {MexicanHatWavelet, {{1, 1}}}, 
 {MeyerWavelet, {{2, 2}}}, 
 {MorletWavelet, {{0, 0}}}, 
 {PaulWavelet, {{1, 1}}}, 
 {ReverseBiorthogonalSplineWavelet, {{2, 2}}}, 
 {ShannonWavelet, {{1, 1}}}, 
 {SymletWavelet, {{1, 1}}}}
*)

So:

m[fun_] := nArgs[fun][[1, 2]]
d = DiskMatrix[10];
Manipulate[
 WaveletMatrixPlot@DiscreteWaveletTransform[d, wv[Sequence @@ x[[;; m@wv]]]],
 {{x, {1, 1}}, ControlType -> None},
 {wv, {HaarWavelet, DaubechiesWavelet, MeyerWavelet}}, 
 Dynamic@Panel@Grid[{Slider[Dynamic@x[[#]], {0, 10, 1}], x[[#]]} & /@ Range@m@wv]]

Mathematica graphics

$\endgroup$
1
  • $\begingroup$ Cleaner is better. Nice idea. $\endgroup$
    – dantopa
    Jun 15, 2015 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.