-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add NI-TClk Support #293
Comments
We've decided not to do this for the 0.9 December 2017 release. |
This is a very interesting idea. There is a bit of "surprise" / "side effect" / "clever" factor to this that makes me feel a bit uncomfortable. If we do go ahead with it, we should consider grouping the NI-TClk attributes in a container:
Do you mean something like this? |
Why make it a context manager then? The example provided makes it look like there's something special about the TClk context. I'm concerned that this is going to mislead users into thinking that the context implies being synchronized, and that leaving the context will cause the devices to be "unsynchronized" and revert back to their pre-synchronization state. But that's not the case: the devices will still be synchronized upon leaving that context, the trigger resynchronizers will still be configured for a TClk'd acquisition, etc. |
My default is to be against dynamic functionality but this might be a case where it makes sense. I do agree with @marcoskirsch about having it in a dedicated container. |
I agree with both @marcoskirsch and @epage. Please consider how Python APIs for drivers that aren't in this repository will implement this. I wouldn't be in favor of this approach if it's implemented as part of the codegeneration of each driver API. However, if all of the attribute implementation lives in an class Session(object): # the driver session class
@property
def tclk(self):
import nitclk
return nitclk.properties(self.get_session_reference()) then I think this is a reasonable approach. |
Putting the nitclk attributes into a separate container negates one of the benefits of adding them to the driver. In particular, the 'ScriptTriggerX' repeated capability is used. If we make it a separate container, then As for making This is getting into the implementation details, but I was not planning on adding the attributes at codegen time.
Instead, my tentative idea was to create an nitclk attribute only session internally, and then when an attribute didn't exist on the driver session, look there to see if it was a nitclk attribute. This is similar to what @auchter was talking about. EDIT: Just to be clear, the "nitclk attribute only session" would be part of the nitclk module, not the driver module. EDIT2: I thought about this some more. I was originally thinking that the nitclk object would be contained by # Changes from original
# - Session -> _SessionBase
# - properties -> _properties - we would never expect a customer to use this directly
# - Add repeated capabilities when constructing the nitclk properties object
class _SessionBase(object): # the driver session class
@property
def tclk(self):
import nitclk
return nitclk._properties(self.get_session_reference(), self._repeated_capability) The usage from above would now look like: scope.tclk.sync_pulse_source = 'PXI_Trig0'
fgen.script_triggers[0].tclk.script_trigger_master_session = scope.get_session_reference() If this is what everyone meant, then I can update the description above. |
@auchter I assume you are referring to nifpga-python. Is there anything else at the moment? We'd want to make sure that the nitclk module sourced here will work with that API. We also should make sure that sourcing nitclk with the rest of nimi-python makes sense. |
I updated the issue text:
|
One more area for discussion: Should we just add a dependency on nitclk from the other drivers and assume it is installed? As far as I can tell, all other languages/ADEs handle NI-TClk this way. If the driver support is installed for the given language/ADE, then NI-TClk support is also installed. Now, just because we "have always done it this way" doesn't automatically mean we need to here, but it is a precedent. |
In my mind, this is an unfortunate thing and not an ideal. We should be moving towards software integration pieces being add ons rather than required. |
This is true for NI-ModInst as well, except in the Python case. I like how we did it in the Python case. |
I see this issue was active fairly recently... can you guys comment on the status at present? What timescale are you thinking for a usable package? |
We are debating priorities internally. Some favor work on internal improvements to the code to make future work easier. User feedback can influence things. Can you provide information
Thanks! |
I'm researcher who has an automated experimentation platform for circuits implemented in python. Live mostly in python. I do (try to do) synchronous generation and capture across a couple PXI modules).
TBH, I probably wouldn't notice the pain (as far as NI-Tclk is concerned) provided my setups still run. Meaning, a sub-optimal synchronization would be tolerated.
I'm going to defend my diss. in Jan, God-willing, so will be running all experiments btw now and then.
Perhaps. But probably not in any significant way. Austin sounds nice, tho :) |
Are these digitizers? Waveform generators? A mix?
This is what I was trying to get at with "Maybe old-school synchronization using triggers is good enough". With NI-TClk you get picosecond-level synchronization. But you can still use triggers to synchronize your devices without using NI-TClk. Your devices will be synchronized within a sample clock period and you may have some jitter; but if this is acceptable for your application then you don't need NI-TClk - rather you'd be settting up some trigger routes using the device's API. If that's the case and you need help with it, then it becomes a regular NI support question which is a good thing as you would not be tied to nimi-python development schedule. |
A mix.
Doesn't sound like nimi-python/tclk is in the cards for that reason. |
I wouldn't bet on nitclk being ready by January, and if you don't need NI-TClk-level synchronization for your application, I would suggest you don't add this risk to your work and simply set up trigger synchronization yourself. |
Roger that. thanks! |
Add NI-TClk support.
How do we want to do this? NI-TClk is different from the other drivers supported by
nimi-python
in a fairly major way.The C API for nitclk is not session based like other drivers. Instead, the functions are stateless and you pass in an array of sessions you have gotten from drivers. The only functions that take a single session are the get/set functions. Some typical function prototypes:
From the examples I have seen we always pass in the same array of sessions to all functions, never one set to one function and a different set to a different function.This is not always the case.Given this, I propose that:
nitclk.properties()
object that the driver's_SessionBase()
will contain.nitclk.Session()
object that will be instantiated with the list of sessions and will own all non-attribute function calls.An example of how this might look:
Even though theNo reason to do this.nitclk.Session()
doesn't need to call a close or do any other cleanup, it would still be a context manager.Some alternatives would be:
The text was updated successfully, but these errors were encountered: