Jump to content

  •  

CNers have asked about a donation box for Cloudy Nights over the years, so here you go. Donation is not required by any means, so please enjoy your stay.

Photo

carbonstars.ssc -- An evolving script for observing carbon-type stars in Stellarium.

Charts Observing Software
  • Please log in to reply
8 replies to this topic

#1 BlueMoon

BlueMoon

    Apollo

  • *****
  • topic starter
  • Posts: 1,440
  • Joined: 14 Jun 2007
  • Loc: South Central Idaho, USA

Posted 15 April 2021 - 08:14 AM

Howdy folks,

I'm developing some tools for Stellarium to assist in the observation and studying of carbon stars, a particular interest of mine.

Like my MoonPi DIY project: https://www.cloudyni...y-eaa-project/I enjoy sharing my experience and efforts with the community.

My project posts are as much "thinking out loud" as they are anything and my stuff is *always* evolving. I encourage anyone

with an interest to join in too. As I'm learning the scripting API in Stellarium, I thought I'd post my efforts as I progress in the

hopes that perhaps some of my work might be useful or of interest to to others even in this early stage of development.

 

This script, carbonstars.ssc is a modified version of Ben Crowell's "Binosky.ssc" script and is an automated "tour" of 30 carbon-type

stars picked mostly at random. To install it,  do a "copy and paste" of the code below, save it as "carbonstars.ssc" and place it

in your Stellarium "scripts" directory. Start Stellarium, then open the Configuration menu (F2) and choose the "Scripts" tab. Highlight the 

carbonstars.ssc script and click on the "run arrow" in the lower right hand corner. The script takes a few minutes to run and then exits. 

 

carbonstars.ssc is very basic at this point as it takes no account of magnitude, spectral type or hemisphere. As the script evolves

with more data, functions and controls I'll post newer versions and link them to this first post.

 

Clear skies.

// Name: Carbon Stars -- carbonstars.ssc
// Author: Jeff Houck
// License: Public Domain
// Version: 1.0
// Description: An automated short "tour" of 30 carbon-type stars.
// Based on a modified "Binosky.ssc" script by Ben Crowell and 
// includes the "tr" function by Alexander Wolf.
//

include("i18n.inc");

// Name:        Provide translation option for scripts
// License:     Public Domain
// Author:      Alexander Wolf
// Description: Simple translation functions for scripts.

// call this function with some string ID
function tr(str)
{
	return core.translate(str);
}

// List of carbon-type stars
var star_list = ["HIP 25704", "HIP 31349", "HIP 109158", "HIP 112254", "HIP 44439", "HIP 117459", "HIP 92194", "HIP 23520",  
	       "HIP 115743", "HIP 89783", "HIP 27398", "HIP 29896", "HIP 45295", "HIP 32442", "HIP 33059", "HIP 100735", "HIP 91774", 
	       "HIP 75694", "HIP 108953", "HIP 31108", "HIP 45266", "HIP 68023", "HIP 30409", "HIP 112306", "HIP 33042", "HIP 108205", 
	       "HIP 35549", "HIP 33189", "HIP 1945", "HIP 36623"];

// Does the intro title in upper LH corner
core.clear("deepspace");
NebulaMgr.setFlagHints(true);
var title = LabelMgr.labelScreen(tr("Carbon Stars: A tour of 30 carbon-type stars"), 20, 20, false, 30, "#00AAFF");
var count = LabelMgr.labelScreen(star_list.length + " " + tr("objects in all"), 20, 60, false, 24, "#00AAFF");
LabelMgr.setLabelShow(title, true);
LabelMgr.setLabelShow(count, true);
core.wait(5);
LabelMgr.setLabelShow(title, false);
LabelMgr.setLabelShow(count, false);
LabelMgr.deleteLabel(title);
LabelMgr.deleteLabel(count);


// Display loop
for (i=0; i<star_list.length; i++)
{
	core.selectObjectByName(star_list[i], true);
	StelMovementMgr.setFlagTracking(true);
	StelMovementMgr.autoZoomIn(2);
	core.wait(7);

	StelMovementMgr.zoomTo(40, 5);
	core.wait(5);
}

// Clear back to "clean screen" and exit
core.clear("natural");
core.goHome();


  • Alexander Wolf, nicknacknock and Older Padawan like this

#2 JamesMStephens

JamesMStephens

    Apollo

  • *****
  • Posts: 1,174
  • Joined: 25 Jan 2015
  • Loc: Hattiesburg, Mississippi

Posted 15 April 2021 - 08:20 AM

Nice effort!

 

Jim


  • BlueMoon likes this

#3 BlueMoon

BlueMoon

    Apollo

  • *****
  • topic starter
  • Posts: 1,440
  • Joined: 14 Jun 2007
  • Loc: South Central Idaho, USA

Posted 17 April 2021 - 07:56 PM

I like to document my progress on these projects of mine in the hopes that others may learn or find the information useful. In this case I've been looking through the Stellarium scripting API for key event handlers and was surprised not to find any. I'm a C programmer of 30+ years experience and I was a bit perplexed until I discovered this in a Stellarium discussion post:

 

 

But simply put there is no core. getKeypress or inkey$ or any other equivalent function in Stellarium. The way to get around this is instead of having Stallarium "look" for a key press; have it "look" for the changes that happen when you press a key instead. ~ qam1 2016-06-27

O-ho! There are no functions in the Stellarium scripting API for directly handling key events. We need a workaround and we have one! It uses a a boolean comparison of two variables. For example if a user presses the "A" key it toggles the Atmosphere on and off. So we set up two variables to do a Boolean equality operation on to get a result. The workaround doesn't act on the actual key press of "A" but the output of the LandscapeMgr.getFlagAtmosphere() function. The "A" key is already mapped to the aforementioned function by default. (One can change key mappings in Stellarium but we're not going there.)

 

Ingenious.

 

 This code snippet is a "workaround" for detecting key strokes originally coded by qam1. Comments by me.

// Assign a value to d from the on/off state of the function. Make r equal to d
d = LandscapeMgr.getFlagAtmosphere();
r = d;

// Boolean test of equality between d and r. When the A key, which is tied to the function is pressed, 
// the output state of the function changes and the boolean test, which is no longer equal,
// fails, and the while loop activates. r is now assigned a value from the function and the 
// atmosphere is toggled on or off.  
while (d == r) 
 {
  r = LandscapeMgr.getFlagAtmosphere();
 }

// Hit the A key again and the boolean comparison succeeds (r == d) (we didn't change the value of d) 
// and the atmosphere is toggled by restoring the function to the original value of d.
LandscapeMgr.setFlagAtmosphere(d); 

So what does this mean for carbonstars? No fussing about key bindings. Using the technique above allows my scripts to work programmatically without worrying about key event details. Happy, happy, joy, joy!

Next, I have some publicly released carbon star data I want to use in carbonstars.ssc. I will look though the available pre-existing Stellarium scripting functions to find those I need to operate on my data. No need to reinvent the wheel if Stellarium already has what I need. Now that I know how to get key stroke events I can move onto the next stage of development.

 

Clear skies.



#4 BlueMoon

BlueMoon

    Apollo

  • *****
  • topic starter
  • Posts: 1,440
  • Joined: 14 Jun 2007
  • Loc: South Central Idaho, USA

Posted 18 April 2021 - 07:14 PM

Next steps. I'm using publicly available data from the CGCS III/227 catalogue: http://vizier.u-stra...-source=III/227 for my script.

 

This catalogue lists over 6000 carbon stars! Too many to incorporate into a script and many of them would be a too high a magnitude to be observed by amateur telescopes. What I intend to do is threefold:

1. Find 500 carbon stars that fit into a practical maximum observing magnitude, say 14mag. This puts them in reach of most amateur telescope capabilities. Up to 6" aperture or so for refractors, 6-8" for reflectors.

2. Check those 500 against the catalogues that Stellarium can load so that as much data about each star can be shown by default and avoid Simbad look-ups for missing data. Right now it looks like many are listed in Hipparcos so that's a plus.

3. Incorporate the 500 as an array in the script and try to create some simple controls so the user can select them by magnitude, spectral type or coordinates. There may be other criteria for selection but I think those 3 would form the basis.

 

Right now, I'm working on Northern Hemisphere stars so I can reliably test my coding (I live in Idaho, natch). If it's working properly, I'll follow the same steps for a Southern Hemisphere script. This will keep the script "responsive" by limiting the number of stars it needs to identify based on hemisphere and not slow Stellarium with processing a list of 1000 stars for both hemispheres.

 

At this point I'm writing some code to format the III/227 catalogue data into nicely readable and searchable form for my filter algorithms. More to come.



#5 BlueMoon

BlueMoon

    Apollo

  • *****
  • topic starter
  • Posts: 1,440
  • Joined: 14 Jun 2007
  • Loc: South Central Idaho, USA

Posted 22 April 2021 - 10:21 PM

This is a sample of one of the rows from the III/227 CGCS catalog:

0004+4333 5987 00 04 36.4 +43 33 05 12.3 8.5 6.0 114.0 -18.5 C6,4(Yam) 225217(Nb), SU And, CCCS 3219 R 0

Right now, the field I'm interested in is the 1st, ie; 0004+4333. This is the CGCS star designation based on its J2000 coordinates. What I hope to do is cross reference the CGCS designator to other more common designations such as Hipparcos. If Stellarium has a function that would allow me to use the CGCS information directly via a function, that would be totally cool. The downside to that is the look-up processing overhead for an array of J2000 designations (CGCS -> <other catalogue(s)>) each time the script is run.

 

Stellarium has a LOT of functions so part of my slow script development is learning its API ... 
 


Edited by BlueMoon, 23 April 2021 - 07:01 AM.


#6 Alexander Wolf

Alexander Wolf

    Stellarium

  • -----
  • Vendors
  • Posts: 492
  • Joined: 27 Jun 2011
  • Loc: Barnaul, Siberia, Russia

Posted 23 April 2021 - 08:20 AM

Right now, the field I'm interested in is the 1st, ie; 0004+4333. This is the CGCS star designation based on its J2000 coordinates. What I hope to do is cross reference the CGCS designator to other more common designations such as Hipparcos. If Stellarium has a function that would allow me to use the CGCS information directly via a function, that would be totally cool.

No, Stellarium cannot do it.
  • BlueMoon likes this

#7 BlueMoon

BlueMoon

    Apollo

  • *****
  • topic starter
  • Posts: 1,440
  • Joined: 14 Jun 2007
  • Loc: South Central Idaho, USA

Posted 23 April 2021 - 09:46 AM

No, Stellarium cannot do it.

Thanks Alexander for letting me know. No worries. I'll look to pre-processing the CGCS data externally and find the catalogue matches in catalogues Stellarium uses. I'll "pre-build" my arrays for the carbonstars script from external lists. waytogo.gif

 

Thanks and be well.



#8 lambermo

lambermo

    Apollo

  • -----
  • Posts: 1,101
  • Joined: 16 Jul 2007
  • Loc: .nl

Posted 24 April 2021 - 02:51 PM

Nice script, works well.

 

For those on Linux wondering where the scripts directory is; you can make 

~/.stellarium/scripts/

 and put the file in there. This way you do not have to bother with root rights for 

/usr/share/stellarium/scripts/

where the packaged scripts live.


  • BlueMoon and Alexander Wolf like this

#9 BlueMoon

BlueMoon

    Apollo

  • *****
  • topic starter
  • Posts: 1,440
  • Joined: 14 Jun 2007
  • Loc: South Central Idaho, USA

Posted 29 April 2021 - 08:04 PM

An update. Been busy around the house getting things "spring cleaned". However, I'm working through the lists and should have an "observable list" ready soon. I'm cross-referencing the CGCS identifiers to matching Hipparcos numbers where ever possible. I'm also working out the spectral and magnitude levels so (hopefully) a user can select a series using those parameters. Looking into finding carbon stars by selecting constellation boundaries as well.




CNers have asked about a donation box for Cloudy Nights over the years, so here you go. Donation is not required by any means, so please enjoy your stay.


Recent Topics





Also tagged with one or more of these keywords: Charts, Observing, Software



Cloudy Nights LLC
Cloudy Nights Sponsor: Astronomics