Closed Yaafteh closed 1 year ago
Hi @Yaafteh , I agree this is a good idea. I think this implemention does require change the sim_runner and the run_task. I can't imagine any other more elegant way of doing it. I'll add this in the next version. I'll post here a comment and close this issue when the implementation is submitted.
By the way. I've moved most of the code to the spicelib repository and then will scale down the PyLTspice to use the spicelib as resource.
https://github.com/nunobrum/spicelib
The reason for this is that PyLTSpice is now supported a larger variety of simulators, including the new QSPICE from Mike Engelhardt. The name PyLTSpice no longer makes much sense.
I've just pushed into spicelib a version that supports the callback arguments. Please let me know if it matches your expectations. I highly recomend that you use spicelib for the time being. PyLTspice will have some major redesign in the near future to be based on the spicelib.
Not sure if there is a way to pass more parameters (arguments) to post processing function in run command or not. If yes, please advice. If not it would be ideal to add this feature to pass more arguments to "run" function, since it gets only the function handler, as far as I know, more args cannot be passed to post processing function.
It would be ideal if we could pass kwrags or extra parameter to the processing function, this way user can pass a dictionary packing all parameter and send it to the post processing function. runner.run(netlist, run_filename=fn_netlist_temp, callback=processing_data, callback_arg = {'R': 1, 'C':2})
def processing_data(raw_file, log_file, extra_arg): print(extra_arg['R'])
Modifying "run" in sim_runner.py and run_task.py file, I was able to pass more args. But I'm sure there are more elegant way to do that versus what I did modifying your code.