You can subscribe to this list here.
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2012 |
Jan
(1) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(4) |
2013 |
Jan
|
Feb
|
Mar
(2) |
Apr
(4) |
May
(6) |
Jun
(47) |
Jul
(6) |
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2014 |
Jan
(30) |
Feb
(7) |
Mar
(11) |
Apr
(6) |
May
(4) |
Jun
|
Jul
(9) |
Aug
(7) |
Sep
(1) |
Oct
|
Nov
(4) |
Dec
|
2015 |
Jan
|
Feb
(2) |
Mar
(12) |
Apr
(15) |
May
(2) |
Jun
(2) |
Jul
(4) |
Aug
(1) |
Sep
|
Oct
(3) |
Nov
(13) |
Dec
(1) |
2016 |
Jan
|
Feb
|
Mar
(4) |
Apr
(1) |
May
(20) |
Jun
|
Jul
(4) |
Aug
(7) |
Sep
(17) |
Oct
(5) |
Nov
(16) |
Dec
(9) |
2017 |
Jan
(28) |
Feb
(13) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(12) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2018 |
Jan
(14) |
Feb
|
Mar
(7) |
Apr
(4) |
May
(33) |
Jun
(1) |
Jul
|
Aug
(2) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(3) |
Jun
(1) |
Jul
(3) |
Aug
(1) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
|
2020 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
(1) |
Sep
(4) |
Oct
|
Nov
|
Dec
|
2021 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
(1) |
2022 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(2) |
Oct
(1) |
Nov
(1) |
Dec
|
2023 |
Jan
(1) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
(1) |
Jul
(1) |
Aug
(2) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2024 |
Jan
|
Feb
(1) |
Mar
(2) |
Apr
(2) |
May
(2) |
Jun
(1) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: Guifré C. <gui...@ce...> - 2018-05-17 19:54:36
|
You are welcome, nevertheless, keep in mind one thing: we discourage using these python loops in ipython to execute several macros. We recommend macro executions (or macro sequences). We have had long discussions with our scientists, and our argument is about the abort procedure. What should happen when the user presses Ctrl+C? in this example, for i in range(5): ipython.magic("ascan mot 0 10 10 1") if Ctrl+C is captured by the magic command that is executing ascan remotely at the MacroServer, the exception will be captured, an "abort" command will be issued to the MacroServer to abort the ascan and then ... the next i+1 ascan will start! if Ctrl+C is captured between two ascans, the loop will stop. This is very dangerous, and there are other examples were you would like to guarantee that if the user aborts no more macros have to be executed... As I said, we don't recommend this usage for sequences of macros, there is always the option to encapsulate it with a simple macro or a proper macro sequence. Cheers, Guifré. On 17/May/2018 18:05, Daniel Schick wrote: > oh, cool. thanks for the info! > > Guifré Cuní <gui...@ce... <mailto:gui...@ce...>> > schrieb am Do., 17. Mai 2018 um 17:52 Uhr: > > Hi, > > regarding your first concern, macros in spock are not python > functions because the current design is based on executing them > inside the MacroServer TANGO DS process (wherever it is running). > > Spock is exposing those macros as magic commands that will request > that macro execution at the MacroServer side. > > To encapsulate magic commands within a python code, you can use this: > > ipython = get_ipython() > for i in range(5): ipython.magic("ascan mot 0 10 10 1") > > Same could be used for your second question: > ipython.magic("umv mot 1"); ipython.magic("ct 1"); > ipython.magic("ascan mot 0 10 10 1") > > or: > cmds = ["umv mot 1"; "ct 1"; "ascan mot 0 10 10 1"] > for cmd in cmds: ipython.magic(cmd) > > > Cheers, > > Guifré. > > > > On 17/05/18 17:14, Daniel Schick wrote: >> okay, I just tried writing simple python macros for doing complex >> scan macros today, and I guess it is fine. >> As @cpascual says, it might not be worth the effort to develop DSL. >> >> However, I was just naively hoping that one can use sardana >> macros just as normal python functions in spock/ipython. >> >> because this works: >> >> for i in range(5): print(i) >> >> I hoped that >> >> for i in range(5): ascan mot 0 10 10 1 >> >> should also work from within spock. >> >> another thing would be concatenation, like: >> >> umv mot 1; ct 1; ascan mot 0 10 10 1 >> >> which also does not work. >> What is actually the limitation here? Why are these examples not >> working? >> >> Best >> >> Daniel >> >> >> >> Carlos Pascual <cpa...@ce... <mailto:cpa...@ce...>> >> schrieb am Do., 17. Mai 2018 um 10:46 Uhr: >> >> Just my personal opinion: >> >> I think it is better **not** to introduce more advanced >> programming >> capabilities (e.g. loops, conditionals, etc) in the sequencer. >> >> The reason is that we would be developing (and maintaining!) >> a domain-specific >> language (DSL) which in fact would be very close to a subset >> of python. >> >> The advantage of a python macro over a sequencer DSL approach >> for doing >> anything more complex than a dumb sequence of spock-like >> commands is that: >> a) we do not need to implement/debug/maintain the DSL >> b) python syntax can be as simple as any DSL as long as you >> stick to >> structured programming paradigm (which is possible with >> Sardana macros) >> c) there are already lots of docs to learn the most basic >> python syntax >> d) many people (specially scientists) are already familiar >> with python (while >> they would need to learn the specifics of our DSL) >> e) In the (inevitable) case in which a power user eventually >> wants to >> complicate her logic a bit more, python would already >> support it, while in >> the case of a DSL we would be having this discussion once again. >> >> >> >> >> On Wednesday, May 16, 2018 9:11:41 AM CEST Daniel Schick wrote: >> > Dear Zibi, >> > >> > thanks for the detailed answer. >> > Good to know that the sequencer is also able of handling >> plain text files, >> > which will be fine for many situation. >> > >> > From my experience at beamlines, users and myself often >> want to run a set >> > of scans for a given set of parameters. >> > Most often these parameters are not equally spaced so >> nested ascan in the >> > sequencer won't work for them. >> > >> > In SPEC I am used to define an array for each parameter and >> then use a for >> > loop to iterate of this array. >> > From your answer, I conclude that I need to write a simple >> scan macro to >> > realize that, right? >> > >> > Personally, I would prefer something like SPEC's qdo >> capabilities. >> > So first of all being able to run a sequence of macros in >> plain text file >> > also from within spock. >> > If this qdo macro would also understand python loops and >> list or numpy >> > arrays it would be perfect. >> > >> > I have simply the feeling that for non-programmers writing >> sardana macros >> > might be a bit heavy and especially error-prone. >> > These guys will appriciate the sequencer, but this will not >> work with >> > looping of arrays of parameters as I said. >> > >> > If you think, something like a qdo macro is possible from >> spock I could try >> > implementing it if you could provide me with some initial help. >> > >> > BTW: my MacroServer does not have a MacroPath property. >> Only MacroList and >> > MacroLibList. Do I have to add this property myself? >> > >> > Best >> > >> > Daniel >> > >> > >> > Zbigniew Reszela <zre...@ce... >> <mailto:zre...@ce...>> schrieb am Di., 15. Mai 2018 um >> > >> > 17:11 Uhr: >> > > Hi Daniel, >> > > >> > > >> > > Based on our conversation in >> > > https://github.com/sardana-org/sardana/issues/744 I think >> you are already >> > > familiar with most of the sequencer features. >> > > >> > > >> > > There is maybe one more which is not documented and is >> related to your >> > > question from this email. >> > > >> > > As you know, in the sequencer you can load the previously >> exported files >> > > to the XML format, but also plain text files with spock >> syntax composed >> > > directly by the user e.g. >> > > >> > > senv ActiveMntGrp my-exp-01 >> > > >> > > ascan mot01 0 1 1 0.1 >> > > >> > > dscan mot02 -1 1 1 0.1 >> > > >> > > However, the plain text files are limited, for example, >> they don't support >> > > hooks. >> > > >> > > >> > > Now a little bit of the history behind the sequencer. At >> the beginning of >> > > its development we assumed that it won't provide >> programming features like >> > > parameterizable macro execution in loops, exception >> handing, etc. For >> > > these >> > > needs we suggest to develop simple macros. >> > > >> > > Nevertheless, sequencer is frequently used at some of >> Alba's beamlines, >> > > for simple sequences, even using the recently introduced >> to the standard >> > > macro catalogue the repeat macro. >> > > >> > > We are very open for your feedback so please propose >> changes or point >> > > missing features for the sequencer or any other part of >> Sardana. For this >> > > needs, please use the Github issues so in the future it >> will be easier to >> > > search for the information. >> > > >> > > >> > > BTW the example from this email should be easily >> fulfilled by the >> > > sequencer and the repeat macro, isn't it? >> > > >> > > >> > > Now, regarding developing simple macros. For sure you >> already found this >> > > chapter in the documentation: >> > > >> > > >> http://www.sardana-controls.org/en/latest/devel/howto_macros/index.html >> > > >> > > One could use the edmac magic command in spock and >> develop a simple macro >> > > to fulfill the same need: >> > > >> > > Door_zreszela_1 [6]: %edmac? >> > > Docstring: >> > > edmac <macro name> [<module>] >> > > Returns the contents of the macro file which contains the >> macro code for >> > > the given macro name. If the module is given and it does >> not exist a new >> > > one is created. If the given module is a simple module >> name and it does >> > > not exist, it will be created on the first directory >> mentioned in the >> > > MacroPath >> > > File: ~/workspace/sardana/src/sardana/spock/magic.py >> > > >> > > Door_zreszela_1 [7]: %edmac my_loop >> > > /home/zreszela/workspace/macros/my_macros.py >> > > Opening >> /home/zreszela/workspace/macros/my_macros.py.my_loop... >> > > Editing... >> > > >> > > [here I developed the following macro (a template was >> populated by >> > > Sardana)] >> > > >> > > 1 from sardana.macroserver.macro import Macro, macro, >> > > >> > > Type >> > > >> > > 2 >> > > >> > > 3 >> > > >> > > @macro() >> > > >> > > 4 def >> > > >> > > my_loop(self): >> > > 5 """Macro >> > > >> > > my_loop""" >> > > >> > > 6 self.output("Running >> > > >> > > my_loop...") >> > > >> > > 7 >> > > >> > > #my_night_scans.py >> > > >> > > 8 self.execMacro("ascan mot01 10 20 10 >> > > >> > > 1") >> > > >> > > 9 param = >> > > >> > > range(10) >> > > >> > > 10 >> > > >> > > 11 for i in >> > > >> > > param: >> > > 12 self.execMacro("dscan mot02 0 100 10 1") >> > > >> > > [end of the macro] >> > > >> > > Do you want to apply the new code on the server? [y] >> > > Storing... [DONE] >> > > >> > > Door_zreszela_1 [8]: %my_loop >> > > Running my_loop... >> > > Operation will be saved in /home/zreszela/tmp/test.dat (Spec) >> > > Scan #381 started at Tue May 15 16:34:40 2018. It will >> take at least >> > > 0:00:22.627553 >> > > >> > > #Pt No mot01 ct01 dt >> > > >> > > 0 10 1 2.71108 >> > > 1 11 1 4.7807 >> > > 2 12 1 6.71653 >> > > 3 13 1 8.6432 >> > > 4 14 1 10.5776 >> > > 5 15 1 12.5214 >> > > 6 16 1 14.4605 >> > > 7 17 1 16.3993 >> > > 8 18 1 18.3318 >> > > 9 19 1 20.2681 >> > > 10 20 1 22.2003 >> > > >> > > Operation saved in /home/zreszela/tmp/test.dat (Spec) >> > > Scan #381 ended at Tue May 15 16:35:04 2018, taking >> 0:00:23.220636. Dead >> > > time 52.6% (motion dead time 50.9%) >> > > Operation will be saved in /home/zreszela/tmp/test.dat (Spec) >> > > Scan #382 started at Tue May 15 16:35:04 2018. It will >> take at least >> > > 0:00:22 >> > > >> > > #Pt No mot02 ct01 dt >> > > >> > > 0 0 1 0.033344 >> > > 1 10 1 2.18017 >> > > >> > > [here is the rest of the output on my_loop macro] >> > > >> > > >> > > Note that the "/home/zreszela/workspace/macros/" path is >> configured in the >> > > MacroPath property of the MacroServer Tango device. >> > > >> > > There is a graphical alternative to the edmac magic >> command which is >> > > called sardanaeditor. It should provide you the same >> functionality but >> > > with >> > > a spyder like editor. >> > > >> > > >> > > Hope that this somehow helps you! >> > > >> > > Cheers, >> > > >> > > Zibi >> > > >> > > >> > > On 05/14/2018 03:05 PM, Daniel Schick wrote: >> > > >> > > Hej all, >> > > >> > > while playing with the sequencer and doing first steps >> with writing >> > > macros, I was wondering what are possible ways of >> realizing long nested >> > > scan sequences in Sardana. >> > > >> > > So far I know the sequencer GUI and also loading the >> appropriate .xml >> > > files for the sequencer. >> > > >> > > As I understood it, sardana macros are not intended for >> realizing scan >> > > sequnces. >> > > >> > > I also tried something in spock such as: >> > > for i in range(10): ascan mot1 0 10 10 1 >> > > >> > > but without success. Is there a way to use build-in >> python functions/loops >> > > in combination with sardana macros to realize scan sequences? >> > > >> > > maybe also calling python scripts >> <https://maps.google.com/?q=ing+python+scripts+&entry=gmail&source=g>like: >> > > >> %run ./my_night_scans.py >> > > >> > > #my_night_scans.py >> > > ascan mot1 10 20 10 1 >> > > param = range(10) >> > > >> > > for i in param: >> > > dscan mot2 0 100 10 1 >> > > >> > > I know that this would be quite close to SPEC's >> implementation of its >> > > macro engine. But for some users the sequencer GUI and >> it's XML file >> > > format might be a bit unfamiliar... >> > > >> > > >> > > Best Daniel >> > > >> > > >> > > >> > > >> > > >> -------------------------------------------------------------------------- >> > > ---- Check out the vibrant tech community on one of the >> world's most >> > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot >> > > >> > > >> > > >> > > _______________________________________________ >> > > Sardana-users mailing >> > > lis...@li...https:// >> <mailto:lis...@li...https://>lists.sourceforge.net/list >> <http://lists.sourceforge.net/list> >> > > s/listinfo/sardana-users >> > > >> > > >> > > -- >> > > >> > > [image: ALBA Synchrotron] <http://www.albasynchrotron.es> >> > > Zbigniew Reszela >> > > Computing & Controls Division >> > > >> > > ALBA SYNCHROTRON LIGHT SOURCE >> > > Carrer de la Llum 2-26 | 08290 | Cerdanyola del Vallès| >> Barcelona | Spain >> > > <http://www.cells.es/en/about/coming-to-alba> >> > > (+34) 93 592 4407 <tel:+34%20935%2092%2044%2007> >> <+34%20935%2092%2044%2007> >> > > www.albasynchrotron.es <http://www.albasynchrotron.es> | >> zre...@ce... <mailto:zre...@ce...> | legal notice >> > > <https://www.cells.es/en/about/legal-notice> >> > > >> > > >> > > * Please, do not print this e-mail unless it is >> absolutely necessary. * >> > > Si heu rebut aquest correu per error, us informo que pot >> contenir >> > > informació confidencial i privada i que està prohibit el >> seu ús. Us >> > > agrairíem que ho comuniqueu al remitent i l'elimineu. >> Gràcies. >> > > Si ha recibido este correo por error, le informo de que >> puede contener >> > > información confidencial y privada y que está prohibido >> su uso. Le >> > > agradeceré que lo comunique a su remitente y lo elimine. >> Gracias. >> > > If you have received this e-mail in error, please note >> that it may contain >> > > confidential and private information, therefore, the use >> of this >> > > information is strictly forbidden. Please inform the >> sender of the error >> > > and delete the information received. Thank you. >> >> >> -- >> +----------------------------------------------------+ >> Carlos Pascual Izarra >> Scientific Software Coordinator >> Computing Division >> ALBA Synchrotron [http://www.albasynchrotron.es] >> Carrer de la Llum 2-26 >> E-08290 Cerdanyola del Valles (Barcelona), Spain >> E-mail: cpa...@ce... <mailto:cpa...@ce...> >> Phone: +34 93 592 4428 <tel:+34%20935%2092%2044%2028> >> +----------------------------------------------------+ >> >> >> >> ------------------------------------------------------------------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, Slashdot.org!http://sdm.link/slashdot >> >> >> _______________________________________________ >> Sardana-users mailing list >> Sar...@li... >> <mailto:Sar...@li...> >> https://lists.sourceforge.net/lists/listinfo/sardana-users > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! > http://sdm.link/slashdot_______________________________________________ > Sardana-users mailing list > Sar...@li... > <mailto:Sar...@li...> > https://lists.sourceforge.net/lists/listinfo/sardana-users > |
From: Daniel S. <sch...@gm...> - 2018-05-17 16:06:00
|
oh, cool. thanks for the info! Guifré Cuní <gui...@ce...> schrieb am Do., 17. Mai 2018 um 17:52 Uhr: > Hi, > > regarding your first concern, macros in spock are not python functions > because the current design is based on executing them inside the > MacroServer TANGO DS process (wherever it is running). > > Spock is exposing those macros as magic commands that will request that > macro execution at the MacroServer side. > > To encapsulate magic commands within a python code, you can use this: > > ipython = get_ipython() > for i in range(5): ipython.magic("ascan mot 0 10 10 1") > > Same could be used for your second question: > ipython.magic("umv mot 1"); ipython.magic("ct 1"); ipython.magic("ascan > mot 0 10 10 1") > > or: > cmds = ["umv mot 1"; "ct 1"; "ascan mot 0 10 10 1"] > for cmd in cmds: ipython.magic(cmd) > > > Cheers, > > Guifré. > > > > On 17/05/18 17:14, Daniel Schick wrote: > > okay, I just tried writing simple python macros for doing complex scan > macros today, and I guess it is fine. > As @cpascual says, it might not be worth the effort to develop DSL. > > However, I was just naively hoping that one can use sardana macros just as > normal python functions in spock/ipython. > > because this works: > > for i in range(5): print(i) > > I hoped that > > for i in range(5): ascan mot 0 10 10 1 > > should also work from within spock. > > another thing would be concatenation, like: > > umv mot 1; ct 1; ascan mot 0 10 10 1 > > which also does not work. > What is actually the limitation here? Why are these examples not working? > > Best > > Daniel > > > > Carlos Pascual <cpa...@ce...> schrieb am Do., 17. Mai 2018 um > 10:46 Uhr: > >> Just my personal opinion: >> >> I think it is better **not** to introduce more advanced programming >> capabilities (e.g. loops, conditionals, etc) in the sequencer. >> >> The reason is that we would be developing (and maintaining!) a >> domain-specific >> language (DSL) which in fact would be very close to a subset of python. >> >> The advantage of a python macro over a sequencer DSL approach for doing >> anything more complex than a dumb sequence of spock-like commands is that: >> a) we do not need to implement/debug/maintain the DSL >> b) python syntax can be as simple as any DSL as long as you stick to >> structured programming paradigm (which is possible with Sardana macros) >> c) there are already lots of docs to learn the most basic python syntax >> d) many people (specially scientists) are already familiar with python >> (while >> they would need to learn the specifics of our DSL) >> e) In the (inevitable) case in which a power user eventually wants to >> complicate her logic a bit more, python would already support it, while >> in >> the case of a DSL we would be having this discussion once again. >> >> >> >> >> On Wednesday, May 16, 2018 9:11:41 AM CEST Daniel Schick wrote: >> > Dear Zibi, >> > >> > thanks for the detailed answer. >> > Good to know that the sequencer is also able of handling plain text >> files, >> > which will be fine for many situation. >> > >> > From my experience at beamlines, users and myself often want to run a >> set >> > of scans for a given set of parameters. >> > Most often these parameters are not equally spaced so nested ascan in >> the >> > sequencer won't work for them. >> > >> > In SPEC I am used to define an array for each parameter and then use a >> for >> > loop to iterate of this array. >> > From your answer, I conclude that I need to write a simple scan macro to >> > realize that, right? >> > >> > Personally, I would prefer something like SPEC's qdo capabilities. >> > So first of all being able to run a sequence of macros in plain text >> file >> > also from within spock. >> > If this qdo macro would also understand python loops and list or numpy >> > arrays it would be perfect. >> > >> > I have simply the feeling that for non-programmers writing sardana >> macros >> > might be a bit heavy and especially error-prone. >> > These guys will appriciate the sequencer, but this will not work with >> > looping of arrays of parameters as I said. >> > >> > If you think, something like a qdo macro is possible from spock I could >> try >> > implementing it if you could provide me with some initial help. >> > >> > BTW: my MacroServer does not have a MacroPath property. Only MacroList >> and >> > MacroLibList. Do I have to add this property myself? >> > >> > Best >> > >> > Daniel >> > >> > >> > Zbigniew Reszela <zre...@ce...> schrieb am Di., 15. Mai 2018 um >> > >> > 17:11 Uhr: >> > > Hi Daniel, >> > > >> > > >> > > Based on our conversation in >> > > https://github.com/sardana-org/sardana/issues/744 I think you are >> already >> > > familiar with most of the sequencer features. >> > > >> > > >> > > There is maybe one more which is not documented and is related to your >> > > question from this email. >> > > >> > > As you know, in the sequencer you can load the previously exported >> files >> > > to the XML format, but also plain text files with spock syntax >> composed >> > > directly by the user e.g. >> > > >> > > senv ActiveMntGrp my-exp-01 >> > > >> > > ascan mot01 0 1 1 0.1 >> > > >> > > dscan mot02 -1 1 1 0.1 >> > > >> > > However, the plain text files are limited, for example, they don't >> support >> > > hooks. >> > > >> > > >> > > Now a little bit of the history behind the sequencer. At the >> beginning of >> > > its development we assumed that it won't provide programming features >> like >> > > parameterizable macro execution in loops, exception handing, etc. For >> > > these >> > > needs we suggest to develop simple macros. >> > > >> > > Nevertheless, sequencer is frequently used at some of Alba's >> beamlines, >> > > for simple sequences, even using the recently introduced to the >> standard >> > > macro catalogue the repeat macro. >> > > >> > > We are very open for your feedback so please propose changes or point >> > > missing features for the sequencer or any other part of Sardana. For >> this >> > > needs, please use the Github issues so in the future it will be >> easier to >> > > search for the information. >> > > >> > > >> > > BTW the example from this email should be easily fulfilled by the >> > > sequencer and the repeat macro, isn't it? >> > > >> > > >> > > Now, regarding developing simple macros. For sure you already found >> this >> > > chapter in the documentation: >> > > >> > > >> http://www.sardana-controls.org/en/latest/devel/howto_macros/index.html >> > > >> > > One could use the edmac magic command in spock and develop a simple >> macro >> > > to fulfill the same need: >> > > >> > > Door_zreszela_1 [6]: %edmac? >> > > Docstring: >> > > edmac <macro name> [<module>] >> > > Returns the contents of the macro file which contains the macro code >> for >> > > the given macro name. If the module is given and it does not exist a >> new >> > > one is created. If the given module is a simple module name and it >> does >> > > not exist, it will be created on the first directory mentioned in the >> > > MacroPath >> > > File: ~/workspace/sardana/src/sardana/spock/magic.py >> > > >> > > Door_zreszela_1 [7]: %edmac my_loop >> > > /home/zreszela/workspace/macros/my_macros.py >> > > Opening /home/zreszela/workspace/macros/my_macros.py.my_loop... >> > > Editing... >> > > >> > > [here I developed the following macro (a template was populated by >> > > Sardana)] >> > > >> > > 1 from sardana.macroserver.macro import Macro, macro, >> > > >> > > Type >> > > >> > > 2 >> > > >> > > 3 >> > > >> > > @macro() >> > > >> > > 4 def >> > > >> > > my_loop(self): >> > > 5 """Macro >> > > >> > > my_loop""" >> > > >> > > 6 self.output("Running >> > > >> > > my_loop...") >> > > >> > > 7 >> > > >> > > #my_night_scans.py >> > > >> > > 8 self.execMacro("ascan mot01 10 20 10 >> > > >> > > 1") >> > > >> > > 9 param = >> > > >> > > range(10) >> > > >> > > 10 >> > > >> > > 11 for i in >> > > >> > > param: >> > > 12 self.execMacro("dscan mot02 0 100 10 1") >> > > >> > > [end of the macro] >> > > >> > > Do you want to apply the new code on the server? [y] >> > > Storing... [DONE] >> > > >> > > Door_zreszela_1 [8]: %my_loop >> > > Running my_loop... >> > > Operation will be saved in /home/zreszela/tmp/test.dat (Spec) >> > > Scan #381 started at Tue May 15 16:34:40 2018. It will take at least >> > > 0:00:22.627553 >> > > >> > > #Pt No mot01 ct01 dt >> > > >> > > 0 10 1 2.71108 >> > > 1 11 1 4.7807 >> > > 2 12 1 6.71653 >> > > 3 13 1 8.6432 >> > > 4 14 1 10.5776 >> > > 5 15 1 12.5214 >> > > 6 16 1 14.4605 >> > > 7 17 1 16.3993 >> > > 8 18 1 18.3318 >> > > 9 19 1 20.2681 >> > > 10 20 1 22.2003 >> > > >> > > Operation saved in /home/zreszela/tmp/test.dat (Spec) >> > > Scan #381 ended at Tue May 15 16:35:04 2018, taking 0:00:23.220636. >> Dead >> > > time 52.6% (motion dead time 50.9%) >> > > Operation will be saved in /home/zreszela/tmp/test.dat (Spec) >> > > Scan #382 started at Tue May 15 16:35:04 2018. It will take at least >> > > 0:00:22 >> > > >> > > #Pt No mot02 ct01 dt >> > > >> > > 0 0 1 0.033344 >> > > 1 10 1 2.18017 >> > > >> > > [here is the rest of the output on my_loop macro] >> > > >> > > >> > > Note that the "/home/zreszela/workspace/macros/" path is configured >> in the >> > > MacroPath property of the MacroServer Tango device. >> > > >> > > There is a graphical alternative to the edmac magic command which is >> > > called sardanaeditor. It should provide you the same functionality but >> > > with >> > > a spyder like editor. >> > > >> > > >> > > Hope that this somehow helps you! >> > > >> > > Cheers, >> > > >> > > Zibi >> > > >> > > >> > > On 05/14/2018 03:05 PM, Daniel Schick wrote: >> > > >> > > Hej all, >> > > >> > > while playing with the sequencer and doing first steps with writing >> > > macros, I was wondering what are possible ways of realizing long >> nested >> > > scan sequences in Sardana. >> > > >> > > So far I know the sequencer GUI and also loading the appropriate .xml >> > > files for the sequencer. >> > > >> > > As I understood it, sardana macros are not intended for realizing scan >> > > sequnces. >> > > >> > > I also tried something in spock such as: >> > > for i in range(10): ascan mot1 0 10 10 1 >> > > >> > > but without success. Is there a way to use build-in python >> functions/loops >> > > in combination with sardana macros to realize scan sequences? >> > > >> > > maybe also calling python scripts >> <https://maps.google.com/?q=ing+python+scripts+&entry=gmail&source=g> >> like: >> > > >> %run ./my_night_scans.py >> > > >> > > #my_night_scans.py >> > > ascan mot1 10 20 10 1 >> > > param = range(10) >> > > >> > > for i in param: >> > > dscan mot2 0 100 10 1 >> > > >> > > I know that this would be quite close to SPEC's implementation of its >> > > macro engine. But for some users the sequencer GUI and it's XML file >> > > format might be a bit unfamiliar... >> > > >> > > >> > > Best Daniel >> > > >> > > >> > > >> > > >> > > >> -------------------------------------------------------------------------- >> > > ---- Check out the vibrant tech community on one of the world's most >> > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot >> > > >> > > >> > > >> > > _______________________________________________ >> > > Sardana-users mailing >> > > lis...@li...https:// >> lists.sourceforge.net/list >> > > s/listinfo/sardana-users >> > > >> > > >> > > -- >> > > >> > > [image: ALBA Synchrotron] <http://www.albasynchrotron.es> >> > > Zbigniew Reszela >> > > Computing & Controls Division >> > > >> > > ALBA SYNCHROTRON LIGHT SOURCE >> > > Carrer de la Llum 2-26 | 08290 | Cerdanyola del Vallès| Barcelona | >> Spain >> > > <http://www.cells.es/en/about/coming-to-alba> >> > > (+34) 93 592 4407 <+34%20935%2092%2044%2007> >> <+34%20935%2092%2044%2007> >> > > www.albasynchrotron.es | zre...@ce... | legal notice >> > > <https://www.cells.es/en/about/legal-notice> >> > > >> > > >> > > * Please, do not print this e-mail unless it is absolutely necessary. >> * >> > > Si heu rebut aquest correu per error, us informo que pot contenir >> > > informació confidencial i privada i que està prohibit el seu ús. Us >> > > agrairíem que ho comuniqueu al remitent i l'elimineu. Gràcies. >> > > Si ha recibido este correo por error, le informo de que puede contener >> > > información confidencial y privada y que está prohibido su uso. Le >> > > agradeceré que lo comunique a su remitente y lo elimine. Gracias. >> > > If you have received this e-mail in error, please note that it may >> contain >> > > confidential and private information, therefore, the use of this >> > > information is strictly forbidden. Please inform the sender of the >> error >> > > and delete the information received. Thank you. >> >> >> -- >> +----------------------------------------------------+ >> Carlos Pascual Izarra >> Scientific Software Coordinator >> Computing Division >> ALBA Synchrotron [http://www.albasynchrotron.es] >> Carrer de la Llum 2-26 >> E-08290 Cerdanyola del Valles (Barcelona), Spain >> E-mail: cpa...@ce... >> Phone: +34 93 592 4428 <+34%20935%2092%2044%2028> >> +----------------------------------------------------+ >> >> > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > > _______________________________________________ > Sardana-users mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/sardana-users > > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Sardana-users mailing list > Sar...@li... > https://lists.sourceforge.net/lists/listinfo/sardana-users > |
From: Guifré C. <gui...@ce...> - 2018-05-17 15:52:15
|
Hi, regarding your first concern, macros in spock are not python functions because the current design is based on executing them inside the MacroServer TANGO DS process (wherever it is running). Spock is exposing those macros as magic commands that will request that macro execution at the MacroServer side. To encapsulate magic commands within a python code, you can use this: ipython = get_ipython() for i in range(5): ipython.magic("ascan mot 0 10 10 1") Same could be used for your second question: ipython.magic("umv mot 1"); ipython.magic("ct 1"); ipython.magic("ascan mot 0 10 10 1") or: cmds = ["umv mot 1"; "ct 1"; "ascan mot 0 10 10 1"] for cmd in cmds: ipython.magic(cmd) Cheers, Guifré. On 17/05/18 17:14, Daniel Schick wrote: > okay, I just tried writing simple python macros for doing complex scan > macros today, and I guess it is fine. > As @cpascual says, it might not be worth the effort to develop DSL. > > However, I was just naively hoping that one can use sardana macros > just as normal python functions in spock/ipython. > > because this works: > > for i in range(5): print(i) > > I hoped that > > for i in range(5): ascan mot 0 10 10 1 > > should also work from within spock. > > another thing would be concatenation, like: > > umv mot 1; ct 1; ascan mot 0 10 10 1 > > which also does not work. > What is actually the limitation here? Why are these examples not working? > > Best > > Daniel > > > > Carlos Pascual <cpa...@ce... <mailto:cpa...@ce...>> schrieb > am Do., 17. Mai 2018 um 10:46 Uhr: > > Just my personal opinion: > > I think it is better **not** to introduce more advanced programming > capabilities (e.g. loops, conditionals, etc) in the sequencer. > > The reason is that we would be developing (and maintaining!) a > domain-specific > language (DSL) which in fact would be very close to a subset of > python. > > The advantage of a python macro over a sequencer DSL approach for > doing > anything more complex than a dumb sequence of spock-like commands > is that: > a) we do not need to implement/debug/maintain the DSL > b) python syntax can be as simple as any DSL as long as you stick to > structured programming paradigm (which is possible with Sardana > macros) > c) there are already lots of docs to learn the most basic python > syntax > d) many people (specially scientists) are already familiar with > python (while > they would need to learn the specifics of our DSL) > e) In the (inevitable) case in which a power user eventually wants to > complicate her logic a bit more, python would already support it, > while in > the case of a DSL we would be having this discussion once again. > > > > > On Wednesday, May 16, 2018 9:11:41 AM CEST Daniel Schick wrote: > > Dear Zibi, > > > > thanks for the detailed answer. > > Good to know that the sequencer is also able of handling plain > text files, > > which will be fine for many situation. > > > > From my experience at beamlines, users and myself often want to > run a set > > of scans for a given set of parameters. > > Most often these parameters are not equally spaced so nested > ascan in the > > sequencer won't work for them. > > > > In SPEC I am used to define an array for each parameter and then > use a for > > loop to iterate of this array. > > From your answer, I conclude that I need to write a simple scan > macro to > > realize that, right? > > > > Personally, I would prefer something like SPEC's qdo capabilities. > > So first of all being able to run a sequence of macros in plain > text file > > also from within spock. > > If this qdo macro would also understand python loops and list or > numpy > > arrays it would be perfect. > > > > I have simply the feeling that for non-programmers writing > sardana macros > > might be a bit heavy and especially error-prone. > > These guys will appriciate the sequencer, but this will not work > with > > looping of arrays of parameters as I said. > > > > If you think, something like a qdo macro is possible from spock > I could try > > implementing it if you could provide me with some initial help. > > > > BTW: my MacroServer does not have a MacroPath property. Only > MacroList and > > MacroLibList. Do I have to add this property myself? > > > > Best > > > > Daniel > > > > > > Zbigniew Reszela <zre...@ce... <mailto:zre...@ce...>> > schrieb am Di., 15. Mai 2018 um > > > > 17:11 Uhr: > > > Hi Daniel, > > > > > > > > > Based on our conversation in > > > https://github.com/sardana-org/sardana/issues/744 I think you > are already > > > familiar with most of the sequencer features. > > > > > > > > > There is maybe one more which is not documented and is related > to your > > > question from this email. > > > > > > As you know, in the sequencer you can load the previously > exported files > > > to the XML format, but also plain text files with spock syntax > composed > > > directly by the user e.g. > > > > > > senv ActiveMntGrp my-exp-01 > > > > > > ascan mot01 0 1 1 0.1 > > > > > > dscan mot02 -1 1 1 0.1 > > > > > > However, the plain text files are limited, for example, they > don't support > > > hooks. > > > > > > > > > Now a little bit of the history behind the sequencer. At the > beginning of > > > its development we assumed that it won't provide programming > features like > > > parameterizable macro execution in loops, exception handing, > etc. For > > > these > > > needs we suggest to develop simple macros. > > > > > > Nevertheless, sequencer is frequently used at some of Alba's > beamlines, > > > for simple sequences, even using the recently introduced to > the standard > > > macro catalogue the repeat macro. > > > > > > We are very open for your feedback so please propose changes > or point > > > missing features for the sequencer or any other part of > Sardana. For this > > > needs, please use the Github issues so in the future it will > be easier to > > > search for the information. > > > > > > > > > BTW the example from this email should be easily fulfilled by the > > > sequencer and the repeat macro, isn't it? > > > > > > > > > Now, regarding developing simple macros. For sure you already > found this > > > chapter in the documentation: > > > > > > > http://www.sardana-controls.org/en/latest/devel/howto_macros/index.html > > > > > > One could use the edmac magic command in spock and develop a > simple macro > > > to fulfill the same need: > > > > > > Door_zreszela_1 [6]: %edmac? > > > Docstring: > > > edmac <macro name> [<module>] > > > Returns the contents of the macro file which contains the > macro code for > > > the given macro name. If the module is given and it does not > exist a new > > > one is created. If the given module is a simple module name > and it does > > > not exist, it will be created on the first directory mentioned > in the > > > MacroPath > > > File: ~/workspace/sardana/src/sardana/spock/magic.py > > > > > > Door_zreszela_1 [7]: %edmac my_loop > > > /home/zreszela/workspace/macros/my_macros.py > > > Opening /home/zreszela/workspace/macros/my_macros.py.my_loop... > > > Editing... > > > > > > [here I developed the following macro (a template was populated by > > > Sardana)] > > > > > > 1 from sardana.macroserver.macro import Macro, macro, > > > > > > Type > > > > > > 2 > > > > > > 3 > > > > > > @macro() > > > > > > 4 def > > > > > > my_loop(self): > > > 5 """Macro > > > > > > my_loop""" > > > > > > 6 self.output("Running > > > > > > my_loop...") > > > > > > 7 > > > > > > #my_night_scans.py > > > > > > 8 self.execMacro("ascan mot01 10 20 10 > > > > > > 1") > > > > > > 9 param = > > > > > > range(10) > > > > > > 10 > > > > > > 11 for i in > > > > > > param: > > > 12 self.execMacro("dscan mot02 0 100 10 1") > > > > > > [end of the macro] > > > > > > Do you want to apply the new code on the server? [y] > > > Storing... [DONE] > > > > > > Door_zreszela_1 [8]: %my_loop > > > Running my_loop... > > > Operation will be saved in /home/zreszela/tmp/test.dat (Spec) > > > Scan #381 started at Tue May 15 16:34:40 2018. It will take at > least > > > 0:00:22.627553 > > > > > > #Pt No mot01 ct01 dt > > > > > > 0 10 1 2.71108 > > > 1 11 1 4.7807 > > > 2 12 1 6.71653 > > > 3 13 1 8.6432 > > > 4 14 1 10.5776 > > > 5 15 1 12.5214 > > > 6 16 1 14.4605 > > > 7 17 1 16.3993 > > > 8 18 1 18.3318 > > > 9 19 1 20.2681 > > > 10 20 1 22.2003 > > > > > > Operation saved in /home/zreszela/tmp/test.dat (Spec) > > > Scan #381 ended at Tue May 15 16:35:04 2018, taking > 0:00:23.220636. Dead > > > time 52.6% (motion dead time 50.9%) > > > Operation will be saved in /home/zreszela/tmp/test.dat (Spec) > > > Scan #382 started at Tue May 15 16:35:04 2018. It will take at > least > > > 0:00:22 > > > > > > #Pt No mot02 ct01 dt > > > > > > 0 0 1 0.033344 > > > 1 10 1 2.18017 > > > > > > [here is the rest of the output on my_loop macro] > > > > > > > > > Note that the "/home/zreszela/workspace/macros/" path is > configured in the > > > MacroPath property of the MacroServer Tango device. > > > > > > There is a graphical alternative to the edmac magic command > which is > > > called sardanaeditor. It should provide you the same > functionality but > > > with > > > a spyder like editor. > > > > > > > > > Hope that this somehow helps you! > > > > > > Cheers, > > > > > > Zibi > > > > > > > > > On 05/14/2018 03:05 PM, Daniel Schick wrote: > > > > > > Hej all, > > > > > > while playing with the sequencer and doing first steps with > writing > > > macros, I was wondering what are possible ways of realizing > long nested > > > scan sequences in Sardana. > > > > > > So far I know the sequencer GUI and also loading the > appropriate .xml > > > files for the sequencer. > > > > > > As I understood it, sardana macros are not intended for > realizing scan > > > sequnces. > > > > > > I also tried something in spock such as: > > > for i in range(10): ascan mot1 0 10 10 1 > > > > > > but without success. Is there a way to use build-in python > functions/loops > > > in combination with sardana macros to realize scan sequences? > > > > > > maybe also calling python scripts > <https://maps.google.com/?q=ing+python+scripts+&entry=gmail&source=g>like: > > > >> %run ./my_night_scans.py > > > > > > #my_night_scans.py > > > ascan mot1 10 20 10 1 > > > param = range(10) > > > > > > for i in param: > > > dscan mot2 0 100 10 1 > > > > > > I know that this would be quite close to SPEC's implementation > of its > > > macro engine. But for some users the sequencer GUI and it's > XML file > > > format might be a bit unfamiliar... > > > > > > > > > Best Daniel > > > > > > > > > > > > > > > > -------------------------------------------------------------------------- > > > ---- Check out the vibrant tech community on one of the > world's most > > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > > > > > > > > > > _______________________________________________ > > > Sardana-users mailing > > > > lis...@li...https://lists.sourceforge.net/list > <http://lists.sourceforge.net/list> > > > s/listinfo/sardana-users > > > > > > > > > -- > > > > > > [image: ALBA Synchrotron] <http://www.albasynchrotron.es> > > > Zbigniew Reszela > > > Computing & Controls Division > > > > > > ALBA SYNCHROTRON LIGHT SOURCE > > > Carrer de la Llum 2-26 | 08290 | Cerdanyola del Vallès| > Barcelona | Spain > > > <http://www.cells.es/en/about/coming-to-alba> > > > (+34) 93 592 4407 <tel:+34%20935%2092%2044%2007> > <+34%20935%2092%2044%2007> > > > www.albasynchrotron.es <http://www.albasynchrotron.es> | > zre...@ce... <mailto:zre...@ce...> | legal notice > > > <https://www.cells.es/en/about/legal-notice> > > > > > > > > > * Please, do not print this e-mail unless it is absolutely > necessary. * > > > Si heu rebut aquest correu per error, us informo que pot contenir > > > informació confidencial i privada i que està prohibit el seu > ús. Us > > > agrairíem que ho comuniqueu al remitent i l'elimineu. Gràcies. > > > Si ha recibido este correo por error, le informo de que puede > contener > > > información confidencial y privada y que está prohibido su uso. Le > > > agradeceré que lo comunique a su remitente y lo elimine. Gracias. > > > If you have received this e-mail in error, please note that it > may contain > > > confidential and private information, therefore, the use of this > > > information is strictly forbidden. Please inform the sender of > the error > > > and delete the information received. Thank you. > > > -- > +----------------------------------------------------+ > Carlos Pascual Izarra > Scientific Software Coordinator > Computing Division > ALBA Synchrotron [http://www.albasynchrotron.es] > Carrer de la Llum 2-26 > E-08290 Cerdanyola del Valles (Barcelona), Spain > E-mail: cpa...@ce... <mailto:cpa...@ce...> > Phone: +34 93 592 4428 <tel:+34%20935%2092%2044%2028> > +----------------------------------------------------+ > > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > _______________________________________________ > Sardana-users mailing list > Sar...@li... > https://lists.sourceforge.net/lists/listinfo/sardana-users |
From: Daniel S. <sch...@gm...> - 2018-05-17 15:15:17
|
okay, I just tried writing simple python macros for doing complex scan macros today, and I guess it is fine. As @cpascual says, it might not be worth the effort to develop DSL. However, I was just naively hoping that one can use sardana macros just as normal python functions in spock/ipython. because this works: for i in range(5): print(i) I hoped that for i in range(5): ascan mot 0 10 10 1 should also work from within spock. another thing would be concatenation, like: umv mot 1; ct 1; ascan mot 0 10 10 1 which also does not work. What is actually the limitation here? Why are these examples not working? Best Daniel Carlos Pascual <cpa...@ce...> schrieb am Do., 17. Mai 2018 um 10:46 Uhr: > Just my personal opinion: > > I think it is better **not** to introduce more advanced programming > capabilities (e.g. loops, conditionals, etc) in the sequencer. > > The reason is that we would be developing (and maintaining!) a > domain-specific > language (DSL) which in fact would be very close to a subset of python. > > The advantage of a python macro over a sequencer DSL approach for doing > anything more complex than a dumb sequence of spock-like commands is that: > a) we do not need to implement/debug/maintain the DSL > b) python syntax can be as simple as any DSL as long as you stick to > structured programming paradigm (which is possible with Sardana macros) > c) there are already lots of docs to learn the most basic python syntax > d) many people (specially scientists) are already familiar with python > (while > they would need to learn the specifics of our DSL) > e) In the (inevitable) case in which a power user eventually wants to > complicate her logic a bit more, python would already support it, while > in > the case of a DSL we would be having this discussion once again. > > > > > On Wednesday, May 16, 2018 9:11:41 AM CEST Daniel Schick wrote: > > Dear Zibi, > > > > thanks for the detailed answer. > > Good to know that the sequencer is also able of handling plain text > files, > > which will be fine for many situation. > > > > From my experience at beamlines, users and myself often want to run a set > > of scans for a given set of parameters. > > Most often these parameters are not equally spaced so nested ascan in the > > sequencer won't work for them. > > > > In SPEC I am used to define an array for each parameter and then use a > for > > loop to iterate of this array. > > From your answer, I conclude that I need to write a simple scan macro to > > realize that, right? > > > > Personally, I would prefer something like SPEC's qdo capabilities. > > So first of all being able to run a sequence of macros in plain text file > > also from within spock. > > If this qdo macro would also understand python loops and list or numpy > > arrays it would be perfect. > > > > I have simply the feeling that for non-programmers writing sardana macros > > might be a bit heavy and especially error-prone. > > These guys will appriciate the sequencer, but this will not work with > > looping of arrays of parameters as I said. > > > > If you think, something like a qdo macro is possible from spock I could > try > > implementing it if you could provide me with some initial help. > > > > BTW: my MacroServer does not have a MacroPath property. Only MacroList > and > > MacroLibList. Do I have to add this property myself? > > > > Best > > > > Daniel > > > > > > Zbigniew Reszela <zre...@ce...> schrieb am Di., 15. Mai 2018 um > > > > 17:11 Uhr: > > > Hi Daniel, > > > > > > > > > Based on our conversation in > > > https://github.com/sardana-org/sardana/issues/744 I think you are > already > > > familiar with most of the sequencer features. > > > > > > > > > There is maybe one more which is not documented and is related to your > > > question from this email. > > > > > > As you know, in the sequencer you can load the previously exported > files > > > to the XML format, but also plain text files with spock syntax composed > > > directly by the user e.g. > > > > > > senv ActiveMntGrp my-exp-01 > > > > > > ascan mot01 0 1 1 0.1 > > > > > > dscan mot02 -1 1 1 0.1 > > > > > > However, the plain text files are limited, for example, they don't > support > > > hooks. > > > > > > > > > Now a little bit of the history behind the sequencer. At the beginning > of > > > its development we assumed that it won't provide programming features > like > > > parameterizable macro execution in loops, exception handing, etc. For > > > these > > > needs we suggest to develop simple macros. > > > > > > Nevertheless, sequencer is frequently used at some of Alba's beamlines, > > > for simple sequences, even using the recently introduced to the > standard > > > macro catalogue the repeat macro. > > > > > > We are very open for your feedback so please propose changes or point > > > missing features for the sequencer or any other part of Sardana. For > this > > > needs, please use the Github issues so in the future it will be easier > to > > > search for the information. > > > > > > > > > BTW the example from this email should be easily fulfilled by the > > > sequencer and the repeat macro, isn't it? > > > > > > > > > Now, regarding developing simple macros. For sure you already found > this > > > chapter in the documentation: > > > > > > > http://www.sardana-controls.org/en/latest/devel/howto_macros/index.html > > > > > > One could use the edmac magic command in spock and develop a simple > macro > > > to fulfill the same need: > > > > > > Door_zreszela_1 [6]: %edmac? > > > Docstring: > > > edmac <macro name> [<module>] > > > Returns the contents of the macro file which contains the macro code > for > > > the given macro name. If the module is given and it does not exist a > new > > > one is created. If the given module is a simple module name and it does > > > not exist, it will be created on the first directory mentioned in the > > > MacroPath > > > File: ~/workspace/sardana/src/sardana/spock/magic.py > > > > > > Door_zreszela_1 [7]: %edmac my_loop > > > /home/zreszela/workspace/macros/my_macros.py > > > Opening /home/zreszela/workspace/macros/my_macros.py.my_loop... > > > Editing... > > > > > > [here I developed the following macro (a template was populated by > > > Sardana)] > > > > > > 1 from sardana.macroserver.macro import Macro, macro, > > > > > > Type > > > > > > 2 > > > > > > 3 > > > > > > @macro() > > > > > > 4 def > > > > > > my_loop(self): > > > 5 """Macro > > > > > > my_loop""" > > > > > > 6 self.output("Running > > > > > > my_loop...") > > > > > > 7 > > > > > > #my_night_scans.py > > > > > > 8 self.execMacro("ascan mot01 10 20 10 > > > > > > 1") > > > > > > 9 param = > > > > > > range(10) > > > > > > 10 > > > > > > 11 for i in > > > > > > param: > > > 12 self.execMacro("dscan mot02 0 100 10 1") > > > > > > [end of the macro] > > > > > > Do you want to apply the new code on the server? [y] > > > Storing... [DONE] > > > > > > Door_zreszela_1 [8]: %my_loop > > > Running my_loop... > > > Operation will be saved in /home/zreszela/tmp/test.dat (Spec) > > > Scan #381 started at Tue May 15 16:34:40 2018. It will take at least > > > 0:00:22.627553 > > > > > > #Pt No mot01 ct01 dt > > > > > > 0 10 1 2.71108 > > > 1 11 1 4.7807 > > > 2 12 1 6.71653 > > > 3 13 1 8.6432 > > > 4 14 1 10.5776 > > > 5 15 1 12.5214 > > > 6 16 1 14.4605 > > > 7 17 1 16.3993 > > > 8 18 1 18.3318 > > > 9 19 1 20.2681 > > > 10 20 1 22.2003 > > > > > > Operation saved in /home/zreszela/tmp/test.dat (Spec) > > > Scan #381 ended at Tue May 15 16:35:04 2018, taking 0:00:23.220636. > Dead > > > time 52.6% (motion dead time 50.9%) > > > Operation will be saved in /home/zreszela/tmp/test.dat (Spec) > > > Scan #382 started at Tue May 15 16:35:04 2018. It will take at least > > > 0:00:22 > > > > > > #Pt No mot02 ct01 dt > > > > > > 0 0 1 0.033344 > > > 1 10 1 2.18017 > > > > > > [here is the rest of the output on my_loop macro] > > > > > > > > > Note that the "/home/zreszela/workspace/macros/" path is configured in > the > > > MacroPath property of the MacroServer Tango device. > > > > > > There is a graphical alternative to the edmac magic command which is > > > called sardanaeditor. It should provide you the same functionality but > > > with > > > a spyder like editor. > > > > > > > > > Hope that this somehow helps you! > > > > > > Cheers, > > > > > > Zibi > > > > > > > > > On 05/14/2018 03:05 PM, Daniel Schick wrote: > > > > > > Hej all, > > > > > > while playing with the sequencer and doing first steps with writing > > > macros, I was wondering what are possible ways of realizing long nested > > > scan sequences in Sardana. > > > > > > So far I know the sequencer GUI and also loading the appropriate .xml > > > files for the sequencer. > > > > > > As I understood it, sardana macros are not intended for realizing scan > > > sequnces. > > > > > > I also tried something in spock such as: > > > for i in range(10): ascan mot1 0 10 10 1 > > > > > > but without success. Is there a way to use build-in python > functions/loops > > > in combination with sardana macros to realize scan sequences? > > > > > > maybe also calling python scripts > <https://maps.google.com/?q=ing+python+scripts+&entry=gmail&source=g>like: > > > >> %run ./my_night_scans.py > > > > > > #my_night_scans.py > > > ascan mot1 10 20 10 1 > > > param = range(10) > > > > > > for i in param: > > > dscan mot2 0 100 10 1 > > > > > > I know that this would be quite close to SPEC's implementation of its > > > macro engine. But for some users the sequencer GUI and it's XML file > > > format might be a bit unfamiliar... > > > > > > > > > Best Daniel > > > > > > > > > > > > > > > > -------------------------------------------------------------------------- > > > ---- Check out the vibrant tech community on one of the world's most > > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > > > > > > > > > > _______________________________________________ > > > Sardana-users mailing > > > lis...@li...https:// > lists.sourceforge.net/list > > > s/listinfo/sardana-users > > > > > > > > > -- > > > > > > [image: ALBA Synchrotron] <http://www.albasynchrotron.es> > > > Zbigniew Reszela > > > Computing & Controls Division > > > > > > ALBA SYNCHROTRON LIGHT SOURCE > > > Carrer de la Llum 2-26 | 08290 | Cerdanyola del Vallès| Barcelona | > Spain > > > <http://www.cells.es/en/about/coming-to-alba> > > > (+34) 93 592 4407 <+34%20935%2092%2044%2007> > <+34%20935%2092%2044%2007> > > > www.albasynchrotron.es | zre...@ce... | legal notice > > > <https://www.cells.es/en/about/legal-notice> > > > > > > > > > * Please, do not print this e-mail unless it is absolutely necessary. * > > > Si heu rebut aquest correu per error, us informo que pot contenir > > > informació confidencial i privada i que està prohibit el seu ús. Us > > > agrairíem que ho comuniqueu al remitent i l'elimineu. Gràcies. > > > Si ha recibido este correo por error, le informo de que puede contener > > > información confidencial y privada y que está prohibido su uso. Le > > > agradeceré que lo comunique a su remitente y lo elimine. Gracias. > > > If you have received this e-mail in error, please note that it may > contain > > > confidential and private information, therefore, the use of this > > > information is strictly forbidden. Please inform the sender of the > error > > > and delete the information received. Thank you. > > > -- > +----------------------------------------------------+ > Carlos Pascual Izarra > Scientific Software Coordinator > Computing Division > ALBA Synchrotron [http://www.albasynchrotron.es] > Carrer de la Llum 2-26 > E-08290 Cerdanyola del Valles (Barcelona), Spain > E-mail: cpa...@ce... > Phone: +34 93 592 4428 <+34%20935%2092%2044%2028> > +----------------------------------------------------+ > > |
From: Daniel S. <sch...@gm...> - 2018-05-17 12:36:56
|
Hej, @reszela: the mesh scan is actually doing the scan in the right way with also having all data in one scan. The problem is only when plotting the data, I have still just one counter, call it "det", which holds all the data for pos. and neg. magnetic field. Also in PyMCA it is then hard to see the actual result. So I would like to have one counter for positive magnetic field and one for negative magnetic field (when I do scans with alternating field). The mesh scan also does not allow for regionscan etc... The hack we did in SPEC was to duplicate this counter det resulting in det and detM, where det is also an alias for detP (N = negative field, P = positive field) Then we used the hooks in SPEC similar as @teresanunez supposes which is then quite generic and works for any kind of scan. So my question is, how I can trigger a second acquisition in hook and access and overwrite counter values? Best Daniel Zbigniew Reszela <zre...@ce...> schrieb am Do., 17. Mai 2018 um 13:25 Uhr: > Hi Daniel! > > I don't know if I understood correctly your requirements, but maybe a mesh > scan could do the job? > > Something like "mesh magnet -1 1 1 sampleX -1 1 10 1". > > This should produce you 22 scan points in the same scan entry. > > Cheers, > > Zibi > > On 05/16/2018 03:48 PM, Daniel Schick wrote: > > Hej all, > > I want to realize scans to do XMCD and MOKE measurements with Sardana. > That means, that for every scan point of a motor (lets say the X-ray > photon energy, or sample position, etc) I need to record data for magnetic > field pointing up and down. > The powerSupply driving my electromagnet is implemented as a sardana motor. > I also need to switch the field at every scan point of the motor to get > better statistics. > > Right now, I could use nested ascans to realize that: > > ascan sampleX -1 1 10 1 > ascan magnet -1 1 1 1 > > however, this would result in a nasty and overcrowded scan file. > > In SPEC we did a little hack of the user_post_count macro, in which we > switched the magnetic field, remembered the acquired counter values and > triggered another acquisition. This second acquisition overwrites all old > counter values but we used the remembered values from the other magnet > direction to write them in some generic macro counters which is in SPEC > easily possible via the counter array S['counter'] = 1. > > What would be the best way to realize that in Sardana and is there maybe > already a solution out there? > > Best > > Daniel > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > > _______________________________________________ > Sardana-users mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/sardana-users > > > -- > > [image: ALBA Synchrotron] <http://www.albasynchrotron.es> > Zbigniew Reszela > Computing & Controls Division > > ALBA SYNCHROTRON LIGHT SOURCE > Carrer de la Llum 2-26 | 08290 | Cerdanyola del Vallès| Barcelona | Spain > <http://www.cells.es/en/about/coming-to-alba> > (+34) 93 592 4407 <+34%20935%2092%2044%2007> > www.albasynchrotron.es | zre...@ce... | legal notice > <https://www.cells.es/en/about/legal-notice> > > > * Please, do not print this e-mail unless it is absolutely necessary. * > Si heu rebut aquest correu per error, us informo que pot contenir > informació confidencial i privada i que està prohibit el seu ús. Us > agrairíem que ho comuniqueu al remitent i l'elimineu. Gràcies. > Si ha recibido este correo por error, le informo de que puede contener > información confidencial y privada y que está prohibido su uso. Le > agradeceré que lo comunique a su remitente y lo elimine. Gracias. > If you have received this e-mail in error, please note that it may contain > confidential and private information, therefore, the use of this > information is strictly forbidden. Please inform the sender of the error > and delete the information received. Thank you. > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Sardana-users mailing list > Sar...@li... > https://lists.sourceforge.net/lists/listinfo/sardana-users > |
From: Zbigniew R. <zre...@ce...> - 2018-05-17 11:24:57
|
Hi Daniel! I don't know if I understood correctly your requirements, but maybe a mesh scan could do the job? Something like "mesh magnet -1 1 1 sampleX -1 1 10 1". This should produce you 22 scan points in the same scan entry. Cheers, Zibi On 05/16/2018 03:48 PM, Daniel Schick wrote: > Hej all, > > I want to realize scans to do XMCD and MOKE measurements with Sardana. > That means, that for every scan point of a motor (lets say the X-ray > photon energy, or sample position, etc) I need to record data for > magnetic field pointing up and down. > The powerSupply driving my electromagnet is implemented as a sardana > motor. > I also need to switch the field at every scan point of the motor to > get better statistics. > > Right now, I could use nested ascans to realize that: > > ascan sampleX -1 1 10 1 > ascan magnet -1 1 1 1 > > however, this would result in a nasty and overcrowded scan file. > > In SPEC we did a little hack of the user_post_count macro, in which we > switched the magnetic field, remembered the acquired counter values > and triggered another acquisition. This second acquisition overwrites > all old counter values but we used the remembered values from the > other magnet direction to write them in some generic macro counters > which is in SPEC easily possible via the counter array S['counter'] = 1. > > What would be the best way to realize that in Sardana and is there > maybe already a solution out there? > > Best > > Daniel > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > _______________________________________________ > Sardana-users mailing list > Sar...@li... > https://lists.sourceforge.net/lists/listinfo/sardana-users -- ALBA Synchrotron <http://www.albasynchrotron.es> Zbigniew Reszela Computing & Controls Division ALBA SYNCHROTRON LIGHT SOURCE Carrer de la Llum 2-26 | 08290 | Cerdanyola del Vallès| Barcelona | Spain <http://www.cells.es/en/about/coming-to-alba> (+34) 93 592 4407 www.albasynchrotron.es <http://www.albasynchrotron.es>| zre...@ce... <mailto:zre...@ce...> | legal notice <https://www.cells.es/en/about/legal-notice> **Please, do not print this e-mail unless it is absolutely necessary. **Si heu rebut aquest correu per error, us informo que pot contenir informació confidencial i privada i que està prohibit el seu ús. Us agrairíem que ho comuniqueu al remitent i l'elimineu. Gràcies. Si ha recibido este correo por error, le informo de que puede contener información confidencial y privada y que está prohibido su uso. Le agradeceré que lo comunique a su remitente y lo elimine. Gracias. If you have received this e-mail in error, please note that it may contain confidential and private information, therefore, the use of this information is strictly forbidden. Please inform the sender of the error and delete the information received. Thank you. |
From: Carlos P. <cpa...@ce...> - 2018-05-17 08:46:28
|
Just my personal opinion: I think it is better **not** to introduce more advanced programming capabilities (e.g. loops, conditionals, etc) in the sequencer. The reason is that we would be developing (and maintaining!) a domain-specific language (DSL) which in fact would be very close to a subset of python. The advantage of a python macro over a sequencer DSL approach for doing anything more complex than a dumb sequence of spock-like commands is that: a) we do not need to implement/debug/maintain the DSL b) python syntax can be as simple as any DSL as long as you stick to structured programming paradigm (which is possible with Sardana macros) c) there are already lots of docs to learn the most basic python syntax d) many people (specially scientists) are already familiar with python (while they would need to learn the specifics of our DSL) e) In the (inevitable) case in which a power user eventually wants to complicate her logic a bit more, python would already support it, while in the case of a DSL we would be having this discussion once again. On Wednesday, May 16, 2018 9:11:41 AM CEST Daniel Schick wrote: > Dear Zibi, > > thanks for the detailed answer. > Good to know that the sequencer is also able of handling plain text files, > which will be fine for many situation. > > From my experience at beamlines, users and myself often want to run a set > of scans for a given set of parameters. > Most often these parameters are not equally spaced so nested ascan in the > sequencer won't work for them. > > In SPEC I am used to define an array for each parameter and then use a for > loop to iterate of this array. > From your answer, I conclude that I need to write a simple scan macro to > realize that, right? > > Personally, I would prefer something like SPEC's qdo capabilities. > So first of all being able to run a sequence of macros in plain text file > also from within spock. > If this qdo macro would also understand python loops and list or numpy > arrays it would be perfect. > > I have simply the feeling that for non-programmers writing sardana macros > might be a bit heavy and especially error-prone. > These guys will appriciate the sequencer, but this will not work with > looping of arrays of parameters as I said. > > If you think, something like a qdo macro is possible from spock I could try > implementing it if you could provide me with some initial help. > > BTW: my MacroServer does not have a MacroPath property. Only MacroList and > MacroLibList. Do I have to add this property myself? > > Best > > Daniel > > > Zbigniew Reszela <zre...@ce...> schrieb am Di., 15. Mai 2018 um > > 17:11 Uhr: > > Hi Daniel, > > > > > > Based on our conversation in > > https://github.com/sardana-org/sardana/issues/744 I think you are already > > familiar with most of the sequencer features. > > > > > > There is maybe one more which is not documented and is related to your > > question from this email. > > > > As you know, in the sequencer you can load the previously exported files > > to the XML format, but also plain text files with spock syntax composed > > directly by the user e.g. > > > > senv ActiveMntGrp my-exp-01 > > > > ascan mot01 0 1 1 0.1 > > > > dscan mot02 -1 1 1 0.1 > > > > However, the plain text files are limited, for example, they don't support > > hooks. > > > > > > Now a little bit of the history behind the sequencer. At the beginning of > > its development we assumed that it won't provide programming features like > > parameterizable macro execution in loops, exception handing, etc. For > > these > > needs we suggest to develop simple macros. > > > > Nevertheless, sequencer is frequently used at some of Alba's beamlines, > > for simple sequences, even using the recently introduced to the standard > > macro catalogue the repeat macro. > > > > We are very open for your feedback so please propose changes or point > > missing features for the sequencer or any other part of Sardana. For this > > needs, please use the Github issues so in the future it will be easier to > > search for the information. > > > > > > BTW the example from this email should be easily fulfilled by the > > sequencer and the repeat macro, isn't it? > > > > > > Now, regarding developing simple macros. For sure you already found this > > chapter in the documentation: > > > > http://www.sardana-controls.org/en/latest/devel/howto_macros/index.html > > > > One could use the edmac magic command in spock and develop a simple macro > > to fulfill the same need: > > > > Door_zreszela_1 [6]: %edmac? > > Docstring: > > edmac <macro name> [<module>] > > Returns the contents of the macro file which contains the macro code for > > the given macro name. If the module is given and it does not exist a new > > one is created. If the given module is a simple module name and it does > > not exist, it will be created on the first directory mentioned in the > > MacroPath > > File: ~/workspace/sardana/src/sardana/spock/magic.py > > > > Door_zreszela_1 [7]: %edmac my_loop > > /home/zreszela/workspace/macros/my_macros.py > > Opening /home/zreszela/workspace/macros/my_macros.py.my_loop... > > Editing... > > > > [here I developed the following macro (a template was populated by > > Sardana)] > > > > 1 from sardana.macroserver.macro import Macro, macro, > > > > Type > > > > 2 > > > > 3 > > > > @macro() > > > > 4 def > > > > my_loop(self): > > 5 """Macro > > > > my_loop""" > > > > 6 self.output("Running > > > > my_loop...") > > > > 7 > > > > #my_night_scans.py > > > > 8 self.execMacro("ascan mot01 10 20 10 > > > > 1") > > > > 9 param = > > > > range(10) > > > > 10 > > > > 11 for i in > > > > param: > > 12 self.execMacro("dscan mot02 0 100 10 1") > > > > [end of the macro] > > > > Do you want to apply the new code on the server? [y] > > Storing... [DONE] > > > > Door_zreszela_1 [8]: %my_loop > > Running my_loop... > > Operation will be saved in /home/zreszela/tmp/test.dat (Spec) > > Scan #381 started at Tue May 15 16:34:40 2018. It will take at least > > 0:00:22.627553 > > > > #Pt No mot01 ct01 dt > > > > 0 10 1 2.71108 > > 1 11 1 4.7807 > > 2 12 1 6.71653 > > 3 13 1 8.6432 > > 4 14 1 10.5776 > > 5 15 1 12.5214 > > 6 16 1 14.4605 > > 7 17 1 16.3993 > > 8 18 1 18.3318 > > 9 19 1 20.2681 > > 10 20 1 22.2003 > > > > Operation saved in /home/zreszela/tmp/test.dat (Spec) > > Scan #381 ended at Tue May 15 16:35:04 2018, taking 0:00:23.220636. Dead > > time 52.6% (motion dead time 50.9%) > > Operation will be saved in /home/zreszela/tmp/test.dat (Spec) > > Scan #382 started at Tue May 15 16:35:04 2018. It will take at least > > 0:00:22 > > > > #Pt No mot02 ct01 dt > > > > 0 0 1 0.033344 > > 1 10 1 2.18017 > > > > [here is the rest of the output on my_loop macro] > > > > > > Note that the "/home/zreszela/workspace/macros/" path is configured in the > > MacroPath property of the MacroServer Tango device. > > > > There is a graphical alternative to the edmac magic command which is > > called sardanaeditor. It should provide you the same functionality but > > with > > a spyder like editor. > > > > > > Hope that this somehow helps you! > > > > Cheers, > > > > Zibi > > > > > > On 05/14/2018 03:05 PM, Daniel Schick wrote: > > > > Hej all, > > > > while playing with the sequencer and doing first steps with writing > > macros, I was wondering what are possible ways of realizing long nested > > scan sequences in Sardana. > > > > So far I know the sequencer GUI and also loading the appropriate .xml > > files for the sequencer. > > > > As I understood it, sardana macros are not intended for realizing scan > > sequnces. > > > > I also tried something in spock such as: > > for i in range(10): ascan mot1 0 10 10 1 > > > > but without success. Is there a way to use build-in python functions/loops > > in combination with sardana macros to realize scan sequences? > > > > maybe also calling python scripts like: > > >> %run ./my_night_scans.py > > > > #my_night_scans.py > > ascan mot1 10 20 10 1 > > param = range(10) > > > > for i in param: > > dscan mot2 0 100 10 1 > > > > I know that this would be quite close to SPEC's implementation of its > > macro engine. But for some users the sequencer GUI and it's XML file > > format might be a bit unfamiliar... > > > > > > Best Daniel > > > > > > > > > > -------------------------------------------------------------------------- > > ---- Check out the vibrant tech community on one of the world's most > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > > > > > > _______________________________________________ > > Sardana-users mailing > > lis...@li...https://lists.sourceforge.net/list > > s/listinfo/sardana-users > > > > > > -- > > > > [image: ALBA Synchrotron] <http://www.albasynchrotron.es> > > Zbigniew Reszela > > Computing & Controls Division > > > > ALBA SYNCHROTRON LIGHT SOURCE > > Carrer de la Llum 2-26 | 08290 | Cerdanyola del Vallès| Barcelona | Spain > > <http://www.cells.es/en/about/coming-to-alba> > > (+34) 93 592 4407 <+34%20935%2092%2044%2007> > > www.albasynchrotron.es | zre...@ce... | legal notice > > <https://www.cells.es/en/about/legal-notice> > > > > > > * Please, do not print this e-mail unless it is absolutely necessary. * > > Si heu rebut aquest correu per error, us informo que pot contenir > > informació confidencial i privada i que està prohibit el seu ús. Us > > agrairíem que ho comuniqueu al remitent i l'elimineu. Gràcies. > > Si ha recibido este correo por error, le informo de que puede contener > > información confidencial y privada y que está prohibido su uso. Le > > agradeceré que lo comunique a su remitente y lo elimine. Gracias. > > If you have received this e-mail in error, please note that it may contain > > confidential and private information, therefore, the use of this > > information is strictly forbidden. Please inform the sender of the error > > and delete the information received. Thank you. -- +----------------------------------------------------+ Carlos Pascual Izarra Scientific Software Coordinator Computing Division ALBA Synchrotron [http://www.albasynchrotron.es] Carrer de la Llum 2-26 E-08290 Cerdanyola del Valles (Barcelona), Spain E-mail: cpa...@ce... Phone: +34 93 592 4428 +----------------------------------------------------+ |
From: Teresa N. <mar...@de...> - 2018-05-17 08:00:54
|
Hi Daniel, have you tried using hooks?, you can modify the conditions as you want before/after every move/acquisition ... Regards, Teresa On 05/16/18 15:48, Daniel Schick wrote: > Hej all, > > I want to realize scans to do XMCD and MOKE measurements with Sardana. > That means, that for every scan point of a motor (lets say the X-ray > photon energy, or sample position, etc) I need to record data for > magnetic field pointing up and down. > The powerSupply driving my electromagnet is implemented as a sardana > motor. > I also need to switch the field at every scan point of the motor to > get better statistics. > > Right now, I could use nested ascans to realize that: > > ascan sampleX -1 1 10 1 > ascan magnet -1 1 1 1 > > however, this would result in a nasty and overcrowded scan file. > > In SPEC we did a little hack of the user_post_count macro, in which we > switched the magnetic field, remembered the acquired counter values > and triggered another acquisition. This second acquisition overwrites > all old counter values but we used the remembered values from the > other magnet direction to write them in some generic macro counters > which is in SPEC easily possible via the counter array S['counter'] = 1. > > What would be the best way to realize that in Sardana and is there > maybe already a solution out there? > > Best > > Daniel > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > _______________________________________________ > Sardana-users mailing list > Sar...@li... > https://lists.sourceforge.net/lists/listinfo/sardana-users |
From: Daniel S. <sch...@gm...> - 2018-05-16 20:35:59
|
Hej Zibi, the fscan macro seems rather interesting. But please see my comment for issue #223. I actually found a macro in the sf macro repo: https://sourceforge.net/p/sardana/macros.git/ci/master/tree/DESY_general/sequency_macros.py which seems to be able to run sequences from spock. I need to test it. I will test the copy&paste approach with the simple macros and see what my colleagues will say. Thanks for the MacroPath help. Best Daniel Am 16.05.2018 um 19:40 schrieb Zbigniew Reszela: > Hi Daniel, > > This time my answers in between your lines. > > On 05/16/2018 09:11 AM, Daniel Schick wrote: >> Dear Zibi, >> >> thanks for the detailed answer. >> Good to know that the sequencer is also able of handling plain text >> files, which will be fine for many situation. > I hope that soon we will find some time to document this feature as well. >> >> From my experience at beamlines, users and myself often want to run a >> set of scans for a given set of parameters. >> Most often these parameters are not equally spaced so nested ascan in >> the sequencer won't work for them. >> >> In SPEC I am used to define an array for each parameter and then use a >> for loop to iterate of this array. >> From your answer, I conclude that I need to write a simple scan macro >> to realize that, right? > Maybe fscan macro could be useful here? It should be possible to achieve > a similar behavior using it. I also remember some users asking for a > scan macro accepting a list of positions - we could think of adding such > macro. Regarding fscan, I remember that we swapped order of its > parameters due to the limitation in the repeat parameters spock syntax. > It is no more the case so we could bring them back to the more > convenient order. See sardana issue #223 for more details. >> >> Personally, I would prefer something like SPEC's qdo capabilities. >> So first of all being able to run a sequence of macros in plain text >> file also from within spock. > Let me check if it would be relatively easy to reuse the code of the > sequencer to do this. >> If this qdo macro would also understand python loops and list or numpy >> arrays it would be perfect. > For this I would recommend developing simple python macros. IMHO the > effort of developing this feature and its maintenance is not worth the > benefit. But I stress here that it is my personal opinion. I encourage > others to comment. >> >> I have simply the feeling that for non-programmers writing sardana >> macros might be a bit heavy and especially error-prone. > I see a lot of users making copy&paste programming with the "execMacro" > calls with spock syntax strings. They use simple python loops for > parameterizing the loops, etc. I think that they are quite happy with > this, at least at Alba. >> These guys will appriciate the sequencer, but this will not work with >> looping of arrays of parameters as I said. >> >> If you think, something like a qdo macro is possible from spock I >> could try implementing it if you could provide me with some initial help. > Here I think it is better to reuse the sequencer code. Let me first > evaluate it. And thanks a lot for the offer of help. We need it:) >> >> BTW: my MacroServer does not have a MacroPath property. Only MacroList >> and MacroLibList. Do I have to add this property myself? > I think you mean Tango attributes (MacroList and MacroLibList are Tango > attributes). The MacroPath Tango property can be set from spock using > this syntax (afterwards you will need to restart the MacroServer): > > _MACRO_SERVER.put_property({"MacroPath":["/sardana/src/sardana/macroserver/macros/examples"]}) > > You can add more than one in the list. These paths will be then searched > for macros on the server startup. There are utility macros for reloading > e.g. relmac, relmaclib at runtime... >> >> Best >> >> Daniel > Many thanks for your feedback! > Zibi >> >> >> Zbigniew Reszela <zre...@ce... <mailto:zre...@ce...>> >> schrieb am Di., 15. Mai 2018 um 17:11 Uhr: >> >> Hi Daniel, >> >> >> Based on our conversation in >> https://github.com/sardana-org/sardana/issues/744 I think you are >> already familiar with most of the sequencer features. >> >> >> There is maybe one more which is not documented and is related to >> your question from this email. >> >> As you know, in the sequencer you can load the previously exported >> files to the XML format, but also plain text files with spock >> syntax composed directly by the user e.g. >> >> senv ActiveMntGrp my-exp-01 >> >> ascan mot01 0 1 1 0.1 >> >> dscan mot02 -1 1 1 0.1 >> >> However, the plain text files are limited, for example, they don't >> support hooks. >> >> >> Now a little bit of the history behind the sequencer. At the >> beginning of its development we assumed that it won't provide >> programming features like parameterizable macro execution in >> loops, exception handing, etc. For these needs we suggest to >> develop simple macros. >> >> Nevertheless, sequencer is frequently used at some of Alba's >> beamlines, for simple sequences, even using the recently >> introduced to the standard macro catalogue the repeat macro. >> >> We are very open for your feedback so please propose changes or >> point missing features for the sequencer or any other part of >> Sardana. For this needs, please use the Github issues so in the >> future it will be easier to search for the information. >> >> >> BTW the example from this email should be easily fulfilled by the >> sequencer and the repeat macro, isn't it? >> >> >> Now, regarding developing simple macros. For sure you already >> found this chapter in the documentation: >> >> http://www.sardana-controls.org/en/latest/devel/howto_macros/index.html >> >> One could use the edmac magic command in spock and develop a >> simple macro to fulfill the same need: >> >> Door_zreszela_1 [6]: %edmac? >> Docstring: >> edmac <macro name> [<module>] >> Returns the contents of the macro file which contains the macro >> code for >> the given macro name. If the module is given and it does not exist >> a new >> one is created. If the given module is a simple module name and it >> does >> not exist, it will be created on the first directory mentioned in the >> MacroPath >> File: ~/workspace/sardana/src/sardana/spock/magic.py >> >> Door_zreszela_1 [7]: %edmac my_loop >> /home/zreszela/workspace/macros/my_macros.py >> Opening /home/zreszela/workspace/macros/my_macros.py.my_loop... >> Editing... >> >> [here I developed the following macro (a template was populated by >> Sardana)] >> >> 1 from sardana.macroserver.macro import Macro, macro, Type >> 2 >> 3 @macro() >> 4 def my_loop(self): >> 5 """Macro my_loop""" >> 6 self.output("Running my_loop...") >> 7 #my_night_scans.py >> 8 self.execMacro("ascan mot01 10 20 10 1") >> 9 param = range(10) >> 10 >> 11 for i in param: >> 12 self.execMacro("dscan mot02 0 100 10 1") >> >> [end of the macro] >> >> Do you want to apply the new code on the server? [y] >> Storing... [DONE] >> >> Door_zreszela_1 [8]: %my_loop >> Running my_loop... >> Operation will be saved in /home/zreszela/tmp/test.dat (Spec) >> Scan #381 started at Tue May 15 16:34:40 2018. It will take at >> least 0:00:22.627553 >> #Pt No mot01 ct01 dt >> 0 10 1 2.71108 >> 1 11 1 4.7807 >> 2 12 1 6.71653 >> 3 13 1 8.6432 >> 4 14 1 10.5776 >> 5 15 1 12.5214 >> 6 16 1 14.4605 >> 7 17 1 16.3993 >> 8 18 1 18.3318 >> 9 19 1 20.2681 >> 10 20 1 22.2003 >> Operation saved in /home/zreszela/tmp/test.dat (Spec) >> Scan #381 ended at Tue May 15 16:35:04 2018, taking >> 0:00:23.220636. Dead time 52.6% (motion dead time 50.9%) >> Operation will be saved in /home/zreszela/tmp/test.dat (Spec) >> Scan #382 started at Tue May 15 16:35:04 2018. It will take at >> least 0:00:22 >> #Pt No mot02 ct01 dt >> 0 0 1 0.033344 >> 1 10 1 2.18017 >> >> [here is the rest of the output on my_loop macro] >> >> >> Note that the "/home/zreszela/workspace/macros/" path is >> configured in the MacroPath property of the MacroServer Tango device. >> >> There is a graphical alternative to the edmac magic command which >> is called sardanaeditor. It should provide you the same >> functionality but with a spyder like editor. >> >> >> Hope that this somehow helps you! >> >> Cheers, >> >> Zibi >> >> >> On 05/14/2018 03:05 PM, Daniel Schick wrote: >>> Hej all, >>> >>> while playing with the sequencer and doing first steps with >>> writing macros, I was wondering what are possible ways of >>> realizing long nested scan sequences in Sardana. >>> >>> So far I know the sequencer GUI and also loading the appropriate >>> .xml files for the sequencer. >>> >>> As I understood it, sardana macros are not intended for realizing >>> scan sequnces. >>> >>> I also tried something in spock such as: >>> >>> for i in range(10): ascan mot1 0 10 10 1 >>> >>> but without success. Is there a way to use build-in python >>> functions/loops in combination with sardana macros to realize >>> scan sequences? >>> >>> maybe also calling python scripts like: >>> |>> %run ./my_night_scans.py | >>> |#my_night_scans.py ascan mot1 10 20 10 1 param = range(10) | >>> |for i in param:dscan mot2 0 100 10 1 | >>> I know that this would be quite close to SPEC's implementation of >>> its macro engine. But for some users the sequencer GUI and it's >>> XML file format might be a bit unfamiliar... >>> Best Daniel >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Check out the vibrant tech community on one of the world's most >>> engaging tech sites, Slashdot.org!http://sdm.link/slashdot >>> >>> >>> _______________________________________________ >>> Sardana-users mailing list >>> Sar...@li... >>> <mailto:Sar...@li...> >>> https://lists.sourceforge.net/lists/listinfo/sardana-users >> >> -- >> >> ALBA Synchrotron <http://www.albasynchrotron.es> >> >> Zbigniew Reszela >> Computing & Controls Division >> >> ALBA SYNCHROTRON LIGHT SOURCE >> Carrer de la Llum 2-26 | 08290 | Cerdanyola del Vallès| Barcelona >> | Spain <http://www.cells.es/en/about/coming-to-alba> >> (+34) 93 592 4407 <tel:+34%20935%2092%2044%2007> >> www.albasynchrotron.es <http://www.albasynchrotron.es>| >> zre...@ce... <mailto:zre...@ce...> | legal notice >> <https://www.cells.es/en/about/legal-notice> >> >> **Please, do not print this e-mail unless it is absolutely necessary. >> **Si heu rebut aquest correu per error, us informo que pot >> contenir informació confidencial i privada i que està prohibit el >> seu ús. Us agrairíem que ho comuniqueu al remitent i l'elimineu. >> Gràcies. >> Si ha recibido este correo por error, le informo de que puede >> contener información confidencial y privada y que está prohibido >> su uso. Le agradeceré que lo comunique a su remitente y lo >> elimine. Gracias. >> If you have received this e-mail in error, please note that it may >> contain confidential and private information, therefore, the use >> of this information is strictly forbidden. Please inform the >> sender of the error and delete the information received. Thank you. >> > > -- > > ALBA Synchrotron <http://www.albasynchrotron.es> > > Zbigniew Reszela > Computing & Controls Division > > ALBA SYNCHROTRON LIGHT SOURCE > Carrer de la Llum 2-26 | 08290 | Cerdanyola del Vallès| Barcelona | > Spain <http://www.cells.es/en/about/coming-to-alba> > (+34) 93 592 4407 > www.albasynchrotron.es <http://www.albasynchrotron.es>| > zre...@ce... <mailto:zre...@ce...> | legal notice > <https://www.cells.es/en/about/legal-notice> > > **Please, do not print this e-mail unless it is absolutely necessary. > **Si heu rebut aquest correu per error, us informo que pot contenir > informació confidencial i privada i que està prohibit el seu ús. Us > agrairíem que ho comuniqueu al remitent i l'elimineu. Gràcies. > Si ha recibido este correo por error, le informo de que puede contener > información confidencial y privada y que está prohibido su uso. Le > agradeceré que lo comunique a su remitente y lo elimine. Gracias. > If you have received this e-mail in error, please note that it may > contain confidential and private information, therefore, the use of this > information is strictly forbidden. Please inform the sender of the error > and delete the information received. Thank you. > |
From: Zbigniew R. <zre...@ce...> - 2018-05-16 17:40:55
|
Hi Daniel, This time my answers in between your lines. On 05/16/2018 09:11 AM, Daniel Schick wrote: > Dear Zibi, > > thanks for the detailed answer. > Good to know that the sequencer is also able of handling plain text > files, which will be fine for many situation. I hope that soon we will find some time to document this feature as well. > > From my experience at beamlines, users and myself often want to run a > set of scans for a given set of parameters. > Most often these parameters are not equally spaced so nested ascan in > the sequencer won't work for them. > > In SPEC I am used to define an array for each parameter and then use a > for loop to iterate of this array. > From your answer, I conclude that I need to write a simple scan macro > to realize that, right? Maybe fscan macro could be useful here? It should be possible to achieve a similar behavior using it. I also remember some users asking for a scan macro accepting a list of positions - we could think of adding such macro. Regarding fscan, I remember that we swapped order of its parameters due to the limitation in the repeat parameters spock syntax. It is no more the case so we could bring them back to the more convenient order. See sardana issue #223 for more details. > > Personally, I would prefer something like SPEC's qdo capabilities. > So first of all being able to run a sequence of macros in plain text > file also from within spock. Let me check if it would be relatively easy to reuse the code of the sequencer to do this. > If this qdo macro would also understand python loops and list or numpy > arrays it would be perfect. For this I would recommend developing simple python macros. IMHO the effort of developing this feature and its maintenance is not worth the benefit. But I stress here that it is my personal opinion. I encourage others to comment. > > I have simply the feeling that for non-programmers writing sardana > macros might be a bit heavy and especially error-prone. I see a lot of users making copy&paste programming with the "execMacro" calls with spock syntax strings. They use simple python loops for parameterizing the loops, etc. I think that they are quite happy with this, at least at Alba. > These guys will appriciate the sequencer, but this will not work with > looping of arrays of parameters as I said. > > If you think, something like a qdo macro is possible from spock I > could try implementing it if you could provide me with some initial help. Here I think it is better to reuse the sequencer code. Let me first evaluate it. And thanks a lot for the offer of help. We need it:) > > BTW: my MacroServer does not have a MacroPath property. Only MacroList > and MacroLibList. Do I have to add this property myself? I think you mean Tango attributes (MacroList and MacroLibList are Tango attributes). The MacroPath Tango property can be set from spock using this syntax (afterwards you will need to restart the MacroServer): _MACRO_SERVER.put_property({"MacroPath":["/sardana/src/sardana/macroserver/macros/examples"]}) You can add more than one in the list. These paths will be then searched for macros on the server startup. There are utility macros for reloading e.g. relmac, relmaclib at runtime... > > Best > > Daniel Many thanks for your feedback! Zibi > > > Zbigniew Reszela <zre...@ce... <mailto:zre...@ce...>> > schrieb am Di., 15. Mai 2018 um 17:11 Uhr: > > Hi Daniel, > > > Based on our conversation in > https://github.com/sardana-org/sardana/issues/744 I think you are > already familiar with most of the sequencer features. > > > There is maybe one more which is not documented and is related to > your question from this email. > > As you know, in the sequencer you can load the previously exported > files to the XML format, but also plain text files with spock > syntax composed directly by the user e.g. > > senv ActiveMntGrp my-exp-01 > > ascan mot01 0 1 1 0.1 > > dscan mot02 -1 1 1 0.1 > > However, the plain text files are limited, for example, they don't > support hooks. > > > Now a little bit of the history behind the sequencer. At the > beginning of its development we assumed that it won't provide > programming features like parameterizable macro execution in > loops, exception handing, etc. For these needs we suggest to > develop simple macros. > > Nevertheless, sequencer is frequently used at some of Alba's > beamlines, for simple sequences, even using the recently > introduced to the standard macro catalogue the repeat macro. > > We are very open for your feedback so please propose changes or > point missing features for the sequencer or any other part of > Sardana. For this needs, please use the Github issues so in the > future it will be easier to search for the information. > > > BTW the example from this email should be easily fulfilled by the > sequencer and the repeat macro, isn't it? > > > Now, regarding developing simple macros. For sure you already > found this chapter in the documentation: > > http://www.sardana-controls.org/en/latest/devel/howto_macros/index.html > > One could use the edmac magic command in spock and develop a > simple macro to fulfill the same need: > > Door_zreszela_1 [6]: %edmac? > Docstring: > edmac <macro name> [<module>] > Returns the contents of the macro file which contains the macro > code for > the given macro name. If the module is given and it does not exist > a new > one is created. If the given module is a simple module name and it > does > not exist, it will be created on the first directory mentioned in the > MacroPath > File: ~/workspace/sardana/src/sardana/spock/magic.py > > Door_zreszela_1 [7]: %edmac my_loop > /home/zreszela/workspace/macros/my_macros.py > Opening /home/zreszela/workspace/macros/my_macros.py.my_loop... > Editing... > > [here I developed the following macro (a template was populated by > Sardana)] > > 1 from sardana.macroserver.macro import Macro, macro, Type > 2 > 3 @macro() > 4 def my_loop(self): > 5 """Macro my_loop""" > 6 self.output("Running my_loop...") > 7 #my_night_scans.py > 8 self.execMacro("ascan mot01 10 20 10 1") > 9 param = range(10) > 10 > 11 for i in param: > 12 self.execMacro("dscan mot02 0 100 10 1") > > [end of the macro] > > Do you want to apply the new code on the server? [y] > Storing... [DONE] > > Door_zreszela_1 [8]: %my_loop > Running my_loop... > Operation will be saved in /home/zreszela/tmp/test.dat (Spec) > Scan #381 started at Tue May 15 16:34:40 2018. It will take at > least 0:00:22.627553 > #Pt No mot01 ct01 dt > 0 10 1 2.71108 > 1 11 1 4.7807 > 2 12 1 6.71653 > 3 13 1 8.6432 > 4 14 1 10.5776 > 5 15 1 12.5214 > 6 16 1 14.4605 > 7 17 1 16.3993 > 8 18 1 18.3318 > 9 19 1 20.2681 > 10 20 1 22.2003 > Operation saved in /home/zreszela/tmp/test.dat (Spec) > Scan #381 ended at Tue May 15 16:35:04 2018, taking > 0:00:23.220636. Dead time 52.6% (motion dead time 50.9%) > Operation will be saved in /home/zreszela/tmp/test.dat (Spec) > Scan #382 started at Tue May 15 16:35:04 2018. It will take at > least 0:00:22 > #Pt No mot02 ct01 dt > 0 0 1 0.033344 > 1 10 1 2.18017 > > [here is the rest of the output on my_loop macro] > > > Note that the "/home/zreszela/workspace/macros/" path is > configured in the MacroPath property of the MacroServer Tango device. > > There is a graphical alternative to the edmac magic command which > is called sardanaeditor. It should provide you the same > functionality but with a spyder like editor. > > > Hope that this somehow helps you! > > Cheers, > > Zibi > > > On 05/14/2018 03:05 PM, Daniel Schick wrote: >> Hej all, >> >> while playing with the sequencer and doing first steps with >> writing macros, I was wondering what are possible ways of >> realizing long nested scan sequences in Sardana. >> >> So far I know the sequencer GUI and also loading the appropriate >> .xml files for the sequencer. >> >> As I understood it, sardana macros are not intended for realizing >> scan sequnces. >> >> I also tried something in spock such as: >> >> for i in range(10): ascan mot1 0 10 10 1 >> >> but without success. Is there a way to use build-in python >> functions/loops in combination with sardana macros to realize >> scan sequences? >> >> maybe also calling python scripts like: >> |>> %run ./my_night_scans.py | >> |#my_night_scans.py ascan mot1 10 20 10 1 param = range(10) | >> |for i in param:dscan mot2 0 100 10 1 | >> I know that this would be quite close to SPEC's implementation of >> its macro engine. But for some users the sequencer GUI and it's >> XML file format might be a bit unfamiliar... >> Best Daniel >> >> >> >> ------------------------------------------------------------------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, Slashdot.org!http://sdm.link/slashdot >> >> >> _______________________________________________ >> Sardana-users mailing list >> Sar...@li... >> <mailto:Sar...@li...> >> https://lists.sourceforge.net/lists/listinfo/sardana-users > > -- > > ALBA Synchrotron <http://www.albasynchrotron.es> > > Zbigniew Reszela > Computing & Controls Division > > ALBA SYNCHROTRON LIGHT SOURCE > Carrer de la Llum 2-26 | 08290 | Cerdanyola del Vallès| Barcelona > | Spain <http://www.cells.es/en/about/coming-to-alba> > (+34) 93 592 4407 <tel:+34%20935%2092%2044%2007> > www.albasynchrotron.es <http://www.albasynchrotron.es>| > zre...@ce... <mailto:zre...@ce...> | legal notice > <https://www.cells.es/en/about/legal-notice> > > **Please, do not print this e-mail unless it is absolutely necessary. > **Si heu rebut aquest correu per error, us informo que pot > contenir informació confidencial i privada i que està prohibit el > seu ús. Us agrairíem que ho comuniqueu al remitent i l'elimineu. > Gràcies. > Si ha recibido este correo por error, le informo de que puede > contener información confidencial y privada y que está prohibido > su uso. Le agradeceré que lo comunique a su remitente y lo > elimine. Gracias. > If you have received this e-mail in error, please note that it may > contain confidential and private information, therefore, the use > of this information is strictly forbidden. Please inform the > sender of the error and delete the information received. Thank you. > -- ALBA Synchrotron <http://www.albasynchrotron.es> Zbigniew Reszela Computing & Controls Division ALBA SYNCHROTRON LIGHT SOURCE Carrer de la Llum 2-26 | 08290 | Cerdanyola del Vallès| Barcelona | Spain <http://www.cells.es/en/about/coming-to-alba> (+34) 93 592 4407 www.albasynchrotron.es <http://www.albasynchrotron.es>| zre...@ce... <mailto:zre...@ce...> | legal notice <https://www.cells.es/en/about/legal-notice> **Please, do not print this e-mail unless it is absolutely necessary. **Si heu rebut aquest correu per error, us informo que pot contenir informació confidencial i privada i que està prohibit el seu ús. Us agrairíem que ho comuniqueu al remitent i l'elimineu. Gràcies. Si ha recibido este correo por error, le informo de que puede contener información confidencial y privada y que está prohibido su uso. Le agradeceré que lo comunique a su remitente y lo elimine. Gracias. If you have received this e-mail in error, please note that it may contain confidential and private information, therefore, the use of this information is strictly forbidden. Please inform the sender of the error and delete the information received. Thank you. |
From: Daniel S. <sch...@gm...> - 2018-05-16 13:49:14
|
Hej all, I want to realize scans to do XMCD and MOKE measurements with Sardana. That means, that for every scan point of a motor (lets say the X-ray photon energy, or sample position, etc) I need to record data for magnetic field pointing up and down. The powerSupply driving my electromagnet is implemented as a sardana motor. I also need to switch the field at every scan point of the motor to get better statistics. Right now, I could use nested ascans to realize that: ascan sampleX -1 1 10 1 ascan magnet -1 1 1 1 however, this would result in a nasty and overcrowded scan file. In SPEC we did a little hack of the user_post_count macro, in which we switched the magnetic field, remembered the acquired counter values and triggered another acquisition. This second acquisition overwrites all old counter values but we used the remembered values from the other magnet direction to write them in some generic macro counters which is in SPEC easily possible via the counter array S['counter'] = 1. What would be the best way to realize that in Sardana and is there maybe already a solution out there? Best Daniel |
From: Daniel S. <sch...@gm...> - 2018-05-16 07:12:03
|
Dear Zibi, thanks for the detailed answer. Good to know that the sequencer is also able of handling plain text files, which will be fine for many situation. >From my experience at beamlines, users and myself often want to run a set of scans for a given set of parameters. Most often these parameters are not equally spaced so nested ascan in the sequencer won't work for them. In SPEC I am used to define an array for each parameter and then use a for loop to iterate of this array. >From your answer, I conclude that I need to write a simple scan macro to realize that, right? Personally, I would prefer something like SPEC's qdo capabilities. So first of all being able to run a sequence of macros in plain text file also from within spock. If this qdo macro would also understand python loops and list or numpy arrays it would be perfect. I have simply the feeling that for non-programmers writing sardana macros might be a bit heavy and especially error-prone. These guys will appriciate the sequencer, but this will not work with looping of arrays of parameters as I said. If you think, something like a qdo macro is possible from spock I could try implementing it if you could provide me with some initial help. BTW: my MacroServer does not have a MacroPath property. Only MacroList and MacroLibList. Do I have to add this property myself? Best Daniel Zbigniew Reszela <zre...@ce...> schrieb am Di., 15. Mai 2018 um 17:11 Uhr: > Hi Daniel, > > > Based on our conversation in > https://github.com/sardana-org/sardana/issues/744 I think you are already > familiar with most of the sequencer features. > > > There is maybe one more which is not documented and is related to your > question from this email. > > As you know, in the sequencer you can load the previously exported files > to the XML format, but also plain text files with spock syntax composed > directly by the user e.g. > > senv ActiveMntGrp my-exp-01 > > ascan mot01 0 1 1 0.1 > > dscan mot02 -1 1 1 0.1 > > However, the plain text files are limited, for example, they don't support > hooks. > > > Now a little bit of the history behind the sequencer. At the beginning of > its development we assumed that it won't provide programming features like > parameterizable macro execution in loops, exception handing, etc. For these > needs we suggest to develop simple macros. > > Nevertheless, sequencer is frequently used at some of Alba's beamlines, > for simple sequences, even using the recently introduced to the standard > macro catalogue the repeat macro. > > We are very open for your feedback so please propose changes or point > missing features for the sequencer or any other part of Sardana. For this > needs, please use the Github issues so in the future it will be easier to > search for the information. > > > BTW the example from this email should be easily fulfilled by the > sequencer and the repeat macro, isn't it? > > > Now, regarding developing simple macros. For sure you already found this > chapter in the documentation: > > http://www.sardana-controls.org/en/latest/devel/howto_macros/index.html > > One could use the edmac magic command in spock and develop a simple macro > to fulfill the same need: > > Door_zreszela_1 [6]: %edmac? > Docstring: > edmac <macro name> [<module>] > Returns the contents of the macro file which contains the macro code for > the given macro name. If the module is given and it does not exist a new > one is created. If the given module is a simple module name and it does > not exist, it will be created on the first directory mentioned in the > MacroPath > File: ~/workspace/sardana/src/sardana/spock/magic.py > > Door_zreszela_1 [7]: %edmac my_loop > /home/zreszela/workspace/macros/my_macros.py > Opening /home/zreszela/workspace/macros/my_macros.py.my_loop... > Editing... > > [here I developed the following macro (a template was populated by > Sardana)] > > 1 from sardana.macroserver.macro import Macro, macro, > Type > > 2 > > 3 > @macro() > > 4 def > my_loop(self): > 5 """Macro > my_loop""" > 6 self.output("Running > my_loop...") > 7 > #my_night_scans.py > 8 self.execMacro("ascan mot01 10 20 10 > 1") > 9 param = > range(10) > 10 > > 11 for i in > param: > 12 self.execMacro("dscan mot02 0 100 10 1") > > [end of the macro] > > Do you want to apply the new code on the server? [y] > Storing... [DONE] > > Door_zreszela_1 [8]: %my_loop > Running my_loop... > Operation will be saved in /home/zreszela/tmp/test.dat (Spec) > Scan #381 started at Tue May 15 16:34:40 2018. It will take at least > 0:00:22.627553 > #Pt No mot01 ct01 dt > 0 10 1 2.71108 > 1 11 1 4.7807 > 2 12 1 6.71653 > 3 13 1 8.6432 > 4 14 1 10.5776 > 5 15 1 12.5214 > 6 16 1 14.4605 > 7 17 1 16.3993 > 8 18 1 18.3318 > 9 19 1 20.2681 > 10 20 1 22.2003 > Operation saved in /home/zreszela/tmp/test.dat (Spec) > Scan #381 ended at Tue May 15 16:35:04 2018, taking 0:00:23.220636. Dead > time 52.6% (motion dead time 50.9%) > Operation will be saved in /home/zreszela/tmp/test.dat (Spec) > Scan #382 started at Tue May 15 16:35:04 2018. It will take at least > 0:00:22 > #Pt No mot02 ct01 dt > 0 0 1 0.033344 > 1 10 1 2.18017 > > [here is the rest of the output on my_loop macro] > > > Note that the "/home/zreszela/workspace/macros/" path is configured in the > MacroPath property of the MacroServer Tango device. > > There is a graphical alternative to the edmac magic command which is > called sardanaeditor. It should provide you the same functionality but with > a spyder like editor. > > > Hope that this somehow helps you! > > Cheers, > > Zibi > > > On 05/14/2018 03:05 PM, Daniel Schick wrote: > > Hej all, > > while playing with the sequencer and doing first steps with writing > macros, I was wondering what are possible ways of realizing long nested > scan sequences in Sardana. > > So far I know the sequencer GUI and also loading the appropriate .xml > files for the sequencer. > > As I understood it, sardana macros are not intended for realizing scan > sequnces. > > I also tried something in spock such as: > > for i in range(10): ascan mot1 0 10 10 1 > > but without success. Is there a way to use build-in python functions/loops > in combination with sardana macros to realize scan sequences? > > maybe also calling python scripts like: > > >> %run ./my_night_scans.py > > > #my_night_scans.py > ascan mot1 10 20 10 1 > param = range(10) > > for i in param: > dscan mot2 0 100 10 1 > > > I know that this would be quite close to SPEC's implementation of its macro engine. > But for some users the sequencer GUI and it's XML file format might be a bit unfamiliar... > > > Best Daniel > > > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > > _______________________________________________ > Sardana-users mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/sardana-users > > > -- > > [image: ALBA Synchrotron] <http://www.albasynchrotron.es> > Zbigniew Reszela > Computing & Controls Division > > ALBA SYNCHROTRON LIGHT SOURCE > Carrer de la Llum 2-26 | 08290 | Cerdanyola del Vallès| Barcelona | Spain > <http://www.cells.es/en/about/coming-to-alba> > (+34) 93 592 4407 <+34%20935%2092%2044%2007> > www.albasynchrotron.es | zre...@ce... | legal notice > <https://www.cells.es/en/about/legal-notice> > > > * Please, do not print this e-mail unless it is absolutely necessary. * > Si heu rebut aquest correu per error, us informo que pot contenir > informació confidencial i privada i que està prohibit el seu ús. Us > agrairíem que ho comuniqueu al remitent i l'elimineu. Gràcies. > Si ha recibido este correo por error, le informo de que puede contener > información confidencial y privada y que está prohibido su uso. Le > agradeceré que lo comunique a su remitente y lo elimine. Gracias. > If you have received this e-mail in error, please note that it may contain > confidential and private information, therefore, the use of this > information is strictly forbidden. Please inform the sender of the error > and delete the information received. Thank you. > |
From: Zbigniew R. <zre...@ce...> - 2018-05-15 15:11:53
|
Hi Daniel, Based on our conversation in https://github.com/sardana-org/sardana/issues/744 I think you are already familiar with most of the sequencer features. There is maybe one more which is not documented and is related to your question from this email. As you know, in the sequencer you can load the previously exported files to the XML format, but also plain text files with spock syntax composed directly by the user e.g. senv ActiveMntGrp my-exp-01 ascan mot01 0 1 1 0.1 dscan mot02 -1 1 1 0.1 However, the plain text files are limited, for example, they don't support hooks. Now a little bit of the history behind the sequencer. At the beginning of its development we assumed that it won't provide programming features like parameterizable macro execution in loops, exception handing, etc. For these needs we suggest to develop simple macros. Nevertheless, sequencer is frequently used at some of Alba's beamlines, for simple sequences, even using the recently introduced to the standard macro catalogue the repeat macro. We are very open for your feedback so please propose changes or point missing features for the sequencer or any other part of Sardana. For this needs, please use the Github issues so in the future it will be easier to search for the information. BTW the example from this email should be easily fulfilled by the sequencer and the repeat macro, isn't it? Now, regarding developing simple macros. For sure you already found this chapter in the documentation: http://www.sardana-controls.org/en/latest/devel/howto_macros/index.html One could use the edmac magic command in spock and develop a simple macro to fulfill the same need: Door_zreszela_1 [6]: %edmac? Docstring: edmac <macro name> [<module>] Returns the contents of the macro file which contains the macro code for the given macro name. If the module is given and it does not exist a new one is created. If the given module is a simple module name and it does not exist, it will be created on the first directory mentioned in the MacroPath File: ~/workspace/sardana/src/sardana/spock/magic.py Door_zreszela_1 [7]: %edmac my_loop /home/zreszela/workspace/macros/my_macros.py Opening /home/zreszela/workspace/macros/my_macros.py.my_loop... Editing... [here I developed the following macro (a template was populated by Sardana)] 1 from sardana.macroserver.macro import Macro, macro, Type 2 3 @macro() 4 def my_loop(self): 5 """Macro my_loop""" 6 self.output("Running my_loop...") 7 #my_night_scans.py 8 self.execMacro("ascan mot01 10 20 10 1") 9 param = range(10) 10 11 for i in param: 12 self.execMacro("dscan mot02 0 100 10 1") [end of the macro] Do you want to apply the new code on the server? [y] Storing... [DONE] Door_zreszela_1 [8]: %my_loop Running my_loop... Operation will be saved in /home/zreszela/tmp/test.dat (Spec) Scan #381 started at Tue May 15 16:34:40 2018. It will take at least 0:00:22.627553 #Pt No mot01 ct01 dt 0 10 1 2.71108 1 11 1 4.7807 2 12 1 6.71653 3 13 1 8.6432 4 14 1 10.5776 5 15 1 12.5214 6 16 1 14.4605 7 17 1 16.3993 8 18 1 18.3318 9 19 1 20.2681 10 20 1 22.2003 Operation saved in /home/zreszela/tmp/test.dat (Spec) Scan #381 ended at Tue May 15 16:35:04 2018, taking 0:00:23.220636. Dead time 52.6% (motion dead time 50.9%) Operation will be saved in /home/zreszela/tmp/test.dat (Spec) Scan #382 started at Tue May 15 16:35:04 2018. It will take at least 0:00:22 #Pt No mot02 ct01 dt 0 0 1 0.033344 1 10 1 2.18017 [here is the rest of the output on my_loop macro] Note that the "/home/zreszela/workspace/macros/" path is configured in the MacroPath property of the MacroServer Tango device. There is a graphical alternative to the edmac magic command which is called sardanaeditor. It should provide you the same functionality but with a spyder like editor. Hope that this somehow helps you! Cheers, Zibi On 05/14/2018 03:05 PM, Daniel Schick wrote: > Hej all, > > while playing with the sequencer and doing first steps with writing > macros, I was wondering what are possible ways of realizing long > nested scan sequences in Sardana. > > So far I know the sequencer GUI and also loading the appropriate .xml > files for the sequencer. > > As I understood it, sardana macros are not intended for realizing scan > sequnces. > > I also tried something in spock such as: > > for i in range(10): ascan mot1 0 10 10 1 > > but without success. Is there a way to use build-in python > functions/loops in combination with sardana macros to realize scan > sequences? > > maybe also calling python scripts like: > |>> %run ./my_night_scans.py | > |#my_night_scans.py ascan mot1 10 20 10 1 param = range(10) | > |for i in param:dscan mot2 0 100 10 1 | > I know that this would be quite close to SPEC's implementation of its > macro engine. But for some users the sequencer GUI and it's XML file > format might be a bit unfamiliar... > Best Daniel > > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > _______________________________________________ > Sardana-users mailing list > Sar...@li... > https://lists.sourceforge.net/lists/listinfo/sardana-users -- ALBA Synchrotron <http://www.albasynchrotron.es> Zbigniew Reszela Computing & Controls Division ALBA SYNCHROTRON LIGHT SOURCE Carrer de la Llum 2-26 | 08290 | Cerdanyola del Vallès| Barcelona | Spain <http://www.cells.es/en/about/coming-to-alba> (+34) 93 592 4407 www.albasynchrotron.es <http://www.albasynchrotron.es>| zre...@ce... <mailto:zre...@ce...> | legal notice <https://www.cells.es/en/about/legal-notice> **Please, do not print this e-mail unless it is absolutely necessary. **Si heu rebut aquest correu per error, us informo que pot contenir informació confidencial i privada i que està prohibit el seu ús. Us agrairíem que ho comuniqueu al remitent i l'elimineu. Gràcies. Si ha recibido este correo por error, le informo de que puede contener información confidencial y privada y que está prohibido su uso. Le agradeceré que lo comunique a su remitente y lo elimine. Gracias. If you have received this e-mail in error, please note that it may contain confidential and private information, therefore, the use of this information is strictly forbidden. Please inform the sender of the error and delete the information received. Thank you. |
From: Daniel S. <sch...@gm...> - 2018-05-15 12:41:34
|
Hej all, I would like to automatically set the software limits from the motors harware limits when I add it in spock. I would like to do that in the addDevice method where I can read the hardware limits from the controller. However, I haven't found a way of setting the limits within the motorController class itself. Best Daniel |
From: Zbigniew R. <zre...@ce...> - 2018-05-15 09:04:56
|
Dear all, We would like to announce the upcoming Sardana and Taurus Workshop satellite to the Tango Meeting. It will take place in parallel to the Tango Steering Committee Meeting on 5th of June 8:30 - 12:30. Due to the limited time it will be mainly focused on reviewing and demonstrating the recently introduced features and changes in both projects. You can consult the workshop agenda under this link: https://github.com/sardana-org/sardana-followup/blob/master/20180605-Prague/AGENDA.md There is no official registration neither fees - you are all more than welcome! If you plan to join the workshop, in order to help us organize it in the best possible way, please send an email to: zre...@ce... and cpa...@ce.... Finally, after the workshop, we plan to go for a quick lunch at one of the nearby restaurants. In the email, please say if you would also join the lunch so we could book a table for all. We would like to thank the 32nd Tango Collaboration Meeting organizers for this opportunity! Carlos & Zibi |
From: Daniel S. <sch...@gm...> - 2018-05-14 13:06:10
|
Hej all, while playing with the sequencer and doing first steps with writing macros, I was wondering what are possible ways of realizing long nested scan sequences in Sardana. So far I know the sequencer GUI and also loading the appropriate .xml files for the sequencer. As I understood it, sardana macros are not intended for realizing scan sequnces. I also tried something in spock such as: for i in range(10): ascan mot1 0 10 10 1 but without success. Is there a way to use build-in python functions/loops in combination with sardana macros to realize scan sequences? maybe also calling python scripts like: >> %run ./my_night_scans.py #my_night_scans.py ascan mot1 10 20 10 1 param = range(10) for i in param: dscan mot2 0 100 10 1 I know that this would be quite close to SPEC's implementation of its macro engine. But for some users the sequencer GUI and it's XML file format might be a bit unfamiliar... Best Daniel |
From: Zbigniew R. <zre...@ce...> - 2018-05-14 11:08:36
|
Hi, The PR was merged and the official docs already reflects the changes. Thanks a lot! Zibi On 05/14/2018 12:44 PM, Daniel Schick wrote: > thanks so far. I will try switching to work directly from git then. > > Best > > Daniel > > Carlos Pascual <cpa...@ce... <mailto:cpa...@ce...>> schrieb > am Mo., 14. Mai 2018 um 12:27 Uhr: > > I created the following PR with the required doc changes: > > https://github.com/sardana-org/sardana/pull/751 > > On Monday, May 14, 2018 12:13:41 PM CEST Carlos Pascual wrote: > > Hi, > > The docs are outdated in this area. We should update them to be > more or less > > as the ones for taurus: > > > > > http://taurus-scada.org/users/getting_started.html#working-from-git-source-d > > irectly-in-develop-mode > > > > Note that it should not be required to add anything to the > PYTHONPATH. > > At most, if you install on a custom (or user) dir, make sure > that the > > directory where the scripts are created is in your PATH. > > > > Also note that if there are changes in the scripts in future > versions you > > may need to re-run the pip -e command to re-install the scripts > (or to > > update the pkg info). > > > > Cheers, Carlos > > > > On Monday, May 14, 2018 11:01:14 AM CEST Teresa Nunez wrote: > > > Hi Daniel, > > > > > > since last year the scripts are not in the > git repo > > > > > > (I let the people from Alba to > > > > > > answer about this), but you can generate them without making the > > > > > > installation as root, using > > > > > > the option 'develop' by running the setup.py script and > adding the > > > > > > scripts directory to PYTHONPATH, > > > > > > something like: > > > > > > cd sardana_develop > > > export > PYTHONPATH=/home/tnunez/sardana_develop/scripts:$PYTHONPATH > > > python setup.py develop > > > --install-dir=/home/tnunez/sardana_develop/scripts > > > > > > I hope this helps. > > > > > > Regards, > > > > > > Teresa > > > > > > On 05/14/18 10:40, Daniel Schick wrote: > > > > Hej all, > > > > > > > > I just cloned the sardana repo directly from git and wanted > to work > > > > from it, but the documentation says > > > > > (http://www.sardana-controls.org/en/latest/users/getting_started/install > > > > in > > > > g.html#working-directly-from-git): > > > > > > > > > > > > And then you can directly execute sardana binaries (Pool, > MacroServer, > > > > Sardana or spock from the command line): > > > > > > > > homer@pc001:~/workspace$ cd sardana > > > > homer@pc001:~/workspace/sardana$ scripts/Sardana > > > > > > > > But there are no executables in this folder. > > > > I can then do a > > > > > > > > python setup.py install > > > > > > > > to work with this version, but I thought I could skip this > step ... > > > > > > > > Best > > > > > > > > Daniel > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------ > > > > -- > > > > ---- Check out the vibrant tech community on one o > <https://maps.google.com/?q=community+on+one+o&entry=gmail&source=g>f > the world's most > > > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > > > > > > > > > > _______________________________________________ > > > > Sardana-users mailing list > > > > Sar...@li... > <mailto:Sar...@li...> > > > > https://lists.sourceforge.net/lists/listinfo/sardana-users > > > -- > +----------------------------------------------------+ > Carlos Pascual Izarra > Scientific Software Coordinator > Computing Division > ALBA Synchrotron [http://www.albasynchrotron.es] > Carrer de la Llum 2-26 > E-08290 Cerdanyola del Valles (Barcelona), Spain > E-mail: cpa...@ce... <mailto:cpa...@ce...> > Phone: +34 93 592 4428 <tel:+34%20935%2092%2044%2028> > +----------------------------------------------------+ > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Sardana-users mailing list > Sar...@li... > <mailto:Sar...@li...> > https://lists.sourceforge.net/lists/listinfo/sardana-users > > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > _______________________________________________ > Sardana-users mailing list > Sar...@li... > https://lists.sourceforge.net/lists/listinfo/sardana-users -- ALBA Synchrotron <http://www.albasynchrotron.es> Zbigniew Reszela Computing & Controls Division ALBA SYNCHROTRON LIGHT SOURCE Carrer de la Llum 2-26 | 08290 | Cerdanyola del Vallès| Barcelona | Spain <http://www.cells.es/en/about/coming-to-alba> (+34) 93 592 4407 www.albasynchrotron.es <http://www.albasynchrotron.es>| zre...@ce... <mailto:zre...@ce...> | legal notice <https://www.cells.es/en/about/legal-notice> **Please, do not print this e-mail unless it is absolutely necessary. **Si heu rebut aquest correu per error, us informo que pot contenir informació confidencial i privada i que està prohibit el seu ús. Us agrairíem que ho comuniqueu al remitent i l'elimineu. Gràcies. Si ha recibido este correo por error, le informo de que puede contener información confidencial y privada y que está prohibido su uso. Le agradeceré que lo comunique a su remitente y lo elimine. Gracias. If you have received this e-mail in error, please note that it may contain confidential and private information, therefore, the use of this information is strictly forbidden. Please inform the sender of the error and delete the information received. Thank you. |
From: Daniel S. <sch...@gm...> - 2018-05-14 10:44:55
|
thanks so far. I will try switching to work directly from git then. Best Daniel Carlos Pascual <cpa...@ce...> schrieb am Mo., 14. Mai 2018 um 12:27 Uhr: > I created the following PR with the required doc changes: > > https://github.com/sardana-org/sardana/pull/751 > > On Monday, May 14, 2018 12:13:41 PM CEST Carlos Pascual wrote: > > Hi, > > The docs are outdated in this area. We should update them to be more or > less > > as the ones for taurus: > > > > > http://taurus-scada.org/users/getting_started.html#working-from-git-source-d > > irectly-in-develop-mode > > > > Note that it should not be required to add anything to the PYTHONPATH. > > At most, if you install on a custom (or user) dir, make sure that the > > directory where the scripts are created is in your PATH. > > > > Also note that if there are changes in the scripts in future versions you > > may need to re-run the pip -e command to re-install the scripts (or to > > update the pkg info). > > > > Cheers, Carlos > > > > On Monday, May 14, 2018 11:01:14 AM CEST Teresa Nunez wrote: > > > Hi Daniel, > > > > > > since last year the scripts are not in the git repo > > > > > > (I let the people from Alba to > > > > > > answer about this), but you can generate them without making the > > > > > > installation as root, using > > > > > > the option 'develop' by running the setup.py script and adding the > > > > > > scripts directory to PYTHONPATH, > > > > > > something like: > > > > > > cd sardana_develop > > > export PYTHONPATH=/home/tnunez/sardana_develop/scripts:$PYTHONPATH > > > python setup.py develop > > > --install-dir=/home/tnunez/sardana_develop/scripts > > > > > > I hope this helps. > > > > > > Regards, > > > > > > Teresa > > > > > > On 05/14/18 10:40, Daniel Schick wrote: > > > > Hej all, > > > > > > > > I just cloned the sardana repo directly from git and wanted to work > > > > from it, but the documentation says > > > > ( > http://www.sardana-controls.org/en/latest/users/getting_started/install > > > > in > > > > g.html#working-directly-from-git): > > > > > > > > > > > > And then you can directly execute sardana binaries (Pool, > MacroServer, > > > > Sardana or spock from the command line): > > > > > > > > homer@pc001:~/workspace$ cd sardana > > > > homer@pc001:~/workspace/sardana$ scripts/Sardana > > > > > > > > But there are no executables in this folder. > > > > I can then do a > > > > > > > > python setup.py install > > > > > > > > to work with this version, but I thought I could skip this step ... > > > > > > > > Best > > > > > > > > Daniel > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------ > > > > -- > > > > ---- Check out the vibrant tech community on one o > <https://maps.google.com/?q=community+on+one+o&entry=gmail&source=g>f the > world's most > > > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > > > > > > > > > > _______________________________________________ > > > > Sardana-users mailing list > > > > Sar...@li... > > > > https://lists.sourceforge.net/lists/listinfo/sardana-users > > > -- > +----------------------------------------------------+ > Carlos Pascual Izarra > Scientific Software Coordinator > Computing Division > ALBA Synchrotron [http://www.albasynchrotron.es] > Carrer de la Llum 2-26 > E-08290 Cerdanyola del Valles (Barcelona), Spain > E-mail: cpa...@ce... > Phone: +34 93 592 4428 <+34%20935%2092%2044%2028> > +----------------------------------------------------+ > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Sardana-users mailing list > Sar...@li... > https://lists.sourceforge.net/lists/listinfo/sardana-users > |
From: Carlos P. <cpa...@ce...> - 2018-05-14 10:27:33
|
I created the following PR with the required doc changes: https://github.com/sardana-org/sardana/pull/751 On Monday, May 14, 2018 12:13:41 PM CEST Carlos Pascual wrote: > Hi, > The docs are outdated in this area. We should update them to be more or less > as the ones for taurus: > > http://taurus-scada.org/users/getting_started.html#working-from-git-source-d > irectly-in-develop-mode > > Note that it should not be required to add anything to the PYTHONPATH. > At most, if you install on a custom (or user) dir, make sure that the > directory where the scripts are created is in your PATH. > > Also note that if there are changes in the scripts in future versions you > may need to re-run the pip -e command to re-install the scripts (or to > update the pkg info). > > Cheers, Carlos > > On Monday, May 14, 2018 11:01:14 AM CEST Teresa Nunez wrote: > > Hi Daniel, > > > > since last year the scripts are not in the git repo > > > > (I let the people from Alba to > > > > answer about this), but you can generate them without making the > > > > installation as root, using > > > > the option 'develop' by running the setup.py script and adding the > > > > scripts directory to PYTHONPATH, > > > > something like: > > > > cd sardana_develop > > export PYTHONPATH=/home/tnunez/sardana_develop/scripts:$PYTHONPATH > > python setup.py develop > > --install-dir=/home/tnunez/sardana_develop/scripts > > > > I hope this helps. > > > > Regards, > > > > Teresa > > > > On 05/14/18 10:40, Daniel Schick wrote: > > > Hej all, > > > > > > I just cloned the sardana repo directly from git and wanted to work > > > from it, but the documentation says > > > (http://www.sardana-controls.org/en/latest/users/getting_started/install > > > in > > > g.html#working-directly-from-git): > > > > > > > > > And then you can directly execute sardana binaries (Pool, MacroServer, > > > Sardana or spock from the command line): > > > > > > homer@pc001:~/workspace$ cd sardana > > > homer@pc001:~/workspace/sardana$ scripts/Sardana > > > > > > But there are no executables in this folder. > > > I can then do a > > > > > > python setup.py install > > > > > > to work with this version, but I thought I could skip this step ... > > > > > > Best > > > > > > Daniel > > > > > > > > > > > > ------------------------------------------------------------------------ > > > -- > > > ---- Check out the vibrant tech community on one of the world's most > > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > > > > > > > _______________________________________________ > > > Sardana-users mailing list > > > Sar...@li... > > > https://lists.sourceforge.net/lists/listinfo/sardana-users -- +----------------------------------------------------+ Carlos Pascual Izarra Scientific Software Coordinator Computing Division ALBA Synchrotron [http://www.albasynchrotron.es] Carrer de la Llum 2-26 E-08290 Cerdanyola del Valles (Barcelona), Spain E-mail: cpa...@ce... Phone: +34 93 592 4428 +----------------------------------------------------+ |
From: Carlos P. <cpa...@ce...> - 2018-05-14 10:13:51
|
Hi, The docs are outdated in this area. We should update them to be more or less as the ones for taurus: http://taurus-scada.org/users/getting_started.html#working-from-git-source-directly-in-develop-mode Note that it should not be required to add anything to the PYTHONPATH. At most, if you install on a custom (or user) dir, make sure that the directory where the scripts are created is in your PATH. Also note that if there are changes in the scripts in future versions you may need to re-run the pip -e command to re-install the scripts (or to update the pkg info). Cheers, Carlos On Monday, May 14, 2018 11:01:14 AM CEST Teresa Nunez wrote: > Hi Daniel, > since last year the scripts are not in the git repo > (I let the people from Alba to > answer about this), but you can generate them without making the > installation as root, using > the option 'develop' by running the setup.py script and adding the > scripts directory to PYTHONPATH, > something like: > > cd sardana_develop > export PYTHONPATH=/home/tnunez/sardana_develop/scripts:$PYTHONPATH > python setup.py develop --install-dir=/home/tnunez/sardana_develop/scripts > > I hope this helps. > > Regards, > Teresa > > On 05/14/18 10:40, Daniel Schick wrote: > > Hej all, > > > > I just cloned the sardana repo directly from git and wanted to work > > from it, but the documentation says > > (http://www.sardana-controls.org/en/latest/users/getting_started/installin > > g.html#working-directly-from-git): > > > > > > And then you can directly execute sardana binaries (Pool, MacroServer, > > Sardana or spock from the command line): > > > > homer@pc001:~/workspace$ cd sardana > > homer@pc001:~/workspace/sardana$ scripts/Sardana > > > > But there are no executables in this folder. > > I can then do a > > > > python setup.py install > > > > to work with this version, but I thought I could skip this step ... > > > > Best > > > > Daniel > > > > > > > > -------------------------------------------------------------------------- > > ---- Check out the vibrant tech community on one of the world's most > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > > > > _______________________________________________ > > Sardana-users mailing list > > Sar...@li... > > https://lists.sourceforge.net/lists/listinfo/sardana-users -- +----------------------------------------------------+ Carlos Pascual Izarra Scientific Software Coordinator Computing Division ALBA Synchrotron [http://www.albasynchrotron.es] Carrer de la Llum 2-26 E-08290 Cerdanyola del Valles (Barcelona), Spain E-mail: cpa...@ce... Phone: +34 93 592 4428 +----------------------------------------------------+ |
From: Teresa N. <mar...@de...> - 2018-05-14 09:20:01
|
Hi Daniel, since last year the scripts are not in the git repo (I let the people from Alba to answer about this), but you can generate them without making the installation as root, using the option 'develop' by running the setup.py script and adding the scripts directory to PYTHONPATH, something like: cd sardana_develop export PYTHONPATH=/home/tnunez/sardana_develop/scripts:$PYTHONPATH python setup.py develop --install-dir=/home/tnunez/sardana_develop/scripts I hope this helps. Regards, Teresa On 05/14/18 10:40, Daniel Schick wrote: > Hej all, > > I just cloned the sardana repo directly from git and wanted to work > from it, but the documentation says > (http://www.sardana-controls.org/en/latest/users/getting_started/installing.html#working-directly-from-git): > > > And then you can directly execute sardana binaries (Pool, MacroServer, > Sardana or spock from the command line): > > homer@pc001:~/workspace$ cd sardana > homer@pc001:~/workspace/sardana$ scripts/Sardana > > But there are no executables in this folder. > I can then do a > > python setup.py install > > to work with this version, but I thought I could skip this step ... > > Best > > Daniel > > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > _______________________________________________ > Sardana-users mailing list > Sar...@li... > https://lists.sourceforge.net/lists/listinfo/sardana-users |
From: Teresa N. <mar...@de...> - 2018-05-14 09:15:01
|
Just in case ... I forgot to add that after generating the scripts in your private directories you have also to add the src directory in the PYTHONPATH: export PYTHONPATH=~/sardana_develop/src:$PYTHONPATH On 05/14/18 11:01, Teresa Nunez wrote: > Hi Daniel, > since last year the scripts are not in the git repo > (I let the people from Alba to > answer about this), but you can generate them without making the > installation as root, using > the option 'develop' by running the setup.py script and adding the > scripts directory to PYTHONPATH, > something like: > > cd sardana_develop > export PYTHONPATH=/home/tnunez/sardana_develop/scripts:$PYTHONPATH > python setup.py develop > --install-dir=/home/tnunez/sardana_develop/scripts > > I hope this helps. > > Regards, > Teresa > > > > On 05/14/18 10:40, Daniel Schick wrote: >> Hej all, >> >> I just cloned the sardana repo directly from git and wanted to work >> from it, but the documentation says >> (http://www.sardana-controls.org/en/latest/users/getting_started/installing.html#working-directly-from-git): >> >> >> And then you can directly execute sardana binaries (Pool, >> MacroServer, Sardana or spock from the command line): >> >> homer@pc001:~/workspace$ cd sardana >> homer@pc001:~/workspace/sardana$ scripts/Sardana >> >> But there are no executables in this folder. >> I can then do a >> >> python setup.py install >> >> to work with this version, but I thought I could skip this step ... >> >> Best >> >> Daniel >> >> >> >> ------------------------------------------------------------------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, Slashdot.org!http://sdm.link/slashdot >> >> >> _______________________________________________ >> Sardana-users mailing list >> Sar...@li... >> https://lists.sourceforge.net/lists/listinfo/sardana-users > |
From: Daniel S. <sch...@gm...> - 2018-05-14 08:41:10
|
Hej all, I just cloned the sardana repo directly from git and wanted to work from it, but the documentation says ( http://www.sardana-controls.org/en/latest/users/getting_started/installing.html#working-directly-from-git): And then you can directly execute sardana binaries (Pool, MacroServer, Sardana or spock from the command line): homer@pc001:~/workspace$ cd sardana homer@pc001:~/workspace/sardana$ scripts/Sardana But there are no executables in this folder. I can then do a python setup.py install to work with this version, but I thought I could skip this step ... Best Daniel |
From: Zbigniew R. <zre...@ce...> - 2018-04-09 14:54:17
|
Hi Daniel, Thanks for the comment about the docs. I've just added the general hooks macros to the macro catalog. The general hooks are quite new in Sardana so please report any problem/question that you find. Cheers, Zibi On 04/06/2018 01:21 PM, Daniel Schick wrote: > ah, great. sorry for overlooking that issue. > > I quickly tested it and it seems to be exactly what I was looking for. > > Maybe one could add the lsgh, defgh and udefgh macros in the Standard > macro catalog > http://www.sardana-controls.org/en/latest/users/standard_macro_catalog.html > > Many thanks for the quick help and the nice feature implementation! > > Daniel > > Teresa Nunez <mar...@de... > <mailto:mar...@de...>> schrieb am Fr., 6. > Apr. 2018 um 11:34 Uhr: > > Hello Daniel, > the feature of general user defined hooks for > scans is already implemented in sardana. > You can see it here: > > https://github.com/sardana-org/sardana/pull/646 > > and check if this is what you are looking for. > > Regards, > Teresa > > > On 04/06/18 11:01, Daniel Schick wrote: >> Hey all, >> >> I was wondering if there are already (or plans for implementing) >> hooks for some user-defined macros that are executed for every >> scan, or ct, etc. >> This is how SPEC enables user to implement additional features >> for the scan routines and I guess most SPEC user are used to >> these features, like user_prescan, user_postscan, user_precount, etc. >> >> As I see it, it should not be too hard to implement such things >> with the given macro capabilities of Sardana. >> However, before doing so on my own, I guess it might make sense >> to think of this as a general feature or what do you guys think? >> >> Best >> >> Daniel >> >> >> ------------------------------------------------------------------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, Slashdot.org!http://sdm.link/slashdot >> >> >> _______________________________________________ >> Sardana-users mailing list >> Sar...@li... >> <mailto:Sar...@li...> >> https://lists.sourceforge.net/lists/listinfo/sardana-users > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! > http://sdm.link/slashdot_______________________________________________ > Sardana-users mailing list > Sar...@li... > <mailto:Sar...@li...> > https://lists.sourceforge.net/lists/listinfo/sardana-users > > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > _______________________________________________ > Sardana-users mailing list > Sar...@li... > https://lists.sourceforge.net/lists/listinfo/sardana-users -- ALBA Synchrotron <http://www.albasynchrotron.es> Zbigniew Reszela Computing & Controls Division ALBA SYNCHROTRON LIGHT SOURCE Carrer de la Llum 2-26 | 08290 | Cerdanyola del Vallès| Barcelona | Spain <http://www.cells.es/en/about/coming-to-alba> (+34) 93 592 4407 www.albasynchrotron.es <http://www.albasynchrotron.es>| zre...@ce... <mailto:zre...@ce...> | legal notice <https://www.cells.es/en/about/legal-notice> **Please, do not print this e-mail unless it is absolutely necessary. **Si heu rebut aquest correu per error, us informo que pot contenir informació confidencial i privada i que està prohibit el seu ús. Us agrairíem que ho comuniqueu al remitent i l'elimineu. Gràcies. Si ha recibido este correo por error, le informo de que puede contener información confidencial y privada y que está prohibido su uso. Le agradeceré que lo comunique a su remitente y lo elimine. Gracias. If you have received this e-mail in error, please note that it may contain confidential and private information, therefore, the use of this information is strictly forbidden. Please inform the sender of the error and delete the information received. Thank you. |
From: Daniel S. <sch...@gm...> - 2018-04-06 11:21:21
|
ah, great. sorry for overlooking that issue. I quickly tested it and it seems to be exactly what I was looking for. Maybe one could add the lsgh, defgh and udefgh macros in the Standard macro catalog http://www.sardana-controls.org/en/latest/users/standard_macro_catalog.html Many thanks for the quick help and the nice feature implementation! Daniel Teresa Nunez <mar...@de...> schrieb am Fr., 6. Apr. 2018 um 11:34 Uhr: > Hello Daniel, > the feature of general user defined hooks for scans > is already implemented in sardana. > You can see it here: > > https://github.com/sardana-org/sardana/pull/646 > > and check if this is what you are looking for. > > Regards, > Teresa > > > On 04/06/18 11:01, Daniel Schick wrote: > > Hey all, > > I was wondering if there are already (or plans for implementing) hooks for > some user-defined macros that are executed for every scan, or ct, etc. > This is how SPEC enables user to implement additional features for the > scan routines and I guess most SPEC user are used to these features, like > user_prescan, user_postscan, user_precount, etc. > > As I see it, it should not be too hard to implement such things with the > given macro capabilities of Sardana. > However, before doing so on my own, I guess it might make sense to think > of this as a general feature or what do you guys think? > > Best > > Daniel > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > > _______________________________________________ > Sardana-users mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/sardana-users > > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Sardana-users mailing list > Sar...@li... > https://lists.sourceforge.net/lists/listinfo/sardana-users > |