Page 1 of 1

Python Scripting update to Python 3.4 in SharpCap 4.1 Beta

Posted: Mon Jan 16, 2023 4:14 pm
by admin
Hi folks,

The Python scripting in SharpCap has been running Python 2.7 up to now, but finally there is a version of IronPython available that supports Python 3.4 - I have now incorporated this into SharpCap 4.1 beta.

Python scripts may need updating to reflect the change from Python 2.7 to Python 3.4 (in particular, 'print x' becomes 'print(x)' ).

I have added the same site-packages to the standard python library packages as before - that is 'six' and 'pyro4'. If any scripting users have ideas for useful additional default packages (must be small, and pure python rather than using native libraries), please let me know.

cheers,

Robin

Re: Python Scripting update to Python 3.4 in SharpCap 4.1 Beta

Posted: Mon Jan 16, 2023 8:55 pm
by Jean-Francois
Hello Robin,

OK, good news to actualize the Python scripting in SharpCap.

But, we will have the same problem with some "standard" module that are compiled with C code (for example numpy or scipy).
I guess that astropy has C code too.
Concerning numpy and scipy ... I found some time ago an internet page with a C# version of numpy/scipy.
I tried it, but it was not working properly. Maybe you can use it for IronPython 3.4 in SharpCap.

I did some test with "OxyPlot.dll" as alternative to "MatplotLib".
I found the "Meta.Numerics.dll" as alternative of numpy.


One other point ... Do you know how to save the IronPython Console and Pad settings ?
I use "#" for showing the line number, "Pad - ConvertTabToSpaces" and "Pad - ShowSpaces".
It is each time necessary to change the settings manually. If it is not in the Console itself, it could be somewhere in a parameter file.
Maybe it will be possible in the version 3.4.

Regards,
Jean-Francois

Re: Python Scripting update to Python 3.4 in SharpCap 4.1 Beta

Posted: Tue Jan 17, 2023 1:48 pm
by admin
Hi,

yes, Numpy/SciPy and AstroPy are all out I'm afraid (NumPy uses C code, and the other two depend on it). Anyway, they are several megabytes each, so too big for me to package with the SharpCap install, even if they were usable :(

I can see the toggle buttons for line numbers and showing line breaks in the lower pad area, but nothing there related to showing spaces or tabs to spaces? Am I missing something? The only tabs/spaces things I can find are for the upper console area?

cheers,

Robin

Re: Python Scripting update to Python 3.4 in SharpCap 4.1 Beta

Posted: Tue Jan 17, 2023 8:37 pm
by Jean-Francois
Hello Robin,

You can change some settings for the upper part (Console) or lower part (Pad):
Console_settings.jpg
Console_settings.jpg (33.18 KiB) Viewed 7071 times

Regards,
Jean-Francois

Re: Python Scripting update to Python 3.4 in SharpCap 4.1 Beta

Posted: Wed Jan 18, 2023 3:16 pm
by admin
Ahah!

I did not notice that the top thing in the slide out panel was a drop down and allowed you to switch between console and pad!

I will see what can be done.

cheers,

Robin

Re: Python Scripting update to Python 3.4 in SharpCap 4.1 Beta

Posted: Sat Dec 30, 2023 11:38 pm
by SteveInNZ
Could you update the help file to reflect the new version of Python please ?

Steve.

Re: Python Scripting update to Python 3.4 in SharpCap 4.1 Beta

Posted: Sun Dec 31, 2023 3:33 pm
by admin
Hi Steve,

oops, I hadn't noticed that the old 'print XXXX' rather that 'print(XXXX)' was still in the documentation. Annoyingly it is present in some of the screenshots too, so those will need to be replaced :( Thanks for pointing it out.

cheers,

Robin

Re: Python Scripting update to Python 3.4 in SharpCap 4.1 Beta

Posted: Sun Feb 25, 2024 4:16 pm
by JacquesTalbot2
Hi
I am trying SharpCap 4.1.11804 64 bit and I cannot set the gain of the SelectedCamera
SharpCap.SelectedCamera.Controls.Gain.Value = Gain
How can I do that?
Thanks

Re: Python Scripting update to Python 3.4 in SharpCap 4.1 Beta

Posted: Mon Feb 26, 2024 3:41 am
by JacquesTalbot2
I found why the Gain control is not there: It is because I was using Camera V3 Simulator who doesn't have a Gain control

Re: Python Scripting update to Python 3.4 in SharpCap 4.1 Beta

Posted: Mon Feb 26, 2024 2:26 pm
by admin
Hi,

with the ASCOM simulator camera, there is an option in the camera Setup to turn gain on or off (and switch between numeric gains and ISO gains). Note that SharpCap doesn't detect this changing unless you completely close and re-open the camera.

cheers,

Robin