Séquenceur d'observation d'étoiles variables

L'utilisation et la création des scripts.
Alain-Maury
Messages : 94
Enregistré le : 19 juin 2009, 04:14

Séquenceur d'observation d'étoiles variables

Message par Alain-Maury »

Salut à tous les observateurs prismatiques,
J'ai écrit un script assez gros qui permet d'observer des étoiles variables (où des transits d'exoplanètes, ou en fait ce que l'on veut). C'est assez bien documenté, en anglais, et ça fait dans les 1000 lignes.
Si certaines personnes sont intéressées, il est joint à ce message, et me contacter par message personnel, j'essaierai de vous aider dans la mesure du possible. Mon email est amaury suivi des 4 chiffres de l'année en cours (donc 2017 en ce moment) at spaceobs point com.
Il faut bien sûr l'adapter à son télescope, mais ça marche pas mal, et ça fait des choses plus adaptées aux variables que l'observation automatique dans prism.
Je n'ai pas pu attacher les fichiers, mais ils sont dans les deux messages suivants. Mais pour expliquer ici en vitesse ce que ça fait:
Il faut générer une liste d'objets à observer, un objet par ligne, nom, alpha, delta. Une targetlist est un truc du genre:
CDInd 21 16 -58 41
ASAS 22 43 +08 09
CCScl 00 58 -29 21
TTAri 02 06 +15 17
IMEri 01 37 -55 12
Donc une liste des objets que l'on souhaite observer, le caractère espace est un séparateur et donc on donne l'alpha et la delta, à la minute près. Le script lit cette targetlist et ne reconnaîtra que ces objets là. Donc plantera si vous faites une erreur dans le nom de l'objet ou si vous demandez un objet que vous n'avez pas mis dans la targetlist.

Ensuite il faut générer un script pour la nuit. J'ai écrit plusieurs commandes, on pourrait en imaginer d'autres.
- loop n (va observer n fois en boucle les objets qui suivent l'instruction loop)
- observetill hh mm (observe les objets qui suivent l'instruction observetill jusqu'à telle heure)
- observetillstar star sup/inf deg (observe les objets qui suivent l'instruction observetillstar) jusqu'à ce que l'objet star soit au dessus ou en dessous de telle hauteur sur l'horizon. Ca permet de laisser le télescope tourner tant que telle étoile n'est pas encore visible, ou au contraire d'arrêter la séquence dès que telle étoile descend en dessous de telle hauteur sur l'horizon pour passer à la séquence suivante. L'étoile qui va servir de référence doit faire partie de la targetlist.
La liste des objets à observer est donc un objet par ligne, suivi par le temps de pose en seconde et le filtre. Donc quelque chose du genre
loop 3
CDInd 30 C
ASAS 60 B

observetill 3 20
CDInd 30 C
ASAS 60 B

observetillstar CDInd sup 30
CCScl 30 C
TTAri 60 B
IMEri 60 C

Ensuite il y a d'autres directives, genre :
- autorecenter on/off qui permet dans une séquence de faire un recentrage astrométrique ou au contraire d'arrêter le recentrage astrométrique
- autoguide on/off qui permet de faire du guidage automatique. Si vos poses sont longues, utile, si elles sont courtes, inutiles bien souvent, donc on peut lancer une séquence avec autoguidage et ensuite mettre un autoguide off pour l'arrêter pour la séquence suivante
- wait hh mm met le script en attente jusqu'à telle heure.
- end qui permet de fermer la boutique en fin de nuit, donc au choix, réchauffer la caméra, fermer les panels de contrôle des caméras, parker le télescope, fermer la coupole (pour l'instant dans mes scripts ça lance un .exe qui ferme la coupole mais sinon on peut rajouter facilement la commande nécessaire pour fermer la coupole si elle a un driver ascom).
Ca évite de pointer trop près de la lune, et arrête l'observation d'un objet s'il est en dessous d'un certain nombre de degrés au dessus de l'horizon.
Idem au démarrage du script, ça demande si le télescope est déjà prêt ou pas. Et si ce n'est pas le cas, initialise caméra, télescope, ouvre la coupole, refroidit la caméra, etc... Ca ne met les observations en route que lorsque le soleil est en dessous d'une certaine hauteur sous l'horizon.
Idem en fin de nuit quand le soleil arrive à une certaine hauteur sous l'horizon, le script stoppe et ferme la boutique.
Pour l'instant ça ne gère pas l'autofocus. Mais ça serait facile à rajouter. En fait il y a plusieurs manières de faire, un, c'est d'avoir un tube carbone et un focuser qui compense bien la température et donc là il n'y a rien à faire (c'est mon cas). Sinon de connaître la variation de focus en fonction de la température et il est alors facile de lire la température, et de mettre un offset pour la foc, et au pire faire une séquence d'autofocus avant chaque séquence, j'ai ce qu'il faut dans d'autres scripts, mais je n'ai pas eu à le mettre dans mon séquenceur pour l'instant.
Voilà, voilà, si ça intéresse, même ceux qui n'observent pas les étoiles variables mais qui voudraient voir comment le script est foutu. Perso je n'observe pas d'étoiles variables, en ce moment je fais un peu d'exoplanètes avec ce script (avec un téléobjectif de 135mm). Je l'avais écrit au départ pour un client qui lui fait beaucoup de variables.
C'est assez brutal comme script, ça peut faire des bétises si vous le programmez mal (je ne gère pas bien le fait que le script demande à observer une étoile qui n'est pas visible au moment de l'observation, si vous mettez deux espaces à la place d'un seul, ça n'aime pas, etc...), mais c'est un script, après vous êtes libre de le modifier et de l'adapter à vos besoins... C'est livré en l'état, ça marche pour moi, sans autre forme de garantie, etc...
Idem il serait faisable d'observer des astéroïdes et des étoiles variables en ne gérant plus les coordonnées et en mettant un getastercoord avant chaque pointage.
Alain
Modifié en dernier par Alain-Maury le 01 oct. 2017, 19:09, modifié 1 fois.
Alain-Maury
Messages : 94
Enregistré le : 19 juin 2009, 04:14

Re: Séquenceur d'observation d'étoiles variables

Message par Alain-Maury »

Je ne sais pas pourquoi, les deux fichiers n'ont pas été attachés, je retente. Donc voilà le code, à copier et à sauver ensuite

Code : Tout sélectionner

REM Variable star observing
REM originated from the asteroid survey script
REM Alain Maury - January 2014 till September 2017 :)
REM adapted to the 135mm lens on AZEQ6 mount
REM Filters C=1, B=2, V=3, R=4, H=5

REM Cooling of the camera in minutes and degrees
minutestogodowntotemp=15
Detectortemperature=-20

REM difference between local time and UT
deltaUT=3

REM autoguiding
autoguide=FALSE
scoperecentering=FALSE

REM minimum height at which we will observe a star. 15 degrees=0.2618 radians
minimumheight=0.2618
REM minimum distance from the moon we can observe, here we take also 15 degrees.
minimummoondistance=0.2618
REM exposure time used for recentering the telescope, for now 5 seconds, or 5000ms
shortExptimeMS=5000
GuidingExpTime=10

REM the directory of the directories
imagedirectory$="C:\images\"

REM calculating night's date
NOW year month day hour minute second MS

lengthmonth[1]=31
REM bissextile years
yearfrac=year/4
frac yearfrac bissextile
if bissextile=0 then
	lengthmonth[2]=29
else
	lengthmonth[2]=28
endif
lengthmonth[3]=31
lengthmonth[4]=30
lengthmonth[5]=31
lengthmonth[6]=30
lengthmonth[7]=31
lengthmonth[8]=31
lengthmonth[9]=30
lengthmonth[10]=31
lengthmonth[11]=30
lengthmonth[12]=31

if hour<12 then
	if day=1 then
		if month=1 then
			year=year-1
			month=12
			day=31
		else
			month=month-1
		endif
		day=lengthmonth[month]
	else
		day=day-1
	endif
endif
REM directory of the night
REM Year
REM *****

str year year$

str month month$
if month<10 then
	month$="0"+month$
endif

str day day$
if day<10 then
	day$="0"+day$
endif

night$=year$+"-"+month$+"-"+day$
nightdirectory$=imagedirectory$+night$+"\"
createdir nightdirectory$
directorycalib$=nightdirectory$+"preprocess\"
createdir directorycalib$
print "the images will be stored in : " nightdirectory$
print "the processed images will be stored in : " directorycalib$




REM Opening and reading the target list
REM à modifier une fois installé sur le PC\Documents\Prism\Exemples
REM targetlist$="C:\Users\amaur\Documents\Prism\Exemples de script Pgm\sequenceur\targetlist.txt"


targetlist$="C:\Users\Andy's Astro PC\Documents\Prism\Exemples de script Pgm\Sequence\targetlist.txt"
Open_FileTxt_For_Read targetlist targetlist$
numberofstarsintargetlist=0
readnextline:
ENDOFFILE targetlist result
if result=FALSE then
	numberofstarsintargetlist=numberofstarsintargetlist+1
	REM we have not arrived till the end of the file
	ReadFileTxt targetlist line$
	REM we split the line
	CUTSTR line$ " " 1 starname[numberofstarsintargetlist]$
	CUTSTR line$ " " 2 starRAH$
	CUTSTR line$ " " 3 starRAM$
	CUTSTR line$ " " 4 starDecD$
	CUTSTR line$ " " 5 starDecM$
	val starRAH$ starRAH
	val starRAM$ starRAM
	val starDecD$ starDecD
	val starDecM$ starDecM
	starRA[numberofstarsintargetlist]=starRAH+(starRAM/60)
	if starDecD<0 then
		starDec[numberofstarsintargetlist]=starDecD-(starDecM/60)
	else
		starDec[numberofstarsintargetlist]=starDecD+(starDecM/60)
	endif
	print "starname number : " numberofstarsintargetlist " is : " starname[numberofstarsintargetlist]$ " star RA in decimal : " starRA[numberofstarsintargetlist] " star Dec in decimal : " starDec[numberofstarsintargetlist]
	numberofimages[numberofstarsintargetlist]=0
	goto readnextline:
endif
closefiletxt targetlist
print "number of stars in the target list : " numberofstarsintargetlist


REM astrometric catalog
REM ********************
DirCat$="C:\GSC-ACT\"


REM Catalogs that can be used
Cat[1]$="GSC"
Cat[2]$="USNO SA"
Cat[3]$="USNO A1"
Cat[4]$="USNO A2"
Cat[5]$="Hipparcos"
Cat[6]$="SAO"
Cat[7]$="BSC"
Cat[8]$="Tycho1"
Cat[9]$="GSC-ACT"
Cat[10]$="Tycho2"
Cat[11]$="UCAC 2/3/4"
Cat[12]$="NOMAD V1"

REM Catalog that will be used
Cat$=Cat[9]$


REM elevation of the sun to start the telescope, then start observing, latitude and longitude
REM ******************************
GetStdrLongitude Longitude
GetStdrLatitude Latitude
print "Longitude = " Longitude*TODEG " Latitude = " Latitude*TODEG
REM Elevation of the sun at which we start the instrumentation, -5 degrees so in radians 
elevsunstartinitnight=-0.087266

REM *****************************************************************
REM Modification to be able to test the script in the afternoon. PUT IN REM OTHERWISE
elevsunstartinitnight=1
REM 18 degrees below the horizon to start observing, -12 degrees, so 0.2094 radians
elevsunstartbegnight=-0.2094
REM elevsunstartbegnight=1
REM ***********************************
REM Opening the script file to be executed
REM ***********************************
print "please select the script for tonight"

REM opening the script file
GETFILENAME path$
REM Opening the text file
print "Opening " path$
Open_FileTxt_For_Read scriptfile path$




REM Asking to start or not the telescope
question$="Is the telescope already started ?"
getyesno question$ telescopeparked

Gosub beginnighttime:
Gosub endnighttime:

REM Computing the time till the end of the night
now date
timeleft=endofnighttime-date
frac timeleft time
observingtimeleft=time*24
observingtimeleftmin=observingtimeleft*60
print "Remaining observing time : " observingtimeleft " hours or : " observingtimeleftmin " minutes"
REM In the unlikely case the script is started way too late.
if observingtimeleft<0 then
	goto endnight:
endif

REM first we compute the sidereal time
Now date
datetostr date date$
REM This function gives the sidereal time in radians.
SIDERALTIME Date Longitude Tsl
Tsldeg=Tsl*TODEG
Tslhour=Tsl*3.8197186342054880584532103209403
print "Time is : " date$
print "Sidereal time in hours is : " Tslhour

REM at the beginning we recenter the scope, even if not specified
gosub recenterscope:

		
REM here we start reading the program for the night
nextsequence:

REM we print information about the moon.
Now Date
REM We check the position of the moon at the instant.
GetRaDecMoon Date AlphaMoonrad DeltaMoonrad ElevationMoonrad
AlphaMoondeg=AlphaMoonrad*TODEG
DeltaMoondeg=DeltaMoonrad*TODEG
ElevationMoondeg=ElevationMoonrad*TODEG
DATETOSTR Date Date$
print
if ElevationMoondeg<0 then
	print "It is " Date$ " and the moon is " ElevationMoondeg " degrees below the horizon"
else
	print "It is " Date$ " and the moon is " ElevationMoondeg " degrees above the horizon"
endif

REM now parsing the file
REM there are 4 options for the first line, it's either loop n (n cycles), or tilltime T (till such hour) or looptill starname sup H or looptill starname inf H
REM first case it will loop till the time has passed, or till such star is below or above such altitude
REM 7 options :
REM wait HH MM
REM loop n
REM observetill HH MM
REM observetillstar starname sup D
REM observetillstar starname inf D
REM recenterscope on or off
REM autoguide on or off






REM ***************************************************
REM parsing the first condition
REM ***************************************************
readnextline2:
ENDOFFILE scriptfile result
REM If we are not at the end of the file...
if result=FALSE then
	ReadFileTxt scriptfile loop$
	REM we split the line
	REM the first line has to be a condition
	cutstr loop$ " " 1 condition$
	
	REM ************************************************
	REM autoguide
	REM ************************************************
	if condition$="autoguide" then
		cutstr loop$ " " 2 autoguideonoroff$
		if autoguideonoroff$="on" then
			autoguide=TRUE
			print "Autoguiding will be performed on each exposure"
		else
			autoguide=FALSE
		endif
	REM we read the next empty line to be able to read the next instruction later
	ReadFileTxt scriptfile loop$
	goto readnextline2:
	endif
	
	REM ************************************************
	REM autorecenter
	REM ************************************************
	if condition$="recenterscope" then
		cutstr loop$ " " 2 recenteronoroff$
		if recenteronoroff$="on" then
			scoperecentering=TRUE
			print "The telescope will be recentered after each slewing to a new position"
		else
			scoperecentering=FALSE
		endif
	REM we read the next empty line to be able to read the next instruction later
	ReadFileTxt scriptfile loop$
	goto readnextline2:
	endif
	
	REM ************************************************
	REM WAIT
	REM ************************************************
	if condition$="wait" then
		REM we read the time till which we have to wait
		cutstr loop$ " " 2 waithour$
		cutstr loop$ " " 3 waitminute$
		print "The script is now going to wait till " waithour$ ":" waitminute$
		val waithour$ waithour
		val waitminute$ waitminute
		waithour=waithour+deltaUT
		if waithour>24 then
			waithour=waithour-24
		endif
		
		REM dayfrac is the fractional part of the day
		dayfrac=((waitminute/60)+waithour)/24
		now date
		frac date datefrac
		int date dateint
		enddate=dateint+dayfrac
		REM if we are before midnight and the time limit is the following day
		if datefrac>0.5 then
			if dayfrac<0.5 then
				enddate=dateint+dayfrac+1
			endif
		endif

		REM to debug
		REM print "date " date "enddate " enddate
		CONVERTDATETOJULIAN  enddate  JJenddate
		
		startwait:
		now date
		CONVERTDATETOJULIAN  date  JJdate
		if JJdate<JJenddate then
			REM waiting one minute
			NOW year month day hour minute seconde ms
			Delay 60000
			Print "It is now " hour ":" minute " continue waiting..."
			WaitForEndDelay
			goto startwait:
		else
			print "Ooops, wait finished, continuing with the script"
		endif	
	REM we read the next empty line to be able to read the next instruction later
	ReadFileTxt scriptfile loop$
	goto nextsequence:
	endif
	
	
	
	REM ************************************************
	REM OBSERVETILL
	REM ************************************************
	if condition$="observetill" then
		REM We read the time till which the sequence must be run and we observe it
		cutstr loop$ " " 2 numberofhours$
		val numberofhours$ numberofhours
		cutstr loop$ " " 3 numberofminutes$
		val numberofminutes$ numberofminutes
		numberofstarsinloop=0
		REM I take UT into account
		dayfrac=((numberofminutes/60)+numberofhours)/24
		REM CAUTION : if it is past midnight(UT) and the script ask to observe till 23h, it will.
		print
		print " We are going to observe the following sequence till " numberofhours$ ":" numberofminutes$
		
		readloop:
		ReadFileTxt scriptfile star$
		REM here we read the lines following the loop instructions, till we encounter an empty line.

		if star$<>"" then
			numberofstarsinloop=numberofstarsinloop+1
			REM we read a star name, the exposure time and the filter
			cutstr star$ " " 1 star[numberofstarsinloop]$
			cutstr star$ " " 2 exposuretime[numberofstarsinloop]$
			cutstr star$ " " 3 filter[numberofstarsinloop]$
			val exposuretime[numberofstarsinloop]$ exposuretime[numberofstarsinloop]
			print
			print star[numberofstarsinloop]$ " " exposuretime[numberofstarsinloop] " seconds with " filter[numberofstarsinloop]$ " filter"
			
			REM From the star name we get the RA and Dec
			for j=1 numberofstarsintargetlist
				if star[numberofstarsinloop]$=starname[j]$ then
					print "Star number " numberofstarsinloop " found, it is " starname[j]$ 
					RA[numberofstarsinloop]=starRA[j]
					Dec[numberofstarsinloop]=starDec[j]
					print "Star RA in decimal : " RA[numberofstarsinloop] " star Dec in decimal : " Dec[numberofstarsinloop]
					goto readloop:
				endif
			next j
		REM do something in case the star has not been found
		print "No stars have been found, check either target list or script file"
		endif


		if dayfrac>24 then
			dayfrac=dayfrac-24
		endif
		
		now date
		frac date datefrac
		int date dateint
		enddate=dateint+dayfrac
		REM if we are before midnight and the time limit is the following day
		if datefrac>0.5 then
			if dayfrac<0.5 then
				enddate=dateint+dayfrac+1
			endif
		endif

		REM to debug
		REM print "date " date "enddate " enddate
		CONVERTDATETOJULIAN  enddate  JJenddate
		
		DATETOSTR  date  date$
		DATETOSTR  enddate  enddate$
		print
		CONVERTDATETOJULIAN  date  JJdate
		if JJdate>JJenddate then
			print " We are past the requested date, executing next sequence"
			goto readnextline2:
		else 
			print "**********************************************************************"
		endif


		
		REM now we loop through the cycle till enddate is met.
		starttilltime:
		now date
		datetostr date date$
		CONVERTDATETOJULIAN  date  JJdate
		if JJdate<JJenddate then
			print
			print "************************************************************************************"
			print "It is " date$ " we continue till " enddate$
			gosub expose:
		REM checking if the time limit has passed
		goto starttilltime:
		else
			print "time is up, next sequence"
		endif
		
		REM Stopping autoguiding
		if autoguide=TRUE then
			StopGuide_Ex 2 1
		endif
		REM we read the next empty line to be able to read the next instruction later
	ReadFileTxt scriptfile loop$
	goto nextsequence:
	endif




	REM ************************************************
	REM LOOP
	REM ************************************************

	REM we found a loop where we are going to make a sequence numberofcycle times
	if condition$="loop" then
		REM We read the number of time the sequence must be made and we make it
		cutstr loop$ " " 2 numberofcycles$
		val numberofcycles$ numberofcycles
		print "We will run the following cycle " numberofcycles " times"
		REM we read the stars to be observed during this cycle and increment the number of stars
		numberofstarsinloop=0
		readloop2:
		ReadFileTxt scriptfile star$
		REM here we read the lines following the loop instructions, till we encounter an empty line.
		if star$<>"" then
			numberofstarsinloop=numberofstarsinloop+1
			REM we read a star name, the exposure time and the filter
			cutstr star$ " " 1 star[numberofstarsinloop]$
			cutstr star$ " " 2 exposuretime[numberofstarsinloop]$
			cutstr star$ " " 3 filter[numberofstarsinloop]$
			val exposuretime[numberofstarsinloop]$ exposuretime[numberofstarsinloop]
			print star[numberofstarsinloop]$ " " exposuretime[numberofstarsinloop] " seconds with " filter[numberofstarsinloop]$ " filter"
			REM From the star name we get the RA and Dec
			for j=1 numberofstarsintargetlist
				print "star[numberofstarsinloop]$" star[numberofstarsinloop]$
				print "starname[j]$" starname[j]$
				if star[numberofstarsinloop]$=starname[j]$ then
					print "star number " numberofstarsinloop " found, it is " star[numberofstarsinloop]$
					RA[numberofstarsinloop]=starRA[j]
					Dec[numberofstarsinloop]=starDec[j]
					print "star RA in decimal : " RA[numberofstarsinloop] " star Dec in decimal : " Dec[numberofstarsinloop]
					goto readloop2:
				endif
			next j
		REM do something in case the star has not been found
		endif
		REM now we loop numberofcycles time, moving the telescope, exposing, saving the image, moving the telescope, etc...
		for i=1 numberofcycles
			gosub expose:
		next i
	REM we read the next empty line to be able to read the next instruction later
	ReadFileTxt scriptfile loop$
	goto nextsequence:
	endif



	REM ************************************************
	REM LOOPTILL
	REM ************************************************
	REM looptill starname sup H or looptill starname inf H
	if condition$="observetillstar" then
		REM We read the star name, the condition and the altitude
		REM the star must be in the target list file
		cutstr loop$ " " 2 starname$
		cutstr loop$ " " 3 inforsup$
		cutstr loop$ " " 4 limitheightdeg$
		val limitheightdeg$ limitheightdeg
		REM Extracting the useful information to obtain the condition of the loop.
		for j=1 numberofstarsintargetlist
			REM print "starname$ = " starname$ " starname[j] " starname[j]$
			if starname$=starname[j]$ then
				print
				print "The reference star is " starname[j]$ 
				RAref=starRA[j]
				Decref=starDec[j]
				radRAref=RAref*torad*15
				radDecref=Decref*torad
				REM print "star RA in decimal : " RAref " star Dec in decimal : " Decref
				NOW Date
				GETHEIGHT radRAref radDecref Date Longitude Latitude heightref
				RAD_TO_DEC heightref heightref$
				print "the star is at " heightref$
			endif
		next j
		
		if inforsup$="sup" then
		print "this current sequence will run while " starname$ " is above " limitheightdeg " degrees"
		PRINT "Star : " starname$ " is currently at : " heightref$ " degrees"
		print "Star RA in decimal : " RAref " star Dec in decimal : " Decref
		refstarabove=1
		else
		print "This current sequence will run while " starname$ " is below " limitheightdeg " degrees"
		PRINT "Star : " starname$ " is currently at :" heightref$
		print "Star RA in decimal : " RAref " star Dec in decimal : " Decref
		refstarabove=0		
		endif
		
		
		numberofstarsinloop=0
		readloop3:
		ReadFileTxt scriptfile star$
		REM here we read the lines following the loop instructions, till we encounter an empty line.
		if star$<>"" then
			numberofstarsinloop=numberofstarsinloop+1
			REM we read a star name, the exposure time and the filter
			cutstr star$ " " 1 star[numberofstarsinloop]$
			cutstr star$ " " 2 exposuretime[numberofstarsinloop]$
			cutstr star$ " " 3 filter[numberofstarsinloop]$
			val exposuretime[numberofstarsinloop]$ exposuretime[numberofstarsinloop]
			print
			print star[numberofstarsinloop]$ " : " exposuretime[numberofstarsinloop] " seconds with " filter[numberofstarsinloop]$ " filter"
			REM From the star name we get the RA and Dec
			for j=1 numberofstarsintargetlist
				if star[numberofstarsinloop]$=starname[j]$ then
					print "Star number " numberofstarsinloop " in the sequence is " star[numberofstarsinloop]$ 
					RA[numberofstarsinloop]=starRA[j]
					Dec[numberofstarsinloop]=starDec[j]
					print "star RA in decimal : " RA[numberofstarsinloop] " star Dec in decimal : " Dec[numberofstarsinloop]
					goto readloop3:
				endif
			next j
		REM do something in case the star has not been found
		endif

		REM now we loop through the cycle till the reference star is above or below the required altitude.
		checkaltitude:
		now date
		GETHEIGHT radRAref radDecref Date Longitude Latitude heightref
		degheightref=heightref*todeg
		print
		print star[numberofstarsinloop]$ " is at " degheightref " degrees of altitude"
		if refstarabove=1 then
			REM we check that the reference star is still above the reference height
			if degheightref<limitheightdeg then
				print "the reference star is now below the limit, moving to next sequence"
				goto nextsequence:
			endif
		else
			REM we check that the reference star is still below the reference height
			if degheightref>limitheightdeg then
				print "the reference star is now above the limit, moving to next sequence"
				goto nextsequence:
			endif
		endif
	gosub expose:
	goto checkaltitude:
	endif
	REM we read the next empty line to be able to read the next instruction later
	ReadFileTxt scriptfile loop$
	goto nextsequence:
endif	
	
	
	REM ************************************************
	REM End of the night
	REM ************************************************

	if condition$="end" then
		goto endprogram:
	endif

endprogram:
gosub endnight:
end


REM ************************************************
REM all the subroutines used by the script
REM ************************************************

expose:
for j=1 numberofstarsinloop
	REM we convert RA and Dec in radians
	RArad[j]=RA[j]*torad*15
	Decrad[j]=Dec[j]*torad
	RAD_TO_RA RArad[j] alpha$
	RAD_TO_DEC Decrad[j] delta$
	REM we check the observability, first height and air mass, then distance to the moon
	now Date
	GetHeight RArad[j] Decrad[j] Date Longitude Latitude height
	if height>minimumheight then
		REM the star is above minimumheight (15°) then we can observe it, provided the moon is not too far
		REM we check the distance of the moon to the star
		GETRADECMOON Date AlphaM DeltaM ElevationM
		DISTSKY AlphaM RArad[j] DeltaM Decrad[j] Distm
			if Distm>minimummoondistance then
				REM if there is only one star in the loop, no need to re point the telescope.
				if numberofstarsinloop=1 then
					if numberofimages[j]=0 then
						REM everything is OK we can observe the star
						REM Calculer la masse d'air
						GETAIRMASS height airMass
						print 
						print "Exposing star " star[j]$ " for " exposuretime[j]$ " seconds using " filter[j]$ " filter"
						print "Current air mass for this star : " airMass
						print "Moving telescope to right ascension : " alpha$ " and declination : " delta$
						MOVETELESCOPE RArad[j] Decrad[j]
						Decdeg[j]=Decrad[j]*TODEG
						WaitForEndMoveTelescope
						REM if the option is on, we recenter the scope
						if scoperecentering=TRUE then
							gosub recenterscope:
						endif
					endif
				else
					REM everything is OK we can observe the star
					REM Calculer la masse d'air
					GETAIRMASS height airMass
					print 
					print "Exposing star " star[j]$ " for " exposuretime[j]$ " seconds using " filter[j]$ " filter"
					print "Current air mass for this star : " airMass
					print "Moving telescope to right ascension : " alpha$ " and declination : " delta$
					MOVETELESCOPE RArad[j] Decrad[j]
					Decdeg[j]=Decrad[j]*TODEG
					WaitForEndMoveTelescope
					if scoperecentering=TRUE then
						gosub recenterscope:
					endif
				endif
			REM we set the filter
			REM Filters C=1, B=6, V=11, I=16
			if filter[j]$="C" then
				setfilter 1
				print "Rotating to filter C"
			endif
			if filter[j]$="B" then
				setfilter 2
				print "Rotating to filter B"
			endif
			if filter[j]$="V" then
				setfilter 3
				print "Rotating to filter V"
			endif
			if filter[j]$="R" then
				setfilter 4
				print "Rotating to filter R"
			endif
			if filter[j]$="H" then
				setfilter 5
				print "Rotating to filter Halpha"
			endif

			REM Autoguiding
			if autoguide=TRUE then
				print "Starting autoguiding"
				StartGuide_Ex 2 1 GuidingExpTime 40 10 10 0.7 0.7 0.2 10 0.2 10 Decrad[j] 0 0 Valid message$
			endif

			REM Exposure
			val exposuretime[j]$ exposure
			exposureMS=1000*exposure
			print "Starting a " exposure " seconds exposure"
			startExposure exposureMS
			waitForEndExposure
			REM Recovering the image in order to save it
			getLastImageExposure img
			print "Exposure finished"

			REM calculating the image name
			REM the image name must be like name of the object, filter, exposure time and numberofimage
			str exposure exp$
			numberofimages[j]=numberofimages[j]+1
			str numberofimages[j] numberofimages$
			Nameimage$=star[j]$+"-"+filter[j]$+"-"+exp$+"s-"+numberofimages$
			
			savefit img nightdirectory$+Nameimage$
			print "Image " Nameimage$ " saved to disk"
			close img
		else
			REM the star is too close from the moon
			Distm=Distm*todeg
			print
			Print star[j]$ " is " Distm " degrees from the moon and can not be observed, we skip it"
		endif
	else
		REM the star is too low
		heightdeg=height*TODEG
		print 
		Print star[j]$ " is now at " heightdeg " degrees above the horizon, therefore too low, we skip it"
		
	endif
	REM we check if we have arrived at the end of the night
	timeleft=endofnighttime-date
	frac timeleft time
	observingtimeleft=time*24
	observingtimeleftmin=observingtimeleft*60
	if observingtimeleftmin<2 then
		REM we have arrived at the end of the night, we go out of the loop and close the telescope
		goto endnight:
	endif
REM if there are several stars and if the autoguiding is working, we have to stop autoguiding between each repointing.
	if autoguide=TRUE then
		if numberofstarsinloop>1 then
			StopGuide_Ex 2 1
		endif
	endif

next j
		
return




beginnighttime:
REM *******************************************************
REM Initialisation of the night
REM *******************************************************
REM we wait till the sun is 5 degrees below the horizon, then we initialize mount and camera

REM if we are running into this the first time
Now Date
GETRADECSUN  Date  AlphaS  DeltaS  sunelevation
Datetostr Date Date$
RAD_TO_DEC sunelevation ElevationS$
if sunelevation>0
	position$="above"
else
	position$="below"
endif
print "It is : " Date$ " the sun is at " ElevationS$ " degrees " position$ " the horizon"
if sunelevation>elevsunstartinitnight
Print "Waiting one minute..."
	delay 60000
	WAITFORENDDELAY
	goto beginnighttime:
endif
print "The sun is now " ElevationS$ " degrees below horizon, starting up camera and mount"
REM in theory, it would be nice to check the temperature of the camera, either directly or by leaving a given amount of time after this step.
REM to be done later.


REM *******************************************************
REM Initialisation of camera and telescope
REM *******************************************************
if telescopeparked=0 then
	REM on the 135mm telephoto lens, there is no dome to open, I left the lines which would be useful in REM
	REM print "Opening the dome, please wait...."
	REM execexternal "C:\Chile_dome\domecontrol\openclose\opendome.exe" ""
	REM delay 18000
	REM waitforenddelay
	gosub init_camera:
	gosub init_telescope:
	print "Camera and telescope started, waiting for the night to be dark"
else
	REM The telescope was already started, but we still make sure it is in the right configuration
	Detector_number=1
	REM to be changed too...
	nbinning=1
	SetBinningX nBinning
	SetBinningY nBinning
	REM to be tested
	REM SetWindow 37 22 4132 4117
	REM going down in temperature, minutestogodowntotemp minutes to go down to -30°C*
	for i=1 to minutestogodowntotemp
		GETCCDTEMPERATURE  Detector_number  Starttemperature
		print "Current temperature : " Starttemperature
		deltaT=Detectortemperature-Starttemperature
		deltaTperminute=deltaT/minutestogodowntotemp
		Currenttemperature=Starttemperature+(deltaTperminute*i)
		round Currenttemperature Currenttemperature
		print "Going from " Starttemperature " to " Detectortemperature " we need to cool " deltaTperminute " degrees per minute"
		if Currenttemperature<Detectortemperature+2 then
			goto endcooling2:
		else
			SETCCDTEMPERATURE Detector_number Currenttemperature
			print i " minute, CCD going down to " Currenttemperature " degrees"
			delay 60000
			waitforenddelay
		endif
	next i
	endcooling2:
SETCCDTEMPERATURE Detector_number Detectortemperature	
endif
	REM We now wait for the sun to be below 15°, then start observing.
waittillstarttime:
REM if we are running into this the first time
Now Date
GETRADECSUN  Date  AlphaS  DeltaS  sunelevation
Datetostr Date Date$
RAD_TO_DEC sunelevation ElevationS$
if sunelevation>0
	position$="above"
else
	position$="below"
endif
print "It is : " Date$ " the sun is at " ElevationS$ " degrees " position$ " the horizon"
if sunelevation>elevsunstartbegnight
print "Waiting one minute..."
	delay 60000
	WAITFORENDDELAY
	goto waittillstarttime:
endif
print "The sun is now " ElevationS$ " degrees below horizon, starting the observations"
REM putting the telescope back in tracking mode
if telescopeparked=0 then
	RETURN_TELESCOPE_TO_SIDEREAL
endif
return



REM ***************************************************
REM Computing the end of night time.
REM ***************************************************
endnighttime:
REM first check if we are past noon or not.

now year month day hour minute second  MS

REM if past noon we calculate the end of the following night
REM and we put the hours at 4 to start iteration

if hour>12 then
	day=day+1
	endif	
	hour=6

	ENCODEDATETIME  year month day hour minute second MS  Date
begincomputeendnight:
REM 0.003472=5 minutes, we iterate 5 minutes after 5 minutes and calculate sun height
date=date+0.003472

GETRADECSUN  date  AlphaS  DeltaS  sunelevation
sunelevationdeg=sunelevation*180/pi
REM DateToStr date date$
REM print "date = " date$ " sun elevation = " sunelevationdeg
if sunelevationdeg<(-12) then
	goto begincomputeendnight:
endif
endofnighttime=date
DATETOSTR endofnighttime endofnighttime$
print "End of night is : " endofnighttime$ " UT at sun elevation : " sunelevationdeg " degrees"

REM We have the time of the end of the night, so we can get back
return



REM ***************************************************
REM Recentering the telescope on the field
REM ***************************************************
recenterscope:
REM the telescope is started, we aim a given zone, take an image and resynch the scope.
REM at the beginning we suppose that in the park position, the telescope is aiming at the sky
REM i.e. that the dome is not covering the telephoto lens
print "Finding the position of the telescope in the sky, taking a short centering exposure"
setfilter 1
GET_TELESCOPE_POSITION_APP ADAPP DECAPP
STR_RAD_TO_RA ADAPP HH$ MM$ SS$
STR_RAD_TO_DEC DECAPP DD$ DM$ DS$
PRINT "The telescope is at RA : " HH$ "h " MM$ "m " SS$ "s and declination : " DD$ "° " DM$ "' " DS$ "''"
nbinning=1
SetBinningX_Ex 1 nBinning
SetBinningY_Ex 1 nBinning
REM with the 135mm telephoto lens, the full frame is too large a field for the auto centering to work correctly, so I take the center quarter of the field
SetWindow_Ex 1 1503 1002 2505 1670
startExposure shortExptimeMS
waitForEndExposure
REM Recovering the image
getLastImageExposure img
print "recentering exposure done"
print "finding the position of the telescope in a large field"
FIND_ALLSKY_POSITION img 40 40 5 Cat$ Valid
if Valid=1 then
	GET_TELESCOPE_POSITION_APP ADAPP2 DECAPP2	
	STR_RAD_TO_RA ADAPP2 HH$ MM$ SS$
	STR_RAD_TO_DEC DECAPP2 DD$ DM$ DS$
	PRINT "The telescope is at RA : " HH$ "h " MM$ "m " SS$ "s and declination : " DD$ "° " DM$ "' " DS$ "''"

	getalpha img centrealpha
	getdelta img centredelta
	CALIBRATE_TELESCOPE centrealpha centredelta
	Print "Successful recalibration of the telescope."
	RAD_TO_RA centrealpha centrealpha$
	RAD_TO_DEC centredelta centredelta$
	print "the telescope is at : " centrealpha$ " and declination : " centredelta$
	offsetalpha=(centrealpha-adapp)*todeg*3600
	offsetdelta=(centredelta-decapp)*todeg*3600
	print "the telescope was off by " offsetalpha " '' in RA and " offsetdelta " '' in declination"
else
	print "serious problem, field not identified"
	print "press a key to continue"
	pause
endif
close img


nbinning=1
SetBinningX_Ex 1 nBinning
SetBinningY_Ex 1 nBinning
SetWindow_Ex 1 1 1 4008 2672
return


REM *******************************************************
REM Subroutine to initialize the camera, contains informations and settings of the camera
REM *******************************************************

init_camera:
REM We start the camera
print "Connecting the camera"
Detector_number=1
cameraerror$=""
INIT_CCD_CAMERA_EX  Detector_number Valid  cameraerror$
if Valid=2 then
	nbinning=1
	SetBinningX nBinning
	SetBinningY nBinning
	REM modif SetWindow 37 22 4132 4117
	REM going down in temperature, minutestogodowntotemp minutes to go down to -30°C
	goto endcooling1:
	for i=1 to minutestogodowntotemp
		GETCCDTEMPERATURE  Detector_number  Starttemperature
		deltaT=Detectortemperature-Starttemperature
		deltaTperminute=deltaT/minutestogodowntotemp
		print "Going from " Starttemperature " to " Detectortemperature " we need to cool " deltaTperminute " degrees per minute"
		Currenttemperature=Starttemperature+(deltaTperminute*i)
		round Currenttemperature Currenttemperature
		if Currenttemperature<Detectortemperature+2 then
			goto endcooling1:
		else
		SETCCDTEMPERATURE Detector_number Currenttemperature
		print i " minute, CCD going down to " Currenttemperature " degrees"
		delay 60000
		waitforenddelay
		endif
	next i
endcooling1:
SETCCDTEMPERATURE Detector_number Detectortemperature	
else
REM The camera didn't initialize correctly
	print cameraerror$
endif	


REM We initialize the guiding camera
REM in my system, the guiding camera is not cooled. If it were it would be better to modify the loop above to take both cameras into account
REM loop above means the loop starting by 	for i=1 to minutestogodowntotemp

print "Connecting the guiding camera"
Detector_number=2
cameraerror$=""
INIT_CCD_CAMERA_EX  Detector_number Valid  cameraerror$
if Valid=2 then
	nbinning=1
	SetBinningX nBinning
	SetBinningY nBinning
else
REM The camera didn't initialize correctly
	print cameraerror$
endif	

return



REM *******************************************************
REM Initializing the telescope
REM *******************************************************
init_telescope:
print "Connecting to the telescope"
OPEN_TELESCOPE_DEVICES 0 0
unpark_telescope
REM we stop sideral tracking in the mean time 
print "stopping the sidereal tracking..."
stoptelescope
return

REM *******************************************************
REM Here we measure the temperature (have to see how) and set focus accordingly
REM *******************************************************
REM this means we will have to determine an equation giving focus position versus ambient temperature
REM for now this function does nothing
checkfocus:
return


REM ************************************************
REM End of night, closing telescope, camera, etc...
REM ***********************************************
endnight:
REM We have to see how to bring the camera back to ambient temperature before closing it.
print "Observing is finished, so closing the telescope..."
REM saving the last preprocessed image, if any


REM Stopping autoguiding before anything.
if autoguide=TRUE then
	StopGuide_Ex 2 1
endif




REM Closing the telescope
print "parking telescope, please wait"
REM print "start the script again if you want to continue..."
REM pause
REM modif need to change the values according to the park position
park_telescope 3.115 -1.18246
CLOSE_TELESCOPE_DEVICES

print "Waiting 15 minutes for the camera to warm up"
REM going up in temperature, minutestogodowntotemp minutes to go back to 0°C
REM going up in temperature, 15 minutes to go back to 0°C
	for i=1 to minutestogodowntotemp
		GETCCDTEMPERATURE  Detector_number  Starttemperature
		deltaTperminute=Starttemperature/minutestogodowntotemp
		abs deltaTperminute deltaTperminute
		delay 60000
		waitforenddelay
		Currenttemperature=Starttemperature+(deltaTperminute*i)
		round Currenttemperature Currenttemperature
		SETCCDTEMPERATURE Detector_number Currenttemperature
		print i " minute, CCD going up to " Currenttemperature " degrees"
	next i

	SETCCDTEMPERATURE 1 0

CLOSE_CCD_CAMERA_EX 1
REM in this script, the guiding camera is not cooled, so we don't go through a cooling sequence.
REM if you guiding camera is cooled, you have to modify the cooling sequence to work on both camera
CLOSE_CCD_CAMERA_EX 2


REM on the 135mm telephoto lens, the PC can not close the dome, it's done automatically by the C14 PC.

REM print "Closing the dome...."
REM ExecProcess processpath$ parameter$ TimeOutSec SuccessStatus ExitCode
REM execexternal "C:\Chile_dome\domecontrol\openclose\closedome.exe" ""
REM delay 20000
REM waitforenddelay
end
return

Alain
Alain-Maury
Messages : 94
Enregistré le : 19 juin 2009, 04:14

Re: Séquenceur d'observation d'étoiles variables

Message par Alain-Maury »

et donc maintenant la doc en anglais, bizarre qu'on ne puisse pas attacher des fichiers .pgm ou .txt à un message :
Variable star script - Documentation
Alain Maury – October 2017

The script is using the PC clock, i.e. local time.

The first thing to do is to fill a targetlist, which contains, one star per line, its name, its RA and Dec, using the following format :
CDInd 21 16 -58 41
ASAS 22 43 +08 09
CCScl 00 58 -29 21
TTAri 02 06 +15 17
IMEri 01 37 -55 12

Read the script and modify the name and the location of the targetlist accordingly so that the sequencer can find it.

A single space character is used as a separator, so the name of the star must be in one word. Then HH MM SDD mm (hours and minutes of RA) and sign (+ is not mandatory) degrees of declination and minutes of declination

The second thing to do is to build a script file for the night.
The script contains first a condition, and eventually a list of stars to be observed in sequence while the condition is met.
Each sequence of the script is separated by an empty line
such a script could be :

wait 21 30

loop 3
CDInd 30 C
ASAS 60 B

observetill 3 20
CDInd 30 C
ASAS 60 B

observetillstar CDInd sup 30
CCScl 30 C
TTAri 60 B
IMEri 60 C

end

There are so far 8 possible conditions :
wait HH MM
loop n
observetill HH MM
observetillstar starname sup D
observetillstar starname inf D
recenterscope on/off
autoguide on/off
end

Descriptions :
wait : Does not observe, waits till the HH MM time is passed. The time is local time

loop : Performs the sequence n times

observetill : Performs the sequence till HH MM hour. Time is local time

observetillstar star sub D : Performs the sequence till such star is above so many Degrees above the horizon

observetillstar star inf D : Performs the sequence till such star is below so many Degrees above the horizon

recenterscope : recalibrates the telescope position in the sky. This is done once on the first field of the sequence (of course it doesn't do anything before a wait or an end sequence, only for the commands taking images)

autoguide on/off starts or stops autoguiding.

end : end the sequences, and therefore parks the telescope, closes the dome, warms the CCD camera and turn everything off.. It might not be necessary to put this instruction if the program is sure to go past end of the twilight, in which case, the program will stop observations and close everything.

The script is rather shit in shit out, i.e. you goof in the target list or the script, it's very likely something interesting (or not) will occur.

So remember 1 space character is a separator (not 2), 1 empty line separates the sequences

The script can be edited with any text editor, notepad++ is preferred (to have line numbers).

It can be launched from prism, in the menu file either directly, or in debug mode, which allows to put break points and stop the running of the script at whatever point you want.

You are welcome to modify the script by yourself, you can change many parameters, the example the temperature and binning of the CCD camera, the times it takes to go down to the required temperature, the different directories where scripts and images are, the park position, etc... it's a good thing to read and understand vaguely what the script does.

Before anything, of course you should power telescope and camera etc… using the IP power switch.

Right now the first thing the script does is read the target list file (fixed directory, it can be modified by editing the script), then ask if the dome/telescope/camera is started or not, if it is not, when the sun is below enough (set at -5°), it opens the dome, connects to the telescope, connects to the camera and cools it down to the required temperature, then check that the sun is low enough (right now at -12°)then to take a test exposures, finds where it is in the sky, resynchronize the telescope, then go and observe. If the field is not found (most likely because the telescope was not parked correctly the last time it was used), the script pauses, i.e. you press a key on the keyboard to relaunch the script.

Things can be easily modified (mostly).

During the observing it checks whether the field is not too low (see the minimumheight variable), set at 15° right now, checks that the moon is not too close from the field (minimummoondistance variable set also at 15 degrees) and takes the exposure according to the required exposure time and filter.

Available filters are only L R G B H(Halpha). But can be modified easily.

At the end of each exposure, the script checks various conditions, such as end of the night, etc and decide what to do next.

At the end of the night or when the exposures are finished, the script parks the telescope, warms the camera, closes the dome, and disconnect.
The park is done at the position specified in prism
Good luck
Alain
Cyril Cavadore
Messages : 4480
Enregistré le : 18 juin 2009, 22:41
Localisation : 42

Re: Séquenceur d'observation d'étoiles variables

Message par Cyril Cavadore »

Superbe travail !!
Cyril Cavadore, ALCOR-SYSTEM, Auteur de PRISM
http://www.alcor-system.com

Pour reporter vos problème, la marche à suivre est ici
viewtopic.php?f=7&t=1403
Marc DELDEM
Messages : 1264
Enregistré le : 20 juin 2009, 01:01

Re: Séquenceur d'observation d'étoiles variables

Message par Marc DELDEM »

Oui merci pour le partage surtout !

Marc
Alain-Maury
Messages : 94
Enregistré le : 19 juin 2009, 04:14

Re: Séquenceur d'observation d'étoiles variables

Message par Alain-Maury »

Entre temps j'ai rajouté une fonction waittill star sup/inf deg donc qui permet de mettre le script en attente tant que telle étoile n'est pas au dessus de (ou en dessous de) tant de degrés.
Le truc est que dans le script pour les curieux il doit y avoir des bouts récupérables pour d'autres utilisations.
Alain
Olivier Thizy
Messages : 33
Enregistré le : 21 juin 2009, 09:34
Contact :

Re: Séquenceur d'observation d'étoiles variables

Message par Olivier Thizy »

Merci Alain,


super boulot et hyper sympa de partager. De mon côté j'ai travaillé sur la robustesse du système (notamment avec un miniPC avec ports série pour éliminer les convertisseurs USB/Série):
https://observatoire-belle-etoile.blogs ... ry_12.html

Je suis bientôt prêt pour plus automatiser mes séquences d'observations spectro. Ton script tombe à point! :-)


Cordialement,
Olivier
Avatar du membre
Marc SERRAU
Messages : 165
Enregistré le : 20 juin 2009, 11:08
Localisation : UAI B24 CESSON (77)
Contact :

Re: Séquenceur d'observation d'étoiles variables

Message par Marc SERRAU »

Merci Alain pour ce partage.
Je vais essayer de comprendre ce script et peut-être l'adapter à ma configuration.

Muchas gracias !
Marc Serrau
http://www.astrosurf.com/noctambule - Utilisateur de Prism depuis le XXème siècle.
UAI B24 - CESSON (F-77) & A77 - DAUBAN (F-04)
Alain-Maury
Messages : 94
Enregistré le : 19 juin 2009, 04:14

Re: Séquenceur d'observation d'étoiles variables

Message par Alain-Maury »

Dans tous les cas, si vous êtes intéressés je vous recommande de me demander la dernière version, et de cette manière je peux vous aider à le configurer pour votre télescope. Là c'est une version pour faire de la photométrie avec un téléobjectif de 135mm, donc par exemple je fais les images de recentrage avec un quart d'image, dans votre cas si vous avez un télescope, c'est peut être pas utile. Mais clair que lire le script et voir ce que ça fait, changer les adresses des fichiers, catalogues etc... et sinon lancer, voir où ça plante, résoudre le problème, etc...
Là depuis le 18 Septembre (on est le 8 Octobre) ça m'a permis de générer 250 Go d'images. Maintenant faut que je les réduise, c'est une autre histoire.
Alain
Marc DELDEM
Messages : 1264
Enregistré le : 20 juin 2009, 01:01

Re: Séquenceur d'observation d'étoiles variables

Message par Marc DELDEM »

Salut Alain,

Il y a un petit bug dans la version du script que tu as soumis ici.
Si tu as la séquence suivante:
loop 3
obj1 5 C

loop 3
obj2 5 C

end
Alors il commence à lire la ligne
loop 3
De là il voit que c'est un loop, il voit qu'il faut faire un cycle de 3.
Puis il va commencer à lire les objets.
Il lit la ligne suivante, donc:
obj1 5 C
Donc là il trouve obj1, il doit poser 5 secondes avec le filtre C.
C'est ensuite qu'il y a un problème, car tu ne sais pas combien d'objets tu as dans ce loop.
Donc tu lis la ligne suivante. Et elle va être vide.
Cela correspond au test:

Code : Tout sélectionner

		REM here we read the lines following the loop instructions, till we encounter an empty line.
		if star$<>"" then
                   ...
		endif
		REM now we loop numberofcycles time, moving the telescope, exposing, saving the image, moving the telescope, etc...
		for i=1 numberofcycles
			gosub expose:
		next i
Donc comme c'est une ligne vide, star$ va être vide, il ne passe pas dans le if. Il fait ensuite la boucle avec le expose.
Puis tu passes à la suite:

Code : Tout sélectionner

		REM we read the next empty line to be able to read the next instruction later
		ReadFileTxt scriptfile loop$
		goto nextsequence:
=> Or c'est là que cela pose problème car tu vas lire dans ce cas une ligne qui n'est plus vide mais qui est le 2nd "loop 3" de la séquence.
Et donc il skip cette instruction.
Dans le cas d'un loop, il ne faut pas faire cette partie de code:

Code : Tout sélectionner

		REM we read the next empty line to be able to read the next instruction later
		ReadFileTxt scriptfile loop$		
Il faut juste faire:

Code : Tout sélectionner

                goto nextsequence:
Bon tu as surement du corriger ce bug j'imagine.
A+ Marc
Répondre