Classes for driving mounts¶
This section is the documentation for developpers of classes related to the astronomical mounts.
This page is generated according the docstrings of the python code. It displays only public methods of classes.
Details of angle definitions are given in the following links:
Module mountastro¶
mountastro.mountastro¶
-
class
mountastro.mountastro.
Mountastro
(*args, **kwargs)[source]¶ Class to define a mount.
The first element of args is a string to define the mount type amongst:
HADEC: Eqquatorial mount.
HADECROT: Eqquatorial mount + field rotator.
AZELEV: Altazimutal mount.
AZELEVROT: Altazimutal mount + field rotator.
Dictionnary of motion parameters are:
NAME: A string to identify the mount in memory.
LABEL: A string to identify the mount for prints.
- Example
>>> mymount = Mountastro("HADEC", name = "My telescope")
A mount is constituted of many axes instanciated automatically using the Mountaxis class.
The class Mountastro provides methods to convert astronomical coordinates into low level orders for controlers (i.e. increments). For example:
radec_coord(): To read the current position of the mount axes.
radec_synchronize(): To synchronize the current position of the mount axes.
radec_goto(): To slew the mount axes to a target position.
These methods are implemented only in simulation mode in the Mountastro class. All these mods call a second one prefixed by _my_ to communicate physically with the controller. For example, radec_coord() calls _my_radec_coord(). In the class Mountastro the methos _my_* are only abstracts. The concrete methods will be defined in another class specific to the langage of the controller. For exemple the AstroMECCA commands are written in the class Mount_Astromecca which inherites metohds of the Mountastro class.
- Example
>>> mymount = Mountastro_Astromecca("HADEC", name = "My telescope") >>> mymount.set_channel_params("SERIAL", port="COM1", baud_rate=115200) >>> ra, dec, pierside = mymount.radec_coords()
-
_get_slewing_state
() → bool[source]¶ True if telescope is currently moving in response to one of the Slew methods or the MoveAxis(TelescopeAxes, Double) method, False at all other times.
Reading the property will raise an error if the value is unavailable. If the telescope is not capable of asynchronous slewing, this property will always be False. The definition of “slewing” excludes motion caused by sidereal tracking, PulseGuide, RightAscensionRate, and DeclinationRate. It reflects only motion caused by one of the Slew commands, flipping caused by changing the SideOfPier property, or MoveAxis(TelescopeAxes, Double).
-
_get_tracking_state
() → bool[source]¶ The state of the telescope’s sidereal tracking drive.
Tracking Read must be implemented and must not throw a PropertyNotImplementedException. Tracking Write can throw a PropertyNotImplementedException. Changing the value of this property will turn the sidereal drive on and off. However, some telescopes may not support changing the value of this property and thus may not support turning tracking on and off. See the CanSetTracking property.
-
_langage_mcs_req_decode
(command: str) → tuple[source]¶ Format of the request messages: message = “{typemsg: {action: {cmd: val}}}”
typemsg, action, cmd, val = self._langage_mcs_req_decode(command)
-
_my_read_encs
(incsimus: list) → list[source]¶ Read the real raw increment values of the axes
- Parameters
incsimus (list) – List of simulated increments.
- Returns
List of real increments.
- Return type
list
Inputs are simulated increments. Outputs are real increments if a real mount exists. This is an abstract method. Please overload it according your language protocol to read real increments. This conversion method is at level 1/4.
-
_set_slewing_state
(state: bool)[source]¶ True if telescope is moving in response to one of the Slew methods or the MoveAxis(TelescopeAxes, Double) method, False at all other times.
Internal for the Python code
-
_set_tracking_state
(state: bool)[source]¶ The state of the telescope’s sidereal tracking drive.
See details in the documentation of _get_tracking_state()
-
astro2cel
(astro_type: str, base: celme.angles.Angle, polar: celme.angles.Angle, base_deg_per_sec: str = '', polar_deg_per_sec: str = '') → tuple[source]¶ Convert any astronomical coordinate system (astro_type) into celestial coordinates and the corresponding velocities.
- astro_type can be “HADEC” or “AZELEV”:
base = ha or az (according astro_type)
polar = dec or elev (according astro_type)
base_deg_per_sec = dha or daz (according astro_type)
polar_deg_per_sec = ddec or delev (according astro_type)
- Parameters
astro_type (str) – Specification of the astronomical coordinate system.
base (celme.Angle) – Hour angle or azimuth (unit defined in celme.Angle).
polar (celme.Angle) – Declination or elevation (unit defined in celme.Angle).
base_deg_per_sec (celme.Angle) – Declination or elevation (unit defined in celme.Angle).
base_deg_per_sec – Declination or elevation (unit defined in celme.Angle).
- Returns
tuple of celestial coordinates (basis, polar, rotation) (degrees) and their derivatives (deg/sec)
- Return type
tuple of 6 elements
This conversion method is at level 3/4.
-
azelev2cel
(az: celme.angles.Angle, elev: celme.angles.Angle) → tuple[source]¶ Convert (azimuth, elevation) coordinates into celestial coordinates.
- Parameters
ha (celme.Angle) – Azimuth (unit defined in celme.Angle).
dec (celme.Angle) – Elevation (unit defined in celme.Angle).
- Returns
tuple of celestial coordinates (basis, polar, rotation) (degrees)
- Return type
tuple of 3 elements
This conversion method is at level 3/4.
-
cel2astro
(celb: float, celp: float, unit_ha: str = '', unit_dec: str = '', unit_az: str = '', unit_elev: str = '') → tuple[source]¶ Convert celestial coordinates into (H.A., Dec) (azimuth, elevation, rotation) astronomical coordinates
It is possible to choice the unit of the outputs for each astronomical coordinate.
- Parameters
celb (float) – Celestial base coordinate (degrees).
celp (float) – Celestial polar coordinate (degrees).
unit_ha (str) – Unit of the Hour angle (unit defined in celme.Angle).
unit_dec (str) – Unit of the déclination (unit defined in celme.Angle).
unit_az (str) – Unit of the azimuth (unit defined in celme.Angle).
unit_elelv – Unit of the elevation (unit defined in celme.Angle).
- Returns
tuple of celestial coordinates (ha, dec, az, elev, rotation) (degrees)
- Return type
tuple of 5 elements
This conversion method is at level 3/4.
-
cel2azelev
(celb: float, celp: float, unit_az: str = '', unit_elev: str = '') → tuple[source]¶ Convert celestial coordinates into (azimuth, elevation, rotation) astronomical coordinates
It is possible to choice the unit of the outputs for each astronomical coordinate.
- Parameters
celb (float) – Celestial base coordinate (degrees).
celp (float) – Celestial polar coordinate (degrees).
unit_az (str) – Unit of the azimuth (unit defined in celme.Angle).
unit_elelv – Unit of the elevation (unit defined in celme.Angle).
- Returns
tuple of celestial coordinates (az, elev, rotation) (degrees)
- Return type
tuple of 3 elements
This conversion method is at level 3/4.
-
cel2enc
(celb: float, celp: float, pierside: int, output_format=0, save=0) → tuple[source]¶ Convert celestial apparent coordinates into encoder values.
- Parameters
celb (float) – Celestial coordinate of the base axis (degrees).
celp (float) – Celestial coordinate of the polar axis (degrees).
pierside (int) – Pier side: Mountaxis().PIERSIDE_AUTO or Mountaxis().PIERSIDE_POS1 or Mountaxis().PIERSIDE_POS2.
output_format (int) – OUTPUT_SHORT or OUTPUT_LONG.
save (int) – SAVE_NONE or SAVE_AS_SIMU or SAVE_AS_REAL or SAVE_ALL.
- Returns
Increment coordinates
- Return type
tuple of 2 or 14 elements
Input = celb, celp, pier side (deg units) Output = Raw encoder values (inc)
This conversion method is at level 2/4.
-
cel2hadec
(celb: float, celp: float, unit_ha: str = '', unit_dec: str = '') → tuple[source]¶ Convert celestial coordinates into (H.A., Dec) astronomical coordinates
It is possible to choice the unit of the outputs for each astronomical coordinate.
- Parameters
celb (float) – Celestial base coordinate (degrees).
celp (float) – Celestial polar coordinate (degrees).
unit_ha (str) – Unit of the Hour angle (unit defined in celme.Angle).
unit_dec (str) – Unit of the déclination (unit defined in celme.Angle).
- Returns
tuple of celestial coordinates (ha, dec) (degrees)
- Return type
tuple of 2 elements
This conversion method is at level 3/4.
-
disp
()[source]¶ Display a summary of the Mount parameters, the current values of encoders and celestial angles.
This method is used to check and debug the mount.
-
enc2cel
(simulation_incs: list, output_format=0, save=0) → tuple[source]¶ Read encoder values and convert them into celestial apparent coordinates
- Parameters
simulation_incs (list) – List of simulated increments.
output_format (int) – OUTPUT_SHORT or OUTPUT_LONG.
save (int) – SAVE_NONE or SAVE_AS_SIMU or SAVE_AS_REAL or SAVE_ALL.
- Returns
Celestial coordinates (degrees)
- Return type
tuple of 3 or 14 elements
Input = Raw encoder values (inc) Output = HA, Dec, pier side (any celme Angle units)
This conversion method is at level 2/4.
-
hadec2cel
(ha: celme.angles.Angle, dec: celme.angles.Angle) → tuple[source]¶ Convert (H.A,Dec) coordinates into celestial coordinates.
- Parameters
ha (celme.Angle) – Hour angle (unit defined in celme.Angle).
dec (celme.Angle) – Declination (unit defined in celme.Angle).
- Returns
tuple of celestial coordinates (basis, polar, rotation) (degrees)
- Return type
tuple of 3 elements
This conversion method is at level 3/4.
-
hadec_coord
(**kwargs: dict) → tuple[source]¶ Read the current astronomical coordinates.
- Parameters
kwargs (dict) – Parameters for output units.
- Returns
tuple of (ha, dec, pierside)
- Return type
tuple
Dictionnary of unit parameters are:
UNIT_HA: A string (uspzad format).
UNIT_DEC: A string (uspzad format).
- Example
>>> mymount = Mountastro("HADEC", name = "My telescope") >>> mymount.hadec_coords("H0.2", "d+090.1")
-
hadec_drift
(hadec_speeddrift_ha_deg_per_sec: float, hadec_speeddrift_dec_deg_per_sec: float)[source]¶ Drift the mount
- Parameters
hadec_speeddrift_ha_deg_per_sec (float) – Hour angle drift (deg/sec)
hadec_speeddrift_dec_deg_per_sec (float) – Declination drift (deg/sec)
- Example
>>> mymount = Mountastro("HADEC", name = "My telescope") >>> mymount.hadec_drift(0.0,-0.05)
-
hadec_goto
(ha: celme.angles.Angle, dec: celme.angles.Angle, **kwargs)[source]¶ Slew the mount to a target defined by astronomical coordinates.
- Parameters
ha (celme.Angle) – Hour angle target (unit defined in celme.Angle).
dec (celme.Angle) – Declination target (unit defined in celme.Angle).
kwargs (dict) – Parameters for pointing.
Dictionnary of pointing parameters are:
BLOCKING: A boolean to block the programm until the mount is arrived (False by default).
SIDE: Integer to indicate the back flip action:
PIERSIDE_AUTO (=0) back flip is performed if needed
PIERSIDE_POS1 (=1) pointing in normal position
PIERSIDE_POS2 (=-1) pointing in back flip position
- Example
>>> mymount = Mountastro("HADEC", name = "My telescope") >>> mymount.hadec_goto("12h28m47s", "+5d45m28s", side = Mountaxis().PIERSIDE_AUTO)
-
hadec_move
(ha_move_deg_per_sec, dec_move_deg_per_sec) → tuple[source]¶ Slew or modify the drift of the mount.
- Parameters
ha_drift_deg_per_sec (float) – Hour angle velocity (deg/s).
dec_drift_deg_per_sec (float) – Declination velocity (deg/s).
- Returns
tuple of (error code, result)
- Return type
tuple
- Example
>>> mymount = Mountastro("HADEC", name = "My telescope") >>> mymount.hadec_move(0.1,-0.2)
-
hadec_move_stop
()[source]¶ Stop the mount motion.
- Example
>>> mymount = Mountastro("HADEC", name = "My telescope") >>> mymount.hadec_move_stop()
-
hadec_stop
()[source]¶ Stop any motion of the mount.
- Returns
tuple of (error code, result)
- Return type
tuple
- Example
>>> mymount = Mountastro("HADEC", name = "My telescope") >>> mymount.hadec_stop()
-
hadec_synchronize
(ha: celme.angles.Angle, dec: celme.angles.Angle, pierside: int = '') → tuple[source]¶ Synchronize the encoders of the current position with the given astronomical coordinates.
- Parameters
ha (celme.Angle) – Hour angle (unit defined in celme.Angle).
dec (celme.Angle) – Declination (unit defined in celme.Angle).
pierside (int) –
Mountaxis().PIERSIDE_AUTO
Mountaxis().PIERSIDE_POS1
Mountaxis().PIERSIDE_POS2.
- Returns
tuple of astronomical coordinates (ha, dec, pierside)
- Return type
tuple of 3 elements
- Example
>>> mymount = Mountastro("HADEC", name = "My telescope") >>> mymount.hadec_synchronize("12h28m47s", "+5d45m28s", Mountaxis().PIERSIDE_POS1)
-
hadec_travel_compute
(ha_target: celme.angles.Angle, dec_target: celme.angles.Angle, pierside_target: int = 0) → tuple[source]¶ Compute the duration of a slewing from the current position to a target.
- Parameters
ha_target (celme.Angle) – Hour angle (unit defined in celme.Angle).
dec_target (celme.Angle) – Declination (unit defined in celme.Angle).
pierside_target (int) – Mountaxis().PIERSIDE_AUTO or Mountaxis().PIERSIDE_POS1 or Mountaxis().PIERSIDE_POS2.
- Returns
tuple of celestial coordinates (elevmin, ts, elevs)
- Return type
tuple of 3 elements
- Returned values are:
elevmin: Minimum elevation (degrees).
ts: List of time from the start of slewing (sec).
elevs: List of computed elevations for each element of ts (degrees).
This conversion method is at level 4/4.
-
plot_rot
(lati, azim, elev, rotb, rotp, outfile='')[source]¶ Vizualize the rotation angles of the mount according the local coordinates # — Site latitude lati (deg) : Site latitude # — Observer view elev = 15 # turn around the X axis azim = 140 # turn around the Z axis (azim=0 means W foreground, azim=90 means N foreground) # — rob, rotp
-
radec_coord
(**kwargs)[source]¶ Read the current astronomical coordinates.
- Parameters
kwargs (dict) – Parameters for output units.
- Returns
tuple of (ra, dec, pierside)
- Return type
tuple
Dictionnary of unit parameters are:
EQUINOX: Equinox of the ra,dec coordinates (J2000 by default).
UNIT_RA: A string (uspzad format).
UNIT_DEC: A string (uspzad format).
- Example
>>> mymount = Mountastro("HADEC", name = "My telescope") >>> mymount.radec_coords("H0.2", "d+090.1")
-
radec_goto
(ra_angle: celme.angles.Angle, dec_angle: celme.angles.Angle, **kwargs)[source]¶ Slew the mount to a target defined by astronomical coordinates.
- Parameters
ha_angle (celme.Angle) – Right ascension target (unit defined in celme.Angle).
dec_angle (celme.Angle) – Declination target (unit defined in celme.Angle).
kwargs (dict) – Parameters for pointing.
- Returns
tuple of (error code, result)
- Return type
tuple
Dictionnary of pointing parameters are:
EQUINOX: Equinox of the ra,dec coordinates (J2000 by default).
BLOCKING: A boolean to block the programm until the mount is arrived (False by default).
SIDE: Integer to indicate the back flip action:
PIERSIDE_AUTO (=0) back flip is performed if needed
PIERSIDE_POS1 (=1) pointing in normal position
PIERSIDE_POS2 (=-1) pointing in back flip position
- Example
>>> mymount = Mountastro("HADEC", name = "My telescope") >>> mymount.radec_goto("12h28m47s", "+5d45m28s", side = Mountaxis().PIERSIDE_AUTO)
-
radec_synchronize
(ra_angle: celme.angles.Angle, dec_angle: celme.angles.Angle, **kwargs) → tuple[source]¶ Synchronize the encoders of the current position with the given astronomical coordinates.
- Parameters
ra_angle (celme.Angle) – Right ascension (unit defined in celme.Angle).
dec_angle (celme.Angle) – Declination (unit defined in celme.Angle).
pierside (int) –
Mountaxis().PIERSIDE_AUTO
Mountaxis().PIERSIDE_POS1
Mountaxis().PIERSIDE_POS2.
kwargs (dict) – Pointing parameters
- Returns
tuple of astronomical coordinates (ra, dec, pierside)
- Return type
tuple of 3 elements
Dictionnary of pointing parameters are:
EQUINOX: Equinox of the ra,dec coordinates (J2000 by default).
SIDE: Integer to indicate the back flip action:
PIERSIDE_AUTO (=0) back flip is performed if needed
PIERSIDE_POS1 (=1) pointing in normal position
PIERSIDE_POS2 (=-1) pointing in back flip position
- Example
>>> mymount = Mountastro("HADEC", name = "My telescope") >>> mymount.radec_synchronize("12h28m47s", "+5d45m28s", Mountaxis().PIERSIDE_POS1)
-
read_encs
(simulation_incs: list) → list[source]¶ Read the simulated and real raw increment values of the axes
- Parameters
incsimus (list) – List of simulated increments.
- Returns
List of real increments.
- Return type
list
- For the simulation:
if simulation_incs==”” the value is calculated from simu_update_inc
if simulation_incs==34.5 the value is taken equal to 34.5
- For real:
if the axis is not real then real=simulated value
else the encoder is read
Output = Raw calues of encoders (inc)
This conversion method is at level 1/4.
-
remote_command_processing
(command)[source]¶ Execute a command when this code is used as server.
- Parameters
command (str) – Command to execute
- Returns
error code
- Return type
int
- Example
>>> mymount = Mountastro("HADEC", name = "My telescope") >>> mymount.remote_command_protocol("LX200") >>> mymount.remote_command_processing(":GD")
-
remote_command_protocol
(remote_command_protocol='LX200')[source]¶ Set the langage protocol when this code is used as server.
- Parameters
remote_command_protocol (str) – Command to execute
- Example
>>> mymount = Mountastro("HADEC", name = "My telescope") >>> mymount.remote_command_protocol("LX200")
-
property
slewing_state
¶ True if telescope is currently moving in response to one of the Slew methods or the MoveAxis(TelescopeAxes, Double) method, False at all other times.
Reading the property will raise an error if the value is unavailable. If the telescope is not capable of asynchronous slewing, this property will always be False. The definition of “slewing” excludes motion caused by sidereal tracking, PulseGuide, RightAscensionRate, and DeclinationRate. It reflects only motion caused by one of the Slew commands, flipping caused by changing the SideOfPier property, or MoveAxis(TelescopeAxes, Double).
-
speedslew
(*args) → tuple[source]¶ Update the speed slewing velocities (deg/sec).
The order of velocities must be respected.
- Returns
tuple of velocities
- Return type
tuple of 1 to 3 elements
This conversion method is at level 2/4.
-
property
tracking_state
¶ The state of the telescope’s sidereal tracking drive.
Tracking Read must be implemented and must not throw a PropertyNotImplementedException. Tracking Write can throw a PropertyNotImplementedException. Changing the value of this property will turn the sidereal drive on and off. However, some telescopes may not support changing the value of this property and thus may not support turning tracking on and off. See the CanSetTracking property.
-
update_motion_states
()[source]¶ Get the current motions states of the axes
- Returns
slewing_state, tracking_state, list of axes_motion_states
- Return type
tuple
slewing_state and tracking_state are booleans. These states are computer according the combination of all active axes (real and simulated ones). axes_motion_states is a list of states for each axis combining real and simulated.
mountastro.mountaxis¶
-
class
mountastro.mountaxis.
Mountaxis
(*args, **kwargs)[source]¶ Class to define an axis of a mount.
The first element of args is a string to define the axis type amongst:
HA: Hour angle axis of an eqquatorial mount.
DEC: Declination axis of an eqquatorial mount.
AZ: Azimuth axis of an altaz mount.
ELEV: Elevation axis of an altaz mount.
ROT: Paralactic roation axis of an altaz mount.
ROLL: Roll axis of an altalt mount.
PITCH: Pitch axis of an altalt mount.
YAW: Yaw axis of an altalt mount.
Dictionnary of motion parameters are:
NAME: A string to identify the axis in memory.
LABEL: A string to identify the axis for prints.
- Example
>>> axisb = Mountaxis("HA", name = "Hour angle", label= "H.A.") >>> axisp = Mountaxis("DEC", name = "Declination", label= "Dec.")
A mount axis is defined by a frame called ‘rot’ constituted by two perpendicular axes:
Axisp: The polar axis, a great circle passing by the poles
Axisb: The base axis. Its axis is parallel to the pole direction
The natural unit of ‘rot’ is degree.
The definition of the ‘rot’ frame is compatible with equatorial and altaz or altalt mounts:
hadec : Equatorial, axisp = declination (dec), axisb = hour angle (ha)
altaz : Altaz , axisp = elevation (alt) , axisb = azimuth (az)
altalt : Altalt , axisp = pitch (pit) , axisb = roll (rol)
The definition of ‘rot=0’ depends on the mount types:
Axisp: ‘rot=0’ at the pole direction upper horizon
Axisb: ‘rot=0’ depdns on the mount type (meridian, south, etc)
The encoders provide another frame called ‘enc’ which shares the same rotational axis than ‘rot’.
The natural unit of ‘enc’ is increments.
The celestial coordinate system provide another frame called ‘cel’ which shares the same rotational axis than ‘rot’.
The natural unit of ‘cel’ is degree.
The ‘cel’ frame if fixed to the ‘rot’ frame. The zeroes are fixed by definition (see above).
The ‘enc’ frame is considered as absolute encoders. As it is impossible to place the inc=0 of the encoder exactly on the rot=0, we define a inc0 = inc when rot=0. As a consequence, for a linear response encoder:
rot = (inc-inc0) * deg_per_inc
However, a rotational sense (senseinc) is indroduced to take accound the increasing increments are in the increasing angles of ‘rot’ or not:
rot = (inc-inc0) * deg_per_inc * senseinc
deg_per_inc is always positive.
-
_get_ang
() → int[source]¶ Get the arrival angle of a calculated movement for a target.
The orientation of the coordinate system are orthonormal. (Right hand rules, tom pouce for visible polar axis !)
- Returns
Error if value is not a real.
- Return type
int
-
_get_angsimu
() → int[source]¶ In simulation mode, get the arrival angle of a calculated movement for a target.
The orientation of the coordinate system are orthonormal. (Right hand rules, tom pouce for visible polar axis !)
- Returns
Error if value is not a real.
- Return type
int
-
_get_axis_type
() → int[source]¶ - Get type and mechanical position of an axis on the mount.
BASE : Azimut or hour angle axis,
POLAR : Elevation or declination axix,
ROT : Derotator system for non equatorial mount (if equiped),
YAW : Equivalent to secondary azymtuh base (for Alt-Alt mount).
- Returns
BASE = 0, POLAR = 1, ROT = 2, YAW = 3
- Return type
int
-
_get_inc
() → float[source]¶ Get the value for actual increments position of an axis, direct interogation of the controller.
- Returns
Number of increments (for example : 37265)
- Return type
float
-
_get_inc0
() → float[source]¶ Get the value of increments for “rot=0”.
- Returns
Number of increments for “rot=0” (for example : 1800)
- Return type
float
-
_get_inc_per_deg
() → float[source]¶ Get the number of increments for a single degrees on the sky.
- Returns
Number of increments (for example : env 970000)
- Return type
float
-
_get_inc_per_motor_rev
() → float[source]¶ Get the number of increments for a single turn of the motor.
- Returns
Number of increments for a single turn of the motor (for example : 1000).
- Return type
float
-
_get_inc_per_sky_rev
() → float[source]¶ Get the number of increments for a single complete turn on the sky.
- Returns
Number of increments.
- Return type
float
-
_get_incsimu
() → float[source]¶ Get the value for actual increments position of an axis, direct interogation of the controller. Value are real if axle is real.
- Returns
Number of increments in simulation mode (for example : 37265)
- Return type
float
-
_get_language_protocol
() → str[source]¶ Get the type of controller language protocol for an axis (for example : SCX 11 type, or another).
- Returns
Type of controller language.
- Return type
str
-
_get_latitude
() → str[source]¶ Get the latitude of the observational site. Positive for north.
- Returns
Latitude of site (for example : 47,2 Degrees)
- Return type
str
-
_get_motion_state
() → int[source]¶ Get the current motion state
- Returns
Moton state code (0=no motion, 1=slewing, 2=drifting, 3=moving).
- Return type
int
Slewiwng state is an absolute motion followed by a drift. Moving state is an infinite motion. If a Moving is stopped we retreive the Drift state.
-
_get_motion_state_simu
() → int[source]¶ Get the current motion state for simulation
- Returns
Moton state code (0=no motion, 1=slewing, 2=drifting, 3=moving).
- Return type
int
Slewiwng state is an absolute motion followed by a drift. Moving state is an infinite motion. If a Moving is stopped we retreive the Drift state.
-
_get_name
() → str[source]¶ Get the nickname of the axis.
- Returns
Nickname of the axis (for example : Declination, …)
- Return type
str
-
_get_ratio_puley_motor
() → float[source]¶ Get the ratio between pulley and motor.
- Returns
Ratio between pulley and motor (for example : 100).
- Return type
float
-
_get_ratio_wheel_puley
() → float[source]¶ Get the ratio between wheel and motor puley, in diameter.
- Returns
Ratio between wheel and motor puley (for example : 5.25)
- Return type
float
-
_get_real
() → bool[source]¶ Get the axis mode, real or simulation.
- Returns
True or False
- Return type
bool
-
_get_senseang
() → int[source]¶ If progression of mechanical angles referentiel are positive and progression of rot0 are positive, ‘set_senseang’ are positive. However, ‘set_senseang’ are negative when progression are inverse.
The sense depend of the orientation of celestial coordinates systems and mechanical coordinates systems.
The orientation of the coordinate system are orthonormal. (Right hand rules, tom pouce for visible polar axis !)
- Returns
Error if value is not a real.
- Return type
int
-
_get_senseinc
() → int[source]¶ If progression of increments are positive and progression of ‘rot0’ are positive, ‘senseinc’ are positive. However, ‘senseinc’ are negative when progression are inverse.
The sense depend of the physical rolling sense of motor cable system.
- Returns
Value sense are “-1” or “1”.
- Return type
int
-
_get_simu_current_velocity
() → int[source]¶ Get the final cruising speed during the motion. Motion are celestial slewing speed or any other, like goto for example.
- Returns
Terminal velocity speed for a movement in degrees / sec.
- Return type
int
-
_get_slew_deg_per_sec
() → int[source]¶ Get the setting speed of a goto motion.
- Returns
Speed for a goto movement in degrees / sec.
- Return type
int
-
_get_slewmax_deg_per_sec
() → float[source]¶ Get the maximum speed for slew motion.
The value have a maximum, setting by a limit (_slewmax_deg_per_sec).
- Returns
Maximum speed for a goto movement in degrees / sec.
- Return type
float
-
_incr_variables
() → float[source]¶ - Update and calculus of two parameters :
number of increments for a complete turn of an axis
number of increments for single decimal degrees.
- Returns
Number of increments for a complete turn of an axis and number of increments for single decimal degrees.
- Return type
float
-
_set_ang
(ang: float) → int[source]¶ Set the arrival angle of a calculated movement for a target.
The orientation of the coordinate system are orthonormal. (Right hand rules, tom pouce for visible polar axis !)
- Parameters
ang – Celestial angle of an axis (degrees)
- Returns
Error if value is not a real.
- Return type
int
-
_set_angsimu
(ang: float) → int[source]¶ In simulation mode, set the arrival angle of a calculated movement for a target.
The orientation of the coordinate system are orthonormal. (Right hand rules, tom pouce for visible polar axis !)
- Parameters
ang – Celestial angle of an axis (degrees)
- Returns
Error if value is not a real.
- Return type
int
-
_set_axis_type
(axis_type: str) → int[source]¶ - Set type and mechanical position of an axis on the mount.
BASE : Azimut or hour angle axis,
POLAR : Elevation or declination axix,
ROT : Derotator system for non equatorial mount (if equiped),
YAW : Equivalent to secondary azymtuh base (for Alt-Alt mount).
:param axis_type : BASE = 0, POLAR = 1, ROT = 2, YAW = 3 :returns: Error if value is not a real. :rtype: int
-
_set_inc
(inc: float) → int[source]¶ Set the value for actual increments position of an axis, direct interogation of the controller.
- Parameters
inc – Value of the increments for the actual position.
- Returns
Error if value is not a real.
- Return type
int
-
_set_inc0
(inc0: float) → int[source]¶ Set the value of increments for “rot=0”. When mount was initialized, the “inc0” are set by the fonction “update_inc0”.
- Parameters
inc0 – Value of the increments for “rot=0” (for example : 1800)
- Returns
Error if increment is not positive.
- Return type
int
-
_set_inc_per_deg
(inc_per_deg: float)[source]¶ Attention
no setting for this attribute
- Parameters
inc_per_deg (float) – Incrment per degree
- Returns
Error if ratio is not positive.
- Return type
int
-
_set_inc_per_motor_rev
(nbr_inc: float) → int[source]¶ Set the number of increments for a single turn of the motor.
- Parameters
nbr_inc (float) – Number of increments for a single turn of the motor (for example : 1000).
- Returns
Error if ratio is not positive.
- Return type
int
-
_set_inc_per_sky_rev
(inc_per_sky_rev: float)[source]¶ Attention
no setting for this attribute
- Parameters
inc_per_sky_rev (float) – Incrment per sky turn
- Returns
Error if ratio is not positive.
- Return type
int
-
_set_incsimu
(inc: float) → int[source]¶ Set the value for actual increments position of an axis in simulation mode.
- Parameters
inc – Value of the increments for the simulated position.
- Returns
Error if value is not a real.
- Return type
int
-
_set_language_protocol
(language_protocol: str) → int[source]¶ Set the type of controller language protocol for an axis (for example : SCX 11 type, or another).
:param language_protocol : Specified the protocol language type (for example : SCX11) :returns: Error if value is not a real. :rtype: int
-
_set_latitude
(latitude_deg: float) → int[source]¶ Set the latitude of the observational site. Positive for north.
- Parameters
latitude_deg (float) – Latitude of site (for example : 47.2 Degrees)
- Returns
Error if value is not a real.
- Return type
int
-
_set_motion_state
(motion_state: int)[source]¶ Set the current motion state
- Returns
Error code (0=no error).
- Return type
int
-
_set_motion_state_simu
(motion_state: int)[source]¶ Set the current motion state for simulation
- Returns
Error code (0=no error).
- Return type
int
-
_set_name
(name: str)[source]¶ Attention
no setting for this attribute
- The name are setted at the instanciation of the mount axis. The name of an axis can have several value :
Declination,
Azimuth
Hour angle,
Elevation,
Rotator,
Roll,
Pitch,
Yaw,
You cannot set the value cause it is an protected attribute.
- Parameters
name (str) – Name of the axis
- Returns
Error if ratio is not positive.
- Return type
int
-
_set_ratio_puley_motor
(ratio: float) → int[source]¶ Set the ratio between pulley and motor, take care about the ratio of motor reducer type.
- Parameters
ratio (float) – Ratio between pulley and motor (for example : 100).
- Returns
Error if ratio are not strictly positive.
- Return type
int
-
_set_ratio_wheel_puley
(ratio: float) → int[source]¶ Set the ratio between wheel and motor puley, in diameter.
- Parameters
ratio – Ratio between wheel and puley (for exampe : 5.25)
- Returns
Error if ratio are not strictly positive.
- Return type
int
-
_set_real
(real: bool) → int[source]¶ Set the axis in real mode or simulation mode. With simulation mode, the value of the axis are given by Mountaxis simulation value.
- Parameters
real – True or False.
- Returns
Error if value is not a real.
- Return type
int
-
_set_senseang
(sense: int) → int[source]¶ If progression of mechanical angles referentiel are positive and progression of rot0 are positive, ‘set_senseang’ are positive. However, ‘set_senseang’ are negative when progression are inverse.
The sense depend of the orientation of celestial coordinates systems and mechanical coordinates systems.
The orientation of the coordinate system are orthonormal. (Right hand rules, tom pouce for visible polar axis !)
- Parameters
sense – Value sense are “-1” or “1”.
- Returns
Error if value is not a real.
- Return type
int
-
_set_senseinc
(sense: int) → int[source]¶ If progression of increments are positive and progression of rot0 are positive, senseinc are positive. However, senseinc are negative when progression are inverse.
The sense depend of the physical rolling sense of motor cable system.
- Parameters
sense – Value sense are “-1” or “1”.
- Returns
Error if value is not a real.
- Return type
int
-
_set_simu_current_velocity
(simu_current_velocity_deg_per_sec: float)[source]¶ Attention
no setting for this attribute
- Returns
Error if ratio is not positive.
- Return type
int
-
_set_slew_deg_per_sec
(deg_per_sec: float) → int[source]¶ Set the setting speed for a goto motion.
The value are limited by the maximun limited speed (_slewmax_deg_per_sec)
- Parameters
deg_per_sec (float) – Speed for a goto movement in degrees / sec (for example : 30).
- Returns
Error if value is not a real.
- Return type
int
-
_set_slewmax_deg_per_sec
(deg_per_sec: float) → int[source]¶ Set the maximum speed for slew motion. Set carrefully this parameter due to issue response of the mount.
The value have a maximum (for example : 30)
- Parameters
deg_per_sec (float) – Speed for a slewing movement in degrees / sec (for example : 30)
- Returns
Error if value is not a real.
- Return type
int
-
property
ang
¶ Get the arrival angle of a calculated movement for a target.
The orientation of the coordinate system are orthonormal. (Right hand rules, tom pouce for visible polar axis !)
- Returns
Error if value is not a real.
- Return type
int
-
ang2rot
(ang: float, pierside: int = 1, save: int = 0) → float[source]¶ Calculation rot from ang and pierside.
- Parameters
ang (float) – Celestial angle (degrees)
pierside (int) –
Location of the optical tube against the mount pier:
PIERSIDE_POS1 (=1) normal position
PIERSIDE_POS2 (=-1) back flip position
save (int) –
Define how the results are stored:
SAVE_NONE (=0)
SAVE_AS_SIMU (=1)
SAVE_AS_REAL (=2)
- Returns
rot
- Return type
float
The rot value is computed according rot, _latitude, _senseang and _axis_type. The save parameter allows to update the real or simu internal values of and, pierside and rot:
SAVE_AS_SIMU: Only _angsimu, _rotsimu and _piersidesimu for simulated values are updated.
SAVE_AS_REAL: Only _ang, _rot and _pierside for real values are updated.
SAVE_NONE: No internal variables are updates.
Instanciation of the axis is indispensable.
- Instanciation Usage
>>> axisb = Mountaxis("HA", name = "Unknown")
- Usage
>>> axisb.ang2rot(-10, axisb.PIERSIDE_POS1, axisb.SAVE_NONE)
-
property
angsimu
¶ In simulation mode, get the arrival angle of a calculated movement for a target.
The orientation of the coordinate system are orthonormal. (Right hand rules, tom pouce for visible polar axis !)
- Returns
Error if value is not a real.
- Return type
int
-
property
axis_type
¶ - Get type and mechanical position of an axis on the mount.
BASE : Azimut or hour angle axis,
POLAR : Elevation or declination axix,
ROT : Derotator system for non equatorial mount (if equiped),
YAW : Equivalent to secondary azymtuh base (for Alt-Alt mount).
- Returns
BASE = 0, POLAR = 1, ROT = 2, YAW = 3
- Return type
int
-
disp
()[source]¶ Get information about an axis and print it on the console. Usefull for debug. Instanciation of the axis are indispensable. However, the mountaxis module when running, have by default axisb et axisp instancied.
- Instanciation Usage
>>> axisb = Mountaxis("HA", name = "Unknown") >>> axisp = Mountaxis("DEC", name = "Unknown")
- Usage
>>> axisb.disp() >>> axisp.disp()
- Return table of an axis
-------------------- AXIS name = SCX11 axis_type = HA latitude = 43 real hardware = False -------------------- ratio_wheel_puley = 5.25 ratio_puley_motor = 100.0 inc_per_motor_rev = 1000.0 -------------------- inc_per_sky_rev = 525000.0 inc_per_deg = 1458.3333333333333 -------------------- senseinc = 1 : 1=positive inc0 = 0.0 : Place mount rot at meridian and set inc0 = inc senseang = 1 : 1=positive -------------------- slew_deg_per_sec = 5.0 -------------------- SIMU INC -> ANG = HA inc = 0.0 : inc is read from encoder rot = 0.0000000 : rot = (inc - inc0) * senseinc / inc_per_deg pierside = 1 : pierside must be given by polar axis ang = 0.0000000 : ang = senseang * rot -------------------- SIMU ANG = HA -> INC ang = 0.0000000 : Next target celestial angle HA pierside = 1 : Next target pier side (+1 or -1) rot = 0.0000000 : rot = -ang / senseang inc = 0.0 : inc = inc0 + rot * inc_per_deg / senseinc -------------------- REAL INC -> ANG = HA inc = 0.0 : inc is read from encoder rot = 0.0000000 : rot = (inc - inc0) * senseinc / inc_per_deg pierside = 1 : pierside must be given by polar axis ang = 0.0000000 : ang = senseang * rot -------------------- REAL ANG = HA -> INC ang = 0.0000000 : Next target celestial angle HA pierside = 1 : Next target pier side (+1 or -1) rot = 0.0000000 : rot = -ang / senseang inc = 0.0 : inc = inc0 + rot * inc_per_deg / senseinc
-
property
inc
¶ Get the value for actual increments position of an axis, direct interogation of the controller.
- Returns
Number of increments (for example : 37265)
- Return type
float
-
property
inc0
¶ Get the value of increments for “rot=0”.
- Returns
Number of increments for “rot=0” (for example : 1800)
- Return type
float
-
inc2rot
(inc: float, save=0) → tuple[source]¶ Calculation of rot and pierside from inc.
- Parameters
inc (float) – Encoder increments (inc)
save (int) –
Define how the results are stored:
SAVE_NONE (=0)
SAVE_AS_SIMU (=1)
SAVE_AS_REAL (=2)
- Returns
Tuple of (rot, pierside)
- Return type
tuple
The rot value is computed according inc, _inc0, _senseinc, _inc_per_deg and _axis_type. The save parameter allows to update the real or simu internal values of inc and rot:
SAVE_AS_SIMU: Only _incsimu, _rotsimu and _piersidesimu for simulated values are updated.
SAVE_AS_REAL: Only _inc, _rot and _pierside for real values are updated.
SAVE_NONE: No internal variables are updates.
Instanciation of the axis is indispensable.
- Instanciation Usage
>>> axisb = Mountaxis("HA", name = "Unknown")
- Usage
>>> axisb.inc2rot(2000,axisb.SAVE_NONE)
-
property
inc_per_deg
¶ Get the number of increments for a single degrees on the sky.
- Returns
Number of increments (for example : env 970000)
- Return type
float
-
property
inc_per_motor_rev
¶ Get the number of increments for a single turn of the motor.
- Returns
Number of increments for a single turn of the motor (for example : 1000).
- Return type
float
-
property
inc_per_sky_rev
¶ Get the number of increments for a single complete turn on the sky.
- Returns
Number of increments.
- Return type
float
-
property
incsimu
¶ Get the value for actual increments position of an axis, direct interogation of the controller. Value are real if axle is real.
- Returns
Number of increments in simulation mode (for example : 37265)
- Return type
float
-
property
language_protocol
¶ SCX 11 type, or another).
- Returns
Type of controller language.
- Return type
str
- Type
Get the type of controller language protocol for an axis (for example
-
property
latitude
¶ Get the latitude of the observational site. Positive for north.
- Returns
Latitude of site (for example : 47,2 Degrees)
- Return type
str
-
property
motion_state
¶ Get the current motion state
- Returns
Moton state code (0=no motion, 1=slewing, 2=drifting, 3=moving).
- Return type
int
Slewiwng state is an absolute motion followed by a drift. Moving state is an infinite motion. If a Moving is stopped we retreive the Drift state.
-
property
motion_state_simu
¶ Get the current motion state for simulation
- Returns
Moton state code (0=no motion, 1=slewing, 2=drifting, 3=moving).
- Return type
int
Slewiwng state is an absolute motion followed by a drift. Moving state is an infinite motion. If a Moving is stopped we retreive the Drift state.
-
property
name
¶ Get the nickname of the axis.
- Returns
Nickname of the axis (for example : Declination, …)
- Return type
str
-
property
ratio_puley_motor
¶ Get the ratio between pulley and motor.
- Returns
Ratio between pulley and motor (for example : 100).
- Return type
float
-
property
ratio_wheel_puley
¶ Get the ratio between wheel and motor puley, in diameter.
- Returns
Ratio between wheel and motor puley (for example : 5.25)
- Return type
float
-
property
real
¶ Get the axis mode, real or simulation.
- Returns
True or False
- Return type
bool
-
rot2ang
(rot: float, pierside: int, save: int = 0) → float[source]¶ Calculation of ang from rot and pierside.
- Parameters
rot (float) – Rotation angle (degrees)
pierside (int) –
Location of the optical tube against the mount pier:
PIERSIDE_POS1 (=1) normal position
PIERSIDE_POS2 (=-1) back flip position
save (int) –
Define how the results are stored:
SAVE_NONE (=0)
SAVE_AS_SIMU (=1)
SAVE_AS_REAL (=2)
- Returns
ang
- Return type
float
The ang value is computed according rot, _latitude, _senseang and _axis_type. The save parameter allows to update the real or simu internal values of and, pierside and rot:
SAVE_AS_SIMU: Only _angsimu, _rotsimu and _piersidesimu for simulated values are updated.
SAVE_AS_REAL: Only _ang, _rot and _pierside for real values are updated.
SAVE_NONE: No internal variables are updates.
Instanciation of the axis is indispensable.
- Instanciation Usage
>>> axisb = Mountaxis("HA", name = "Unknown")
- Usage
>>> axisb.rot2ang(10, axisb.PIERSIDE_POS1, axisb.SAVE_NONE)
-
rot2inc
(rot: float, save: int = 0) → float[source]¶ Calculation of inc from rot.
- Parameters
rot (float) – Rotation angle (degrees)
save (int) –
Define how the results are stored:
SAVE_NONE (=0)
SAVE_AS_SIMU (=1)
SAVE_AS_REAL (=2)
- Returns
inc
- Return type
float
The inc value is computed according rot, _inc0, _senseinc, _inc_per_deg. The inc values are calculated in the interval from -inc_per_sky_rev/2 to +inc_per_sky_rev/2. The save parameter allows to update the real or simu internal values of inc and rot:
SAVE_AS_SIMU: Only _incsimu, _rotsimu for simulated values are updated.
SAVE_AS_REAL: Only _inc, _rot for real values are updated.
SAVE_NONE: No internal variables are updates.
Instanciation of the axis is indispensable.
- Instanciation Usage
>>> axisb = Mountaxis("HA", name = "Unknown")
- Usage
>>> axisb.rot2inc(10,axisb.SAVE_NONE)
-
property
senseang
¶ If progression of mechanical angles referentiel are positive and progression of rot0 are positive, ‘set_senseang’ are positive. However, ‘set_senseang’ are negative when progression are inverse.
The sense depend of the orientation of celestial coordinates systems and mechanical coordinates systems.
The orientation of the coordinate system are orthonormal. (Right hand rules, tom pouce for visible polar axis !)
- Returns
Error if value is not a real.
- Return type
int
-
property
senseinc
¶ If progression of increments are positive and progression of ‘rot0’ are positive, ‘senseinc’ are positive. However, ‘senseinc’ are negative when progression are inverse.
The sense depend of the physical rolling sense of motor cable system.
- Returns
Value sense are “-1” or “1”.
- Return type
int
-
property
simu_current_velocity
¶ Get the final cruising speed during the motion. Motion are celestial slewing speed or any other, like goto for example.
- Returns
Terminal velocity speed for a movement in degrees / sec.
- Return type
int
-
simu_motion_start
(*args, **kwargs)[source]¶ Start a simulation motion.
- Parameters
args (args) – First args is a string to define the type of motion to do.
kwargs (kwargs) – Dictionnary of motion parameters:
- Returns
_incsimu
- Return type
float
Types of motion can be:
SLEW or ABSOLUTE: Absolute position of the target position.
MOVE or CONTINUOUS: Infinite motion.
Dictionnary of motion parameters are:
Case motion type = SLEW or ABSOLUTE:
POSITION (inc or ang according the FRAME).
VELOCITY (deg/sec). Can be negative.
DRIFT (deg/sec). Can be negative.
Case motion type = MOVE or CONTINUOUS:
VELOCITY (deg/sec). Can be negative.
DRIFT (deg/sec). Can be negative.
For all cases of motions:
FRAME (str). “inc” (by default) or “ang”
Instanciation of the axis is mandatory.
- Instanciation Usage
>>> axisb = Mountaxis("HA", name = "Unknown")
- Usage
>>> axisb.simu_motion_start("SLEW", position=1000, velocity=100, frame='inc', drift=0)
-
simu_update_inc
()[source]¶ Calculate the current position of a simulation motion.
A simple rectangular profile is applied to velocity.
-
property
slew_deg_per_sec
¶ Get the setting speed of a goto motion.
- Returns
Speed for a goto movement in degrees / sec.
- Return type
int
-
property
slewmax_deg_per_sec
¶ Get the maximum speed for slew motion.
The value have a maximum, setting by a limit (_slewmax_deg_per_sec).
- Returns
Maximum speed for a goto movement in degrees / sec.
- Return type
float
-
synchro_real2simu
()[source]¶ - Synchronisation between simulation value of axis to real values of the axis. Parameters are setted :
_incsimu,
_rotsimu,
_angsimu,
_piersidesimu,
Useful for ending slewing movement to prevent difference offset due to calculation time of the simulation mode.
Instanciation of the axis are indispensable. However, the mountaxis module when running, have by default axisb et axisp instancied.
- Instanciation Usage
>>> axisb = Mountaxis("HA", name = "Unknown") >>> axisp = Mountaxis("DEC", name = "Unknown")
- Usage
>>> axisb.synchro_real2simu() >>> axisp.synchro_real2simu()
- Returns
No message returned by the fonction
-
synchro_simu2real
()[source]¶ - Synchronisation between real value of axis to simulation values of the axis. Parameters are setted :
_inc,
_rot,
_ang,
_pierside,
Useful for ending slewing movement to prevent difference offset due to calculation time of the simulation mode.
Instanciation of the axis are indispensable. However, the mountaxis module when running, have by default axisb et axisp instancied.
- Instanciation Usage
>>> axisb = Mountaxis("HA", name = "Unknown") >>> axisp = Mountaxis("DEC", name = "Unknown")
- Usage
>>> axisb.sydispnchro_simu2real() >>> axisp.synchro_simu2real()
- Returns
No message returned by the fonction
-
update_inc0
(inc, ang, pierside=1)[source]¶ Update the value of the inc0.
Instanciation of the axis are indispensable. However, the mountaxis module when running, have by default axisb et axisp instancied.
- Instanciation Usage
>>> axisb = Mountaxis("HA", name = "Unknown") >>> axisp = Mountaxis("DEC", name = "Unknown")
- Usage
>>> axisb.update_inc0() >>> axisp.update_inc0()
- Parameters
inc –
ang –
pierside –
- Returns
No message returned by the fonction.
mountastro.mountchannel¶
mountastro.mounttools¶
mountastro.mountpad¶
mountastro.mountlog¶
-
class
mountastro.mountlog.
Mountlog
(agent_alias: str, home: str = 'GPS 0 E 43 150', path_data: str = '', path_www: str = '')[source]¶ Manage logs in display, file and database.
First, create an instance: log = Mountlog(“test”,None)
Second, use the print methods to log: log.print(“Something to log”)
-
file
(*args, **kwargs)[source]¶ This is the method to print in a log file. In the log file the message is presented as: Date-ISO message The last file is also apended with the message
-