Skip to content

Commit

Permalink
Tao command name change: python -> pipe. (#1128)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidSagan authored Aug 8, 2024
1 parent 23356ab commit 8c48c7f
Show file tree
Hide file tree
Showing 67 changed files with 9,451 additions and 9,426 deletions.
31 changes: 15 additions & 16 deletions bmad-doc/tutorial_bmad_tao/doc/tutorial_bmad_tao.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4659,20 +4659,19 @@ \subsection{Exercises [Answers in Section \sref{s:ans.methods}]}
\label{s:python}
When there is a need to extract data from \tao for external processing, \tao has a command called
\vn{python} (not to be confused with the \vn{Python} program) which can be used to output data in a
\vn{pipe} which can be used to output data in a
form suitable for easy parsing. Additionally, there is a package called \vn{PyTao} which can be used
to interface \tao to \vn{Python}. The former is discussed in \Sref{s:python.cmd} and the latter is
to interface \tao to \vn{Python}. The former is discussed in \Sref{s:pipe.cmd} and the latter is
discussed in \Sref{s:pytao}.
%------------------------------------------------------------------------------
\subsection{Tao's Python Command}
\label{s:python.cmd}
\subsection{Tao's Pipe Command}
\label{s:pipe.cmd}
\tao's \vn{python} command is used to output data in a form that is suitable for easy parsing by an
external program. Despite its name, the output of the \vn{python} command is not \vn{Python} specific.
Example:
\tao's \vn{pipe} command is used to output data in a form that is suitable for easy parsing by an
external program. Example:
\begin{code}
Tao> python ring_general
Tao> pipe ring_general
\end{code}
This command is used with lattices with a closed geometry to output information on the lattice.
The output of this command looks like:
Expand All @@ -4689,16 +4688,16 @@ \subsection{Tao's Python Command}
\end{code}
The output here has some of the same information as the output of the \vn{show universe} command
except that it is easier to parse being comma delimited list. The other advantage of using the
\vn{python} command is that the output is generally stable over time as the \tao program is
developed to ensure that external code that interfaces to the \vn{python} command does not break.
\vn{pipe} command is that the output is generally stable over time as the \tao program is
developed to ensure that external code that interfaces to the \vn{pipe} command does not break.
This is in contrast to the \vn{show} command whose output is formatted to be human readable and whose
output format may change on a whim.
The general form of the \vn{python} command is:
The general form of the \vn{pipe} command is:
\begin{code}
python <subcommand> <arguments>
pipe <subcommand> <arguments>
\end{code}
The \vn{python} command has a number of \vn{subcommands} (over 100) that are listed in the \tao
The \vn{pipe} command has a number of \vn{subcommands} (over 100) that are listed in the \tao
manual. The sub-commands can be divided into two categories. One category are the ``\vn{action}''
subcommands which allow for control of \tao such as creating variables and data for use in an
optimization. The other category are the ``\vn{output}'' subcommands which output information from
Expand Down Expand Up @@ -4741,7 +4740,7 @@ \subsection{PyTao}
to
\begin{itemize}
\item
Parse \vn{python} command output into a \vn{Python} structure for easy access.
Parse \vn{pipe} command output into a \vn{Python} structure for easy access.
\item
Run \tao as a subprocess of \vn{Python}
\end{itemize}
Expand All @@ -4762,9 +4761,9 @@ \subsection{PyTao}
pip install PyTao
\end{code}
As an example of how \vn{PyTao} can parse the \vn{python} command output, run \tao with the commands
As an example of how \vn{PyTao} can parse the \vn{pipe} command output, run \tao with the commands
\begin{code}
Tao> python -write bmad_com.out bmad_com
Tao> pipe -write bmad_com.out bmad_com
max_aperture_limit;REAL;T; 1.00000000000000E+03
d_orb;REAL_ARR;T;1E-05;1E-05;1E-05;1E-05;1E-05;1E-05
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions regression_tests/pipe_test/tao.startup_shape
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pipe shape_pattern_manage 1^^new_pat^^1
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion regression_tests/python_test/tao.startup_shape

This file was deleted.

5 changes: 2 additions & 3 deletions tao/code/tao_c_interface_mod.f90
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
!+
! Module tao_c_interface_mod
!
! Module containing a set of routines primarily used to communicate with Python via ctypes.
! The python side code is in:
! tao/python/pytao/tao_ctypes/core.py
! Module containing a set of routines to interface with C.
! This is primarily used to communicate with Python via ctypes.
!-


Expand Down
4 changes: 2 additions & 2 deletions tao/code/tao_command.f90
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ subroutine tao_command (command_line, err_flag, err_is_fatal)
if (ds(id(4)+1:id(4)+1).ne.' ') go to 70000
id(1) = verify(ds(id(4)+1:),' ') + id(4)
end do
call tao_python_cmd(pipe_cmd)
call tao_pipe_cmd(pipe_cmd)
end block
return
70000 call out_io(s_error$, r_name, 'Correct form is "create data d2_name x[i:j] ..."')
Expand Down Expand Up @@ -466,7 +466,7 @@ subroutine tao_command (command_line, err_flag, err_is_fatal)

case ('pipe', 'python')

call tao_python_cmd (cmd_line)
call tao_pipe_cmd (cmd_line)
return

!--------------------------------
Expand Down
8 changes: 4 additions & 4 deletions tao/code/tao_help.f90
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ subroutine tao_help (what1, what2, lines, n_lines)
! This help system depends upon parsing one of three files:
! tao/doc/single-mode.tex
! tao/doc/command-list.tex
! tao/code/tao_python_cmd.f90
! tao/code/tao_pipe_cmd.f90
! The code here will look for the appropriate string (start_tag) that signals that
! the wanted documentation has been found.

Expand All @@ -44,8 +44,8 @@ subroutine tao_help (what1, what2, lines, n_lines)

pipe_search = .false.

if (index('python', trim(what1)) == 1 .and. what2 /= '') then
file_name = '$TAO_DIR/code/tao_python_cmd.f90'
if ((index('python', trim(what1)) == 1 .or. index('pipe', trim(what1)) == 1) .and. what2 /= '') then
file_name = '$TAO_DIR/code/tao_pipe_cmd.f90'
pipe_search = .true.
elseif (s%com%single_mode) then
file_name = '$TAO_DIR/doc/single-mode.tex'
Expand Down Expand Up @@ -75,7 +75,7 @@ subroutine tao_help (what1, what2, lines, n_lines)
return
endif

! Python search
! Pipe search

if (pipe_search) then
n = len_trim(start_tag)
Expand Down
6 changes: 6 additions & 0 deletions tao/code/tao_interface.f90
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,12 @@ subroutine tao_pick_universe (name_in, name_out, picked, err, ix_uni, explicit_u
logical, optional :: explicit_uni, pure_uni
end subroutine

subroutine tao_pipe_cmd (input_str)
import
implicit none
character(*) input_str
end subroutine

subroutine tao_place_cmd (where, who, no_buffer)
implicit none
character(*) who
Expand Down
Loading

0 comments on commit 8c48c7f

Please sign in to comment.