Jump to content

Dirk J.

Members
  • Posts

    168
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Dirk J.

  1. Here's an updated example, implementing forward and inverse FFT, in 1D and 2D. enjoy /dirk.
  2. QUOTE (Aristos Queue @ Jul 17 2008, 06:58 PM) Ah, you said the magic words. That solves a whole lot of input/output problems. (it does feel like hacking if a child class wants to access members of its parent class this way - but maybe I haven't thought long enough about that, yet)
  3. QUOTE (Aristos Queue @ Jul 17 2008, 04:50 PM) I get the 'active element' solution. I still run into problems when I have collection of encapsulated strings, and want to display one of them in an indicator on the front panel. Somehow I have to get a string out, or get a reference to the indicator in.
  4. QUOTE (normandinf @ Jul 17 2008, 02:25 PM) You're probably right. I just realized I started the sentence with "And maybe" ... that would probably invoke a lot more "And maybe"'s. Still, can it be done then without accessors?
  5. QUOTE (Aristos Queue @ Jul 17 2008, 02:11 AM) Naaah, I don't think this is hacking, because you're not obviously violating some rule (ok, the boolean, but see below). If I'd want to hack, global variables are obviously the way to go around any of the rules, (also the rules of dataflow :-) but that takes the sport out of it. Using a LV2 global or whatever it's called today, is getting trickier, because of the infamous rule #10 that everything should be part of a class. I can use the Ubergeek-Nirvana but that still requires me to initialize the action classes in some way which is hard without setters. Also in the twighlight zone, is trying to get around the gettersetter issue by wrapping type in in array of type first, and wrapping that in a class. The getter would then return the first element of the array of type, the setter would replace the first element of the array of type and thus perform some action on the data. But then again, even such a class is difficult to initialize since you can't wire type to anything. QUOTE And then, after writing this, I realized that I still have a boolean output from one of my member VIs. This would be solved in C++/Java/C# by having this be a class output that had been taught how to behave as a boolean. We don't have that capacity with LabVIEW classes today*. * LV R&D does not make promises regarding future functionality. You can get around the 'boolean problem' by creating an other index class, increment that in the for loop, and test for equality with the input index class: QUOTE I think that some more contemplation of the rules of this challenge may be required before we can really attempt it. The getter setter rule is also problematic if a child class wants to access data from its parent class. Rule #4 (naturally inforced) and #9 seem to clash here? Maybe the language-specific overall hack prevention rule should be that everything should run by-wire and by-value. Globals are out, Queues are out, FileIO is out, ... And maybe something like "each class is allowed a constructor and destructor in which getters and setters are allowed".
  6. QUOTE (Aristos Queue @ Jul 15 2008, 09:22 PM) Playing around with this, my largest challenge is to initialize a class. Suppose I have a 'collection.lvclass' which has an array of LVobject in its private data. I want to get an element from the collection by index. I can write a method 'get collection element by index' which would be implementing the 'array index' primitive, in the end, but I can't write an integer to it according to the rules. So I encapsulate the index in the private data of an Index.lvclass. Problem number one: how to set the index without using an accessor? I could work around this by writing a method "increment" that works on the index (by incrementing it...) so if I want to access element number by I just call "increment" 5 times. But this only works because its an integer. Turning to the collection: how do I initialize it? Say it contains strings: I can't write a string or an array of strings to an 'init' routine because of the rules. I could choose to encapsulate it, but that only moves the problem... I would have to init these new classes.... Edit 1: I just realized that a "constant" is an incomplete TypeDef and that a TypeDef is a LVclass with some default value and no methods. So I could just init my collection by first defining an enourmous lot of such classes and then adding them one by one to the collection Edit 2: It seems that the collection problem is also raised in the origional post quoted by AristosQueue.
  7. QUOTE (crelf @ Jul 3 2008, 01:59 PM) aargh. ok, your comment about tags was much better... QUOTE (neB @ Jul 3 2008, 02:14 PM) I don't see much hijacking going on, but noise? Some of that noise are more "resonant responses" to non-linear functions. Tolkien wrote in the Silmarilian of the music evolving over time. The final result of the repeated themes was the creation of Middle Earth. If we set up filters to accept only what we expect to hear, we'll never appreciate the harmonics of of the cerebral cords we share. Limiting the bandwidth will only stiffle the creative process. Nipples aside, aside I find LAVA a wondeful place to brainstorm with some of the greatest engineers and scientist in the world. Ben point is, sometimes its hard to actually find answers to a particular question, if half the topic consists of resonant responses. I agree with the nipples aside, but I don't have the spare hours to read all topics each day. anyway, tags and ratings....
  8. QUOTE (crelf @ Jul 3 2008, 03:32 AM) touche!
  9. I'm having a hard time figuring out exactly what you mean, but I'm pretty sure I disagree on both accounts (the beauty of it being, of course, that you can add to /this/ topic allmost endlessly on the 'signal' side) QUOTE (mross @ Jul 1 2008, 08:51 PM)
  10. wouldn't it be fun to calculate the signal to noise ratio of forum topics? say, it's defined as SNR = 10log(#posts on topic / #posts off-topic) immediate inspiration came from this topic which (next to the question) at point of writing had 6 on-topic responses and 11 off-topic responses according to my personal judgement (feel free to disagree!) e.g. a SNR of -2.6 dB. just wondering.
  11. I'm using this (see attachment) Note: apart from wrapping it into a class, there is nothing in there I take credit for: Most of it is 'inspired' on code and examples found around these forums. Specifically, it also includes a 'windowwrapper.dll' that was not written by me. I can't remember where I got it, but it is vital if you want to use .net dialogs.
  12. QUOTE (Aristos Queue @ Jun 13 2008, 06:54 PM) That makes sense, and I guess it also makes it worth while to put some effort in. I'm thinking along these lines, if anyone has comments on this please make them! Some of the design choices may be sub-optimal, but at this point I want to use the existing math VI's without modification (so I can benefit from future versions) This is may inventarization of the curve fitting routines in LV. My most important criterion is that an algorithm should return a covariance matrix so that I can compute error estimates en dependencies etc. Type Coeff?/Covar Mtrx?/ Can be specialization of: Linear Yes/No/ NLLS Exponential Yes/No / NLLS Power Yes/No / NLLS Gauss Yes/No / NLLS Logarithmic Yes/No / NLLS Polynomial No/No / NLLS Gen LS Linear No/Yes*/ NLLS Cubic spline No/No/ Ciruclar No/No/ General NLLS Yes/Yes/ Constrained NLLS No/Yes*/ * covariance matrix is available, so coefficients can be calculated. So, from I versatility-point-of-view I want to build everything on top of the NLLS algorithms. Conceptually, the general NLLS can be thougth of as a specialized case of the constrained NLLS (with parameter bounds -Inf to Inf) but since the LV implementation is somewhat different for both cases I don't want to implement it that way. There will be a curvefit.lvclass wich has the methods Fit and ConstrainedFit (see below for details) ===========fit parameters ============== class parameter (lvobject) // class defining a model parameter members name : string; // for identification and reporting value , // initial guesses at start of program, value at current iteration standard error, // st error of the parameter (diagonal element of covariance matrix) dependency: double; // dependency of the fit on this parameter (0-1 from covariance matrix) methods ExportParameterArray(var coefs: array of double) {dynamic} // adds current value to the coefficients array coefs used in the LM curve fitting ImportParameterArray(coefs: array of double) {dynamic} // extracts the updated value for this parameter from the coefs array used in the LM curve fitting class constrained_parameter (parameter) // child class of paramter.lvclass for a constrained model paramter members vary: enum{yes,no,withinlimits}; // treat parameter as variable (yes), constant (no) or limited variable (withinlimits) upperbound, // when vary=withinlimits, these define the upper and lower bounds for the paramter lowerbound: double; methods ExportParameterArray(var coefs: array of double) {override} // adds current value to the coefficients array coefs depending on the value of vary ImportParameterArray(coefs: array of double) {override} // extracts the updated value for this parameter from the coefs array depending on the value of vary ========= fit models ============= class fitmodel(lvobject) // parent class for custom fit models. members parameters: array of parameter.lvclass; // defines the model parameters (note: can hold child classes of parameters.lvclass as well) X: array of double // X values. (note: these are not allways needed, so I guess I should move this to more specific class) methods Generate {dynamic} // implements the model. virtual method, it must be overwritten class myfitmodel(fitmodel) // implementation of custom model members ............ // can be anything you need to make this model work methods Generate {override} // implements the model. ========= curve fitting ============= class curvefitting(lvobject) // class implementing NLLS curve fitting members model: fitmodel.lvclass; // defines the model Y, // dependent data weights, // weigths to be used in the fit best fit, // holds the best model fit to the data error bounds: array of double // used to calculate confidence and prediction bounds methods Fit {dynamic} // implements the NLLS curve fit FitConstrained {dynamic} // implements the constrained NLLS curve fit FitStatistics // implements the constrained NLLS curve fit
  13. Just wondering... In the newer Non-linear Curve fit VI's (such as <vi.lib>gmath\NumericalOptimization\Nonlinear Curve Fit LM.vi), you need to supply a reference to a VI that implements the model function; you can optionally pass data you need in that VI in a Variant, which you need to de-variant in said VI. Looks to me an ideal usecase for LVOOP: instead of supplying a reference-and-variant you could supply a generic 'modelfunction.lvclass' instance, the lvclass having a virtual 'generate' method, which can be overridden for each specific fit function. Any data you would need (and now have to slip in via the variant) can then be encapsulated in the modelfunction.lvclass. I'm doing a lot of curve fitting these days, so I'm looking for ways to force my programs into a more modular structure before things get out of hand, and I'm the only one left understanding what's going on in the code. I'm thinking about implementing this sort of thing on-top-of / using the exisiting curve fitting VI's but can't help wondering: the LVOOP implementation seems obvious, so does anyone know if such a thing is planned for the next LV release? /dirk
  14. brilliant! thanks a lot! QUOTE (Aristos Queue @ Apr 19 2008, 07:10 PM) ok,ok, point taken :-)
  15. QUOTE (jdunham @ Apr 18 2008, 09:34 PM) There's not so much to post since casting does not work. (I get an "Error 1448 occurred at To More Specific Class": Bad type cast. LabVIEW cannot treat the run-time value of this LabVIEW class as an instance of the given LabVIEW class.) Yen's solution obviously works well, but potentially takes a lot of coding. An example situation is with dialogs. Suppose I have a class "CommonDialogs" with properties such as 'owner window', 'allways on top'; etc. I can have a number of child class such as "FileDialog", "PrintDialog", "FontDialog"; you get the idea. Suppose in an application each are needed. I can create instances of each class, and for each class set the inhereted properties from Commondialogs, all to the same value. The reason for my question is that I would rather have 1 instance of CommonDialogs, with all the values set as needed, and subsequently create instances of FileDialog, PrinDialog etc using the CommonDialog object as parent, retaining its values.
  16. QUOTE (Yen @ Apr 18 2008, 11:56 AM) Well, as much as possible. This is more or less how I do it now. The problem is, that if I add attributes to the member class later on, I have to modify the constructors of all child classes.
  17. I have the nagging feeling I'm overlooking something here... I want to create a an instance of class "child" inheriting from a specific instance of class "parent", keeping "parent" values. To clarify, lets say I have a class parent.lvclass with some attribute A which is initialized at some value. After that, I want to create (a couple of) instances of child.lvclass /keeping/ the previously initialized value of A. What I've seen sofar, is that if I try to directly upcast parent --> child; I get an error 1448 saying Bad type cast. LabVIEW cannot treat the run-time value of this LabVIEW class as an instance of the given LabVIEW class. Other casting (child --> parent --> child) lose the parent settings. Any thoughts?
  18. QUOTE (Yen @ Mar 11 2008, 08:04 PM) First time I drove an automatic I thought it was shit. No "control". Now, for -say- 90% of the time, I would prefer the convenience. Same with the auto-toolthing. /d QUOTE (Aristos Queue @ Mar 11 2008, 12:19 AM) ... holding down the Control key ... that only works on the BD (right?)
  19. QUOTE (neB @ Mar 11 2008, 04:28 PM) I saw somebody driving a car once with one of those automatic transmissions. What seemed extremely un-natural was somebody being able to drive with only one foot. :beer:
  20. QUOTE(tcplomp @ Feb 20 2008, 01:52 PM) nothing really, I guess.
  21. since you can edit the icon of a typedef in such a way that it tells you about its contents, it would be nice if there was a 'display as typedef icon' option for such constants.
  22. The user accounts on a system can be read from the registry (stored here: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList) The easiest way is to extract them from the ProfileImagePath string value in each 'profile' key. The current (logged on) user can be retreived using the Advapi32.dll exported function GetUserNameA, or use the Application\Username property node. I'm not sure how to get the permissions QUOTE(sara @ Feb 13 2008, 10:21 AM)
  23. QUOTE(Eugen Graf @ Feb 12 2008, 08:41 PM) if only I had the time for that... :-( good luck w/your pages
  24. QUOTE(Eugen Graf @ Feb 12 2008, 07:33 PM) That's a bit of an odd remark, since your "European" forums are only in German...
  25. The only annoyance I have is the loading time it takes to load all the classes and their dependencies when opening a project. Otherwise, my 30+ class projects work fine, even with DAQ references in object data.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.