Python Scripting update to Python 3.4 in SharpCap 4.1 Beta

Discussions on extending SharpCap using the built in Python scripting functionality
Post Reply
User avatar
admin
Site Admin
Posts: 13350
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Python Scripting update to Python 3.4 in SharpCap 4.1 Beta

#1

Post 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
Jean-Francois
Posts: 402
Joined: Sun Oct 13, 2019 10:52 am
Location: Germany

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

#2

Post 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
User avatar
admin
Site Admin
Posts: 13350
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

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

#3

Post 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
Jean-Francois
Posts: 402
Joined: Sun Oct 13, 2019 10:52 am
Location: Germany

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

#4

Post 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 6574 times

Regards,
Jean-Francois
User avatar
admin
Site Admin
Posts: 13350
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

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

#5

Post 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
SteveInNZ
Posts: 83
Joined: Tue Feb 14, 2017 6:56 pm

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

#6

Post by SteveInNZ »

Could you update the help file to reflect the new version of Python please ?

Steve.
User avatar
admin
Site Admin
Posts: 13350
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

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

#7

Post 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
JacquesTalbot2
Posts: 7
Joined: Sun Feb 25, 2024 4:11 pm

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

#8

Post 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
JacquesTalbot2
Posts: 7
Joined: Sun Feb 25, 2024 4:11 pm

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

#9

Post 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
User avatar
admin
Site Admin
Posts: 13350
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

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

#10

Post 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
Post Reply