stda-1.3.1/0000755017777601777760000000000012375456063012303 5ustar nobodynogroupstda-1.3.1/Makefile0000644017777601777760000000700112375156234013736 0ustar nobodynogroup# # Makefile for STDA # PNAME = stda VERSION = VERSION DIR_SRC = src DOC_MAN = $(DIR_SRC)/$(PNAME).1 DOC_TEXT = $(DIR_SRC)/$(PNAME).txt PROGS = $(DIR_SRC)/maphimbu $(DIR_SRC)/mintegrate $(DIR_SRC)/mmval $(DIR_SRC)/nnum $(DIR_SRC)/muplot $(DIR_SRC)/prefield MAN_PAGES = $(DIR_SRC)/maphimbu.1 $(DIR_SRC)/mintegrate.1 $(DIR_SRC)/mmval.1 $(DIR_SRC)/nnum.1 $(DIR_SRC)/muplot.1 $(DIR_SRC)/prefield.1 # Installation directories (default) base = /usr/local bindir = $(base)/bin mandir = $(base)/man/man1 # Installation directories (Debian) bindeb = usr/bin mandeb = usr/share/man/man1 docdeb = usr/share/doc/$PNAME all: $(VERSION) manpages @echo Done. $(VERSION): expr `pwd` : ".*$(PNAME)-\([0-9\.]*\)" > $(VERSION) manpages: $(DOC_MAN) $(MAN_PAGES) $(PROGS) $(DOC_MAN): README show_package_desc.sh rm -f tar.stamp pname="`grep -iE ' \($(PNAME)\)' README |tr -s ' '`" ; \ help2man -N -n "$$pname" ./show_package_desc.sh \ |sed -e 's/\([( ]\)\\fB/\1/g;' > $@ %.1: % fname=`basename $<` ; \ pname="`$< -h |grep ^$$fname |cut -f2- -d:`" ; \ help2man -N -n "$$pname" $< \ |sed -e 's/\([( ]\)\\fB/\1/g; s/\([^\\]\)-/\1\\-/g; s/\([^\\]\)-/\1\\-/g;' \ > $<.1 ; \ rm -f tar.stamp update: cd $(DIR_SRC) && ls -1 \ |grep -v \.1$ \ |while read f; \ do diff -q ~/bin/$$f $$f >/dev/null || cp -p ~/bin/$$f .; \ done install: if [ -n "$(DESTDIR)" ] ; then \ DESTBIN=$(DESTDIR)/$(bindeb) ; \ DESTMAN=$(DESTDIR)/$(mandeb) ; \ else \ DESTBIN=$(bindir) ; \ DESTMAN=$(mandir) ; \ fi ; \ ./install.sh install --quiet --bin-dir=$$DESTBIN --man-dir=$$DESTMAN uninstall: if [ -n "$(DESTDIR)" ] ; then \ DESTBIN=$(DESTDIR)/$(bindeb) ; \ DESTMAN=$(DESTDIR)/$(mandeb) ; \ else \ DESTBIN=$(bindir) ; \ DESTMAN=$(mandir) ; \ fi ; \ ./install.sh uninstall --quiet --bin-dir=$$DESTBIN --man-dir=$$DESTMAN clean: rm -f $(DIR_SRC)/$(PNAME).1 $(MAN_PAGES) $(VERSION) tar.stamp tar: all tar.stamp tar.stamp: NEWS touch tar.stamp ; \ vers=`cat $(VERSION)` ; \ ups=`test -f debian/changelog && \ awk 'NR==3 {print $0}' debian/changelog | \ grep -i 'new upstream' >/dev/null 2>&1 && echo 0` ; \ exclude="--exclude=debian --exclude=*-stamp --exclude=*.stamp \ --exclude=.*.swp" ; \ GZIP=--best ; \ export GZIP ; \ cd .. && tar czpvf $(PNAME)-$$vers.tar.gz $(PNAME)-$$vers $$exclude ; \ if [ $$ups ]; then \ cp -p $(PNAME)-$$vers.tar.gz $(PNAME)_$$vers.orig.tar.gz ; \ fi tar-full: all vers=`cat $(VERSION)` ; \ dvers=`test -f debian/changelog && \ sed -n '1s/\(.*(\)\(.*\)\().*\)/\2/p' debian/changelog` ; \ exclude="--exclude=.*.swp" ; \ GZIP=--best ; \ export GZIP ; \ if [ $$dvers ]; then \ cd .. && \ tar czpvf $(PNAME)_$$dvers.full.tar.gz $(PNAME)-$$vers $$exclude ; \ fi debsrc: tar tar-full debuild -S packages: tar tar-full @( debuild && debuild clean && \ dvers=`test -f debian/changelog && \ sed -n '1s/\(.*(\)\(.*\)\().*\)/\2/p' debian/changelog` && \ echo "" && \ echo Trying to convert $(PNAME)_$${dvers}_all.deb to .rpm && \ su -c "umask 022 && alien -k -r ../$(PNAME)_$${dvers}_all.deb" && \ mv -f *.rpm .. ) sums: @vers=`cat $(VERSION)` ; \ dvers=`sed -n '1s/\(.*(\)\(.*\)\().*\)/\2/p' debian/changelog` ; \ cd .. && \ sha1sum $(PNAME)-$$vers.tar.gz $(PNAME)-$$dvers.noarch.rpm \ > $(PNAME)-$$vers.sha1 sig: @test ! -f debian/changelog && exit ; \ vers=`cat $(VERSION)` ; \ dvers=`sed -n '1s/\(.*(\)\(.*\)\().*\)/\2/p' debian/changelog` ; \ cd .. \ && gpg --armor --detach-sig $(PNAME)_$$vers.orig.tar.gz \ && cp -fp $(PNAME)_$$vers.orig.tar.gz.asc $(PNAME)-$$vers.tar.gz.asc stda-1.3.1/LICENCE0000644017777601777760000010451311260114236013255 0ustar nobodynogroup GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . stda-1.3.1/VERSION0000644017777601777760000000000612375455261013346 0ustar nobodynogroup1.3.1 stda-1.3.1/AUTHORS0000644017777601777760000000005511260114236013334 0ustar nobodynogroupDimitar Ivanov stda-1.3.1/install.sh0000755017777601777760000000551211260114237014275 0ustar nobodynogroup#!/bin/sh set -e # # Simple installer for stda # Author: Dimitar Ivanov # VER=1.2 PROG=stda [ x$BIN_DIR = x ] && BIN_DIR=/usr/local/bin [ x$MAN_DIR = x ] && MAN_DIR=/usr/local/man/man1 SRC_DIR=src UIDGID=0:0 BIN_FILES=`cd $SRC_DIR && ls -1 * |grep -v \.1` MAN_FILES=`cd $SRC_DIR && ls -1 * |grep \.1` || true ### Functions # Usage () { cat << ! Usage: $0 [OPTION]... < install | uninstall > Options: -b, --bin-dir= - Directory where to install the executables; Default is $BIN_DIR. -m, --man-dir= - Directory where to install the manual pages; Default is $MAN_DIR. -o, --owner= - Specify ownership for the installed files; This argument is ignored if you are not root. Default is $UIDGID. -q, --quiet - Don't ask any questions and run quietly -h, --help - Display this help ! } iamwho () { > /tmp/.$$ ls -al /tmp/.$$ |tr -s ' ' |cut -f3 -d' ' rm -f /tmp/.$$ } ### Process options and arguments # set -- `echo $* |tr '=' ' '` [ -z "$1" ] && set -- -h while [ $# -gt 0 ] do case $1 in -i|install) ALLED=installed CMD='install -d $1 && cp -f $2 $1' CHMOD=chmod CHOWN=chown ;; -u|uninstall) ALLED=uninstalled CMD='[ -f $1/$2 ] && rm $1/$2 || echo "No such file: $1/$2"' CHMOD=: CHOWN=: ;; -q|--quiet) QUIET=yes ;; -b|--bin-dir) BIN_DIR=$2 shift ;; -m|--man-dir) MAN_DIR=$2 shift ;; -o|--owner) UIDGID=$2 shift ;; *) Usage exit ;; esac shift done ### Do install/uninstall # [ $ALLED ] || { Usage ; exit ; } [ $QUIET ] || { echo "" echo " --- '$PROG' installer ---" echo "" echo "Following files will be $ALLED:" echo ========= [ -n "$BIN_FILES" ] && \ echo $BIN_FILES |tr ' ' '\n' |while read f; do echo $BIN_DIR/$f; done [ -n "$MAN_FILES" ] && \ echo $MAN_FILES |tr ' ' '\n' |while read f; do echo $MAN_DIR/$f; done echo "" echo "Go ahead [y/N]" read y if [ y$y != yy ]; then echo "Exiting now .." ; exit ; fi } # If not root, don't try to change ownership me=`iamwho` [ $me != root ] && CHOWN=: cd $SRC_DIR || exit 1 # Install/Uninstall some file for file in $BIN_FILES $MAN_FILES do if [ `expr $file : .*.1` -eq 0 ]; then set -- $BIN_DIR $file 755 else set -- $MAN_DIR $file 644 fi # copy or remove eval $CMD # change mode (skipped on uninstall) $CHMOD $3 $1/$2 # change owner (skipped on uninstall) $CHOWN $UIDGID $1/$2 done cd .. [ $QUIET ] || { echo "" echo "'$PROG' $ALLED successfully" echo "" } exit 0 stda-1.3.1/src/0000755017777601777760000000000012357527404013070 5ustar nobodynogroupstda-1.3.1/src/stda.10000644017777601777760000000521112375456063014106 0ustar nobodynogroup.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.45.1. .TH STDA "1" "August 2014" "stda 1.3.1" "User Commands" .SH NAME stda \- Simple Tools for Data Analysis (STDA) .SH DESCRIPTION STDA includes some primary tools for data analysis. You can evaluate sums, averages, integrals, derivatives, histograms or probability distribution functions of 1\-d data, and eventually plot the results. The programs are stand\-alone tools (supporting the standard UNIX input and output pipelines) intended for data processing from the command line. It should be noted that all but one of the scripts use awk and core system utilities. For plotting you have to install Gnuplot (see http://gnuplot.info) since 'muplot' is a wrapper around it. In summary, the package provides utilities for straightforward analysis of data series where a complex analytical approach is not needed and where an ultimate numerical precision with floating\-point numbers is not critical. Some general examples of application cases include evaluating usage statistics from server logfiles, determining a response time distribution from a series of queries to a [remote] service, producing a plot from multiple data files, etc. .PP This software should be considered as an open project to be extended with new command\-line driven utilities helpful for performing common data analysis tasks. Any contributions and suggestions are welcome. .PP Following programs are included in the distribution: .PP * maphimbu \- histogram builder for 1\-d numerical and text data .PP * mintegrate \- average/sum/integral/derivative of 1\-d numerical data .PP * mmval \- find minimum and maximum value in a dataset .PP * muplot \- plot a multi\-curve figure from multiple dataset using Gnuplot .PP * nnum \- produce a series of equally separated integers or floats .PP * prefield \- prepare input file for 'muplot' to plot 2\-d fields by arrows .SH EXAMPLES \- Evaluate the current apache2 logfile and make an unique list of the hostnames (respectively ip\-addresses) sorted by the total number of their http requests: .IP maphimbu \-rs2 /var/log/apache2/access.log .PP \- On a X terminal plot the probability function and the cumulative distribution function of a 'sin(x)' data sample: .IP nnum \-3.14159 3.14159 0.00001 "sin(x)" "%.17f %.7f" | maphimbu \-d0.01 \-x1 \-ns1 | mintegrate \-d0.01 \-x1 \-y3 \-S | muplot lp \- 1:3,4 .SH COPYRIGHT Copyright \(co 2009, 2011\-2014 Dimitar Ivanov .PP License: GNU GPL version 3 or later .br This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. stda-1.3.1/src/prefield.10000644017777601777760000000220712357527404014745 0ustar nobodynogroup.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.45.1. .TH PREFIELD "1" "July 2014" "prefield 1.4.8" "User Commands" .SH NAME prefield \- prepare input file for 'muplot' to plot 2\-d fields by arrows .SH SYNOPSIS .B prefield \fI\, x y F_x F_y\/\fR .SH DESCRIPTION prefield will prepare input file for 'muplot' to plot 2\-d fields by arrows .PP Example: .PP On running "prefield test.dat 20 1 2 5 6" the source file 'test.dat' will be read, and a field\-data file will be produced with the 1st and 2nd columns being the x and y space\-positions like in the source file, whereas the fields F_x and F_y are calculated from the values in the 5th and 6th columns of the source data multiplied by the second command line option, which means in this example a 20\-fold magnification. .PP Use '\-' as file name to read from and write to . .SH COPYRIGHT Copyright \(co 1997, 2001, 2005, 2007, 2009, 2011\-2012 Dimitar Ivanov .PP License: GNU GPL version 3 or later .br This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. stda-1.3.1/src/maphimbu0000744017777601777760000002555312236223506014620 0ustar nobodynogroup#!/bin/sh VERSION=2.10.1 LICENSE="Copyright (C) 2003-2007, 2009, 2011-2013 Dimitar Ivanov License: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law." ################################################################################ # # maphimbu - all purpose histogram builder for numerical and text data in 1-d # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # ################################################################################ # MYNAME=`basename $0` DX=0 XAX=1 YAX=2 CX=0 SU=0 MV=0 PFORM="%d" SORT=cat SORT_OPT="-" RC=0 ### We need an AWK supporting assignments exec 3>&2 2>&- for a in gawk nawk awk do [ "`echo |$a -v a=a '{}' 2>&1`" = "" ] && AWK=$a done exec 2>&3 [ "x$AWK" = x ] && \ echo "Error: can't find 'awk' supporting assignments" && \ exit 2 ### Do sort correctly any data including numbers # _sort_data_on_demand_() { if [ x$SORT_SEP = x ]; then $SORT $SORT_OPT else # Prepare the data in order to sort correctly floats, then do sort, # and finally remove the first column used for numerical sorting $AWK "{ printf(\"%.16f $SORT_SEP%s\n\", \$$1, \$0) }" \ | $SORT $SORT_OPT \ | cut -d$SORT_SEP -f2- fi } _acc_result_() { [ $ACC_PROG ] || { cat ; return 0; } $ACC_PROG -S -y $ACC_COL } ### Show usage # show_usage() { d=$2 sep=`echo |awk '{printf( "%080s", 0 )}' |tr 0 "$2"` cat << !EOH $sep $1 $sep Usage: $MYNAME [OPTION]... [FILE] Options: -x $d x-data column (default is $XAX) -y $d y-data column (default is $YAX); It is considered only when combined with '-m' or '-S' -d $d delta size (dx-resolution) in case of numerical data; Keep in mind that 2 is not the same as 2.0: in the first case the numbers are treated as integers, in the latter as floats. -n $d normalize the result A) non-numerical data: n(x) = counts(x)/sum_of_counts B) numerical data: the normalized probability density func. is P(-INF < x $d sort output using the specified column; Header is skipped in this case. -g $d sort output numerically using the specified column; Header is skipped in this case. -r $d do reverse sorting (in combination with '-g' and '-s') -C $d center histogram bins (shifts x-axis by 0.5*dx) -X $d treat hole line as one string (single data record) -H $d print a data description header -V $d print program version and exit --version $d output version and copyright information --help $d display help -h $d display short help (options summary) Note: this program is not intended for use in high order numerical computations. Report bugs to !EOH } ### Show version # show_version() { cat << !ver $MYNAME $VERSION $LICENSE !ver } [ "$1" = "--version" ] && show_version && exit [ "$1" = "--help" ] && show_usage "This program produces 1-d histograms from numerical or text data input. It can be also used to estimate the probability distribution function of a numerical variable - see http://en.wikipedia.org/wiki/Probability_density_function." " " && exit ################################################################################ # # MAIN # opts="aChHnNUmd:x:Xy:Vrs:g:S" opts=`getopt $opts $*` || { opts="-h"; RC=1; } set -- $opts while [ $# -gt 0 ] do case $1 in -h) show_usage "$MYNAME $VERSION: histogram builder for 1-d numerical and text data" "-" |egrep "^($MYNAME|Usage:|Options:|Note:|\ *-)" exit $RC ;; -d) DX=$2 # Try to find out the floating point separator FSEP="`echo $DX |tr -d '[0-9]'`" [ -n "$FSEP" ] && FLOAT="0${FSEP}5" shift 2 ;; -n) NORM=1 UN_HEAD="NORMALIZED_COUNTS" ACC_COL=3 shift 1 ;; -N) NORM=2 UN_HEAD="NORMALIZED_COUNTS" ACC_COL=3 shift 1 ;; -U) NORM=3 UN_HEAD="UNIT_X dx=%-.5g UNIT_COUNTS" shift 1 ;; -a) [ $ACC_COL ] || ACC_COL=2 ACC_PROG=mintegrate which $ACC_PROG 2>&1 |grep -q "^\/" \ || { echo "Error: can't find program '$ACC_PROG' in PATH" exit 3 } shift 1 ;; -x) XAX=$2 shift 2 ;; -X) XAX=0 shift 1 ;; -y) YAX=$2 shift 2 ;; -m) MV=1 MV_HEAD=" Y_MEAN_VALUE Y_STD_DEV" shift 1 ;; -S) SU=1 MV_HEAD=" Y_SUM NORMALIZED_Y_SUM" shift 1 ;; -g) SORT=sort SORT_OPT="-nk1 $SORT_OPT" SORT_COL="$2" SORT_SEP=: shift 2 ;; -s) SORT=sort SORT_OPT="-nk$2 $SORT_OPT" shift 2 ;; -r) SORT=sort SORT_OPT="-r $SORT_OPT" shift 1 ;; -C) CX=0.5 shift 1 ;; -H) HEAD=1 shift 1 ;; -V) echo $VERSION exit ;; --) shift 1 break ;; esac done # Remove header if sorting requested [ $SORT != cat ] && { HEAD= ; UN_HEAD= ; MV_HEAD= ; } ### MAIN ### # cat $1 |$AWK -v dx=$DX -v x=$XAX -v y=$YAX -v cx=$CX -v su=$SU -v mv=$MV \ -v head=$HEAD -v unhead="$UN_HEAD" -v mvhead="$MV_HEAD" \ -v norm=$NORM -v float=$FLOAT \ 'BEGIN \ { CONVFMT = "%.17g" OFMT = "%.17g" if( dx != 0 ) { one_dx=1/dx } else { one_dx=1 } } { bin=$x if( dx != 0 ) { # Round up for negative and positive numbers is different if( bin >= 0 ) half=+float else half=-float # Round up and take the integer part bin=sprintf( "%d", (bin*one_dx)+half ) # Multiplication by 1 is necessary to attain '-0' to be simply '0' bin=1*bin } hits[bin]++ if( hits[bin] == 1 ) { nrh++; name[nrh]=bin } # Mean values or y-sums if( mv || su ) { ysum[bin]+=$y ; ysum2[bin]+=($y*$y) ; ysumT+=$y } # Check for min and max x-value if normalization chosen: # min and max are INTEGERS if dx!=0 if( norm ) { if( ! counts ) { max=min=bin } if( bin > max ) { max=bin } else if( bin < min ) { min=bin } } counts++ } END \ { if( !counts ) exit # On request normalize only against the number of counts - ignore dx! if( norm == 2 ) { one_dx=1 } one_sum=one_dx/counts if( mv || su ) { one_ysumT=one_dx/ysumT } # Calculate the width of the histogram (x-range) if( norm == 3 ) { if( dx == 0 ) { dxl=1 } else { dxl=dx } x0=min*dxl # Found out the width of the x-range xrange=(max-min)*dxl if( xrange == 0 ) xrange=1 one_xrange=1/xrange # Now rescale dxl by the x-data width dxl=dxl*one_xrange # Rescale also one_sum=1/dx/counts one_sum=one_sum*xrange # Evaluated the header to print out the rescaled dx unhead = sprintf( unhead, dxl ); } # Print data header if( head ) { if( unhead != "" ) printf("#%17s %15s %17s%24s\n", "X", "COUNTS", unhead, mvhead) else printf("#%17s %15s %24s\n", "X", "COUNTS", mvhead) } # Main data loop while( nrh > 0 ) { x_i=bin=name[nrh] # Shift x (possible only with numerical data) if( cx ) { x_i=sprintf( "%15.15g", bin+cx ) } # Normalize for dx!=0 if( dx != 0 ) { x_val=sprintf( "%15.15g", x_i*dx ) } else { x_val=x_i } # Print x-value and its count printf( "%18s %15d", x_val, hits[bin] ) # Print normalized x-value as mapped in the [0-1] range if( norm == 3 ) { printf( " %15.15f", (x_val-x0)*one_xrange ) } # Print an additional column with normalized histogram data if( norm ) { printf( " %15.15f", hits[bin]*one_sum ) } # Compute averages/sums and print additional columns if( mv || su ) { if( mv ) { # Mean value of the y-variable: the used computation # method can introduce large round-off errors mean=ysum[bin]/hits[bin] mean2=mean*mean sigma2=ysum2[bin]/hits[bin]-mean2 sigma=sqrt(sigma2) } else { # Normalized sum of y-values mean=ysum[bin] sigma=one_ysumT*mean } printf( " %15.15g %g", mean, sigma ) } printf("\n") nrh-- } }' | _sort_data_on_demand_ $SORT_COL | _acc_result_ exit 0 stda-1.3.1/src/nnum.10000644017777601777760000000167012357527403014132 0ustar nobodynogroup.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.45.1. .TH NNUM "1" "July 2014" "nnum 2.2.2" "User Commands" .SH NAME nnum \- print a series of integers, floats, or function values .SH SYNOPSIS .B nnum \fI\, \/\fR[\fI\,\/\fR] [\fI\,\/\fR] [\fI\,\/\fR] .br .B nnum \fI\,\/\fR .SH DESCRIPTION nnum produces a series of integers, floats, or function values .SH EXAMPLES .IP a) nnum 100 .IP b) nnum 10 1 \-1 .IP c) nnum 1 10 0.1 x "N=%05.2f" .IP d) nnum \-3.14 3.14 0.01 "sin(x)" "sin(x)=%f at x=%f" .IP e) nnum \-3.14 3.14 0.01 "cos(x*x)" "%g %g" .PP Remark: an user\-defined function should have syntax conforming to 'awk'. .SH COPYRIGHT Copyright \(co 2006, 2007, 2009, 2011\-2013 Dimitar Ivanov .PP License: GNU GPL version 3 or later .br This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. stda-1.3.1/src/maphimbu.10000644017777601777760000000550512357527403014760 0ustar nobodynogroup.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.45.1. .TH MAPHIMBU "1" "July 2014" "maphimbu 2.10.1" "User Commands" .SH NAME maphimbu \- histogram builder for 1\-d numerical and text data .SH SYNOPSIS .B maphimbu [\fI\,OPTION\/\fR]... [\fI\,FILE\/\fR] .SH DESCRIPTION This program produces 1\-d histograms from numerical or text data input. It can be also used to estimate the probability distribution function of a numerical variable \- see http://en.wikipedia.org/wiki/Probability_density_function. .SH OPTIONS .TP \fB\-x\fR x\-data column (default is 1) .TP \fB\-y\fR y\-data column (default is 2); It is considered only when combined with '\-m' or '\-S' .TP \fB\-d\fR delta size (dx\-resolution) in case of numerical data; Keep in mind that 2 is not the same as 2.0: in the first case the numbers are treated as integers, in the latter as floats. .TP \fB\-n\fR normalize the result A) non\-numerical data: n(x) = counts(x)/sum_of_counts B) numerical data: the normalized probability density func. .TP is P(\-INF\fR < x sort output using the specified column; Header is skipped in this case. .TP \fB\-g\fR sort output numerically using the specified column; Header is skipped in this case. .TP \fB\-r\fR do reverse sorting (in combination with '\-g' and '\-s') .TP \fB\-C\fR center histogram bins (shifts x\-axis by 0.5*dx) .TP \fB\-X\fR treat hole line as one string (single data record) .TP \fB\-H\fR print a data description header .TP \fB\-V\fR print program version and exit .TP \fB\-\-version\fR output version and copyright information .TP \fB\-\-help\fR display help .TP \fB\-h\fR display short help (options summary) .PP Note: this program is not intended for use in high order numerical computations. .SH "REPORTING BUGS" Report bugs to .SH COPYRIGHT Copyright \(co 2003\-2007, 2009, 2011\-2013 Dimitar Ivanov .PP License: GNU GPL version 3 or later .br This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. stda-1.3.1/src/mmval.10000644017777601777760000000170612357527403014271 0ustar nobodynogroup.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.45.1. .TH MMVAL "1" "July 2014" "mmval 1.3.1" "User Commands" .SH NAME mmval \- find minimum and maximum value in a data set .SH SYNOPSIS .B mmval [\fI\,OPTION\/\fR]... [\fI\,FILE\/\fR] .SH DESCRIPTION mmval determines minimum and maximum values of data .SH OPTIONS .HP \fB\-m\fR \- find the maximum value .HP \fB\-M\fR \- find the minimum value .HP \fB\-n\fR \- prefix the output with the line number within its input .HP \fB\-c\fR \- consider the data in the specified column of the input .HP \fB\-v\fR \- print program version and copyright message, then exit .HP \fB\-h\fR \- display this help and exit .SH COPYRIGHT Copyright \(co 2009, 2012\-2013 Dimitar Ivanov .PP License: GNU GPL version 3 or later .br This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. stda-1.3.1/src/mintegrate0000744017777601777760000003767112344107171015160 0ustar nobodynogroup#!/bin/sh version=2.4.1 license="Copyright (C) 1997, 2001, 2006-2007, 2009, 2011-2014 Dimitar Ivanov License: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law." #set -vx ################################################################################ # # mintegrate - compute integral or derivative of 1-d numerical data using awk # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # ################################################################################ xc=1 # x column yc=1 # f(x) column: default is to compute the sum of the 1 column dx=1.0 # x delta interval x0=00; x1=00 # x data range pr_digits="%.10g" # Print format of the result data ################################################################################ ### Procedure for testing that program is working correctly # test_myself_functional () { LC_ALL=C export LC_ALL IFS=";" grep "^_TEST_CASE_" $0 \ | while read test do set -- $test result=`\ sed -n '/^#_DATA_START_/,/^#_DATA_END_/p' $0 \ |grep -v '#' |eval $0 $3 |tr -d ' ' ` expected="`echo $4 |tr -d ' '`" [ "$result" = "$expected" ] && status=ok || status=failed echo Testing $2 \: $status done } ### Get options function # getoptions() { opts=$1 shift getopt_rc=0 getopt=`which getopt 2>&1| grep "^/"` if [ $getopt ]; then options=`$getopt $opts $*` || { options="-h"; getopt_rc=1; } else # build-in function options= while getopts $opts Option do [ $Option != '?' ] || { Option=h; getopt_rc=1; } options="$options -$Option $OPTARG" done shift `expr $OPTIND - 1` options="$options -- $*" fi echo $options return $getopt_rc } # To create a man page try: # mintegrate --help |sed -ne "s/Usage:/[SYNOPSIS]\n/;s/mintegrate/\nmintegrate/g;/SYNOPSIS/,/Options:/p" |grep -v Options: > /tmp/synopsis.txt ; help2man -N -n "`mintegrate -h |grep ^mintegrate |cut -f2- -d:`" mintegrate -I /tmp/synopsis.txt |sed 's/ \\fB/ /g' |man -l - separator=`echo |awk '{printf( "%080d", 0 )}' |tr 0 -` ### Print usage # _print_usage_ () { cat << HELP $separator $1 $separator Usage: $progname [OPTION]... [FILE] Options: -a $2 compute mean value (arithmetic average) and standard deviation -c $2 compute integral on closed x-data interval; In case that dx is not specified by the '-d' flag, the data are supposed to be from an irregular x-grid, and dx is computed separately for every x-interval. The integral is computed by the trapezoidal rule. -d $2 compute integral on open x-data interval with the specified dx; Can be used also in combination with '-D' and '-c'. -D $2 compute difference btw. numbers or derivative of the y-data; In the default scenario where x- and y-data column are same, the difference btw. the current and the previous data value will be output. In this case when '-d' is defined as 0, the x-data value will be print out in front of the calculated difference. If x-and the y-column are different and if the x-data resolution is not defined or it is !=0, then the derivative of the y-data is calculated. When the x-data resolution is constant, specify it explicitly by '-d' to achieve a higher numerical precision by a 'leapfrog' algorithm. -x $2 x-data column (default is $xc). If 0, the x-range is an index; -y $2 y-data column, where y=f(x) (default is $yc) -r x_0:x_1 $2 x-data range to consider -s $2 print out accumulated y_i sums: x_i versus accumulated f(x_i); In the case of a closed integral you have to specify also the x-data resolution dx (see '-d' above). -S $2 compute the accumulated y_i-sums and add it to the output -p $2 print format of the result ("$pr_digits" is default) -t $2 output text in front of the result (invalid with '-s' or '-S'); A blank can be printed by using a double underscore character -F $2 sets the field separator (default is a single space character) '__'. -T $2 run a self-test that the program is working correctly -V $2 print version number --version $2 output version and license message --help|-H $2 display help -h $2 display short help (options summary) If none of the options '-a', '-D', '-d', or '-c' is used, then the sum of the provided data will be computed. Empty lines or lines starting with '#' are skipped. This program is perfectly suitable as a basic tool for initial data analysis and will meet the expected accuracy of a numerical solution for the most demanding computer users and professionals. Yet be aware that, although the computations are carried with double floating precision, the computational techniques used for evaluating an integral or a standard deviation are analytically low-order approximations, and thus not intended to be used for numerical computations in engineering or mathematical sciences for cases where an ultimate numerical precision is a must. For deeper understanding of the topic see http://en.wikipedia.org/wiki/Numerical_analysis. HELP } ### Print only version number # _print_version_ () { cat << !VERSION $progname $version $license !VERSION } ################################################################################ # # MAIN # progname=`basename $0` case $1 in --help|-H) separator="" _print_usage_ "$progname is a program to compute averages, sums, integrals or derivatives of numerical 1-d data in situations where ultimate numerical precision is not needed." " " exit ;; --version) _print_version_ exit ;; esac # # Find proper awk flavor # if [ x"$AWK" = x ]; then exec 3>&2 2>&- for a in gawk nawk awk do [ "`echo |$a -v a=a '{}' 2>&1`" = "" ] && AWK=$a done exec 2>&3 fi [ x"$AWK" = x ] && \ echo "Error: can't find 'awk' supporting assignments" && \ exit 2 # # Process cmd-line options # gops="VhDd:x:r:y:sSt:Tcap:F:" options=`getoptions $gops $*` && urc=0 || urc=1 set -- $options while [ $# -gt 0 ] do case $1 in -h ) _print_usage_ "$progname ${version}: evaluate average/sum/integral/derivative of 1-d numerical data" "-" \ |egrep "^($progname|Usage:|Options:|\ *-)" exit $urc ;; -d ) dx=$2 dx_defined=1 shift ;; -D ) derivat=1 closed=1 ;; -c ) closed=1 ;; -a ) dx=0 average=1 ;; -y ) yc=$2 shift ;; -x ) xc=$2 shift ;; -r ) x0=`echo $2 |cut -f1 -d:` x1=`echo $2 |cut -f2 -d:` data_range=1 shift ;; -p ) pr_digits=$2 shift ;; -s ) accu_sum=1 ;; -S ) accu_sum=2 ;; -t ) text=$2 text=`echo $text |sed "s/__/ /g"` shift ;; -F ) data_FS="$2" shift ;; -T ) test_myself_functional exit ;; -V ) echo $version exit ;; -- ) shift break ;; esac shift done ################################################################################ # # MAIN # cat $1 |$AWK -v FS="$data_FS" \ -v dx=$dx -v dx_defined=$dx_defined -v data_range=$data_range \ -v yc=$yc -v xc=$xc -v x0=$x0 -v x1=$x1 -v text="$text" \ -v pr_digits=$pr_digits -v accu_sum=$accu_sum \ -v closed=$closed -v average=$average -v derivat=$derivat \ 'BEGIN \ { if( FS == "" ) FS=" " # Specify awk-accuracy of the conversion and printing format for numbers CONVFMT = "%.17g" OFMT = "%.17g" # User specified format for the print out of the result if( pr_digits ) pd = pr_digits; else pd = OFMT; sum=0; sum1=0; sum2=0; I=0; i=0; closed_values_read=0; if( x0 != "00" && x1 != "00" ) range_defined=1; else consider_data=1; } # # Functions # function _derivat_method_find_out_() { if ( range_defined && x_i > x_value_first ) start_index = 1; else start_index = 2; if( xc == yc ) { if( ! dx_defined ) derivat_y_only = 1; if( dx_defined && dx == 0 ) derivat_x_and_y = 1; } if( xc != yc ) { if( dx_defined && dx == 0 ) derivat_x_and_y = 1; # Use leapfrog method dx_i = [ y_(i+1) - y_(i-1) ] / [ 2*dx ] if( dx_defined && dx != 1.0 ) derivat_dx_const = 1; if( ! dx_defined ) derivat_dx_var = 1; } if( dx ) one_two_dx = 0.5 / dx; } function _x_y_save_first_and_last_values_() { if( ! x_value_first ) x_value_first = x_i; else x_value_last = x_i; if( y_i_save_current ) { y_i_save_current = 0; y_i2 = y_i; } } function _derivat_save_cur_prev_values_() { dx_i1 = dx; x_i0 = x_i1; y_i0 = y_i1; x_i1 = x_i; y_i1 = y_i; y_i2 = y_i; } function _print_x_y_( x, y ) { printf( "%s "pd"\n", x, y ); } function _print_y_( y ) { printf( pd"\n", y ); } function _calculate_current_dx_( x1, x0 ) { _dx = x1 - x0; if( _dx < 0.0 ) _dx = -_dx; return _dx; } # # Main loop: skip empty lines or comments # $0 !~ /^ *#/ && $0 !~ /^ *$/\ { # In case x-data column = 0, then index is used if( xc ) { x_i = $xc; } else { I++; x_i = I; } y_i = $yc; _x_y_save_first_and_last_values_(); if( range_defined && x_i <= x1 && x_i >= x0 ) consider_data=1; if( closed && ! dx_defined ) dx = _calculate_current_dx_( x_i, x_i1 ); # If x-data are in the specified range if( consider_data ) { i++; # Integral / Sum sum += y_i; # sum2 is used for computing the standard deviation if( average ) sum2 += y_i * y_i; # Integral or derivative over closed interval: # irregular grid sampling allowed if( closed ) { if( derivat ) { if( closed_values_read == 0 ) _derivat_method_find_out_(); if( closed_values_read == start_index && ! range_defined ) { if( derivat_y_only ) { _print_y_( y_i1 - y_i0 ); } else if( derivat_x_and_y ) { # The difference at the first x-data point # is defined as 'zero' _print_x_y_( x_i0, "0" ); } else { # Print out the derivative value at the first x-data # point: use the same linear extrapolation backwards # in both cases "derivat_dx_var" and # "derivat_dx_const" dy_i1 = (y_i1 - y_i0) / dx_i1; dy_i = (y_i - y_i1) / dx; slope = (dy_i - dy_i1) / dx_i1; _print_x_y_( x_i0, dy_i1 - (slope * dx_i1) ); } } if( closed_values_read >= start_index ) { if( derivat_y_only ) _print_y_( y_i - y_i1 ); # For all other print out the value at # previous x-data point else if( derivat_x_and_y ) _print_x_y_( x_i1, y_i1 - y_i0 ); else if( derivat_dx_const ) _print_x_y_( x_i1, (y_i - y_i0) * one_two_dx ); else _print_x_y_( x_i1, (y_i1 - y_i0) / dx_i1 ); } } else if ( closed_values_read > 0 ) { if( ! dx_defined || accu_sum ) sum1 += (y_i + y_i1) * dx; else sum1 += (y_i + y_i1); } closed_values_read++; } # Accumulated values if( accu_sum ) { if( accu_sum < 2 && xc != 0 ) printf( "%s%s", $xc, FS ); # x else if( I ) printf( "%s%s", I, FS ); # index else printf( "%s%s", $0, FS ); # line if( closed ) printf( pd"\n", sum1 * 0.5 ); else printf( pd"\n", sum * dx ); } } if( closed ) { if( range_defined && x_i > x1 ) next; if( range_defined && x_i == x1 ) y_i_save_current = 1; # Save current and previous values used for integral or derivative _derivat_save_cur_prev_values_(); } if( range_defined ) consider_data=0; } END \ { if( i < 1 ) { print "(awk) Error: no data to process" exit 7; } if( derivat ) { if( derivat_y_only ) { # For the special case of computing differences where only two # data points are available if( i == 2 && ! data_range ) print x_i1 - x_i0 exit } if( derivat_x_and_y ) { _print_x_y_( x_i1, y_i1 - y_i0 ); } else if( derivat_dx_const && range_defined && x_i1 < x_value_last ) { _print_x_y_( x_i1, (y_i2 - y_i0) * one_two_dx ); } else { # Print out the derivative value at the last x-data point: # the same value in both cases "derivat_dx_var" and # "derivat_dx_const" _print_x_y_( x_i1, (y_i1 - y_i0) / dx_i1 ); } exit; } if( accu_sum ) exit; if( text ) printf( "%s", text ); if( average ) { if( i > 1 ) { dx=1/i; # Variance = [ Sum(y_i^2) - N*(y_i_mean)^2 ] / (N-1) # This formula magnifies roundoff errors significantly, but # it is an one-pass algorithm. sum2 = ( sum2 - dx * sum*sum ) / ( i - 1 ); sum2 = sqrt( sum2 ); sum = sum * dx; } else { sum2 = 0; } # Mean value and standard deviation printf( pd"%s+/-%s"pd"\n", sum, FS, FS, sum2 ); } else { # Integral (closed) - trapezoidal rule if( dx_defined && ! accu_sum ) sum1 = sum1 * dx; if( closed ) printf( pd"\n", sum1 * 0.5 ); # Integral (open) / Sum else printf( pd"\n", sum * dx ); } }' exit $? # In order to satisfy 'sh -n', the whole test suit is put in a variable Data_and_Tests=" #_DATA_START_ -1 101083 1.01083 -0.9 75518 0.75518 -0.8 53452 0.53452 -0.7 44716 0.44716 -0.6 39858 0.39858 -0.5 36796 0.36796 -0.4 34758 0.34758 -0.3 33388 0.33388 -0.2 32504 0.32504 -0.1 32004 0.32004 0 31846 0.31846 0.1 32004 0.32004 0.2 32504 0.32504 0.3 33388 0.33388 0.4 34758 0.34758 0.5 36796 0.36796 0.6 39858 0.39858 0.7 44716 0.44716 0.8 53452 0.53452 0.9 75518 0.75518 1 101083 1.01083 #_DATA_END_ _TEST_CASE_a ;arithmetic average; -a ; 0 +/- 0.6204836823 _TEST_CASE_b ;sum ; -y3 ; 10 _TEST_CASE_c ;integral (range) ; -x1 -y2 -r 0.3:0.9 ; 318486 _TEST_CASE_d ;integral (closed) ; -p %.12g -c -d 0.1 -x1 -y3 ; 0.898917 _TEST_CASE_e ;derivative ; -D -d 0.1 -y2 |$0 -y2 ; -34990 _TEST_CASE_f ;derivative (range); -D -d 0.1 -y2 -r -0.5:0.6 |$0 -y2 ; 39600 _TEST_CASE_g ;difference ; -D -x2 -y2 |$0 ; 0 _TEST_CASE_h ;difference (x,y) ; -D -d 0 -r 0:1 -y2 |$0 ; 5.5 _TEST_CASE_i ;difference (2 pts); -D -x1 -y2 -r-0.6:-0.5 |$0 -D -x2 -y2 ; 17960 _TEST_CASE_j ;accumulate (range); -S -y3 -r -0.5:0.6 |$0 -y4 ; 26.3508 " stda-1.3.1/src/muplot0000744017777601777760000006336412352314717014344 0ustar nobodynogroup#!/bin/sh version=5.6.2 license="Copyright (C) 1996-2009, 2011-2014 Dimitar Ivanov License: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law." #set -vx ################################################################################ # # muplot - gnuplot-wrapper for non-interactive plotting of multiple data files # # This program allows multiple data files to be viewed or printed by 'gnuplot' # on a single multi-curve plot. # ################################################################################ # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # ################################################################################ # # Variables # progname=`basename $0` cmdstr="$progname $*" bfname="$progname" # Default output-base-file-name set_file=".${progname}set" # External file with gnuplot commands comm_file="$set_file" comm_file_ignore="$comm_file.noglobal" # Ignore global command file if touched gdevice_def=x11 # Output graphics device (default X11) gdevice="$gdevice_def" # Init Output graphics device gstyle=linespoints # Plot style (default lines and points) out_form="unknown" # PS, PNG, JPG ok - for PDF see help pscolor=color # PS/PDF color psfont="'Times-Roman' 18" # PS font type + size pdfsize="size 29.7cm,21cm" # PDF plot size (a4 landscape) pdffont="font 'Arial,14'" # PDF font + size stdout=no # Do not send PS file to stdout quiet=no # Don't suppress info messages opt_landscape="" # Landscape option for a plot viewer file_list_sort=yes # Sort the list of files reload_data=disabled # Reload data flag for quasi real-time reload_conf="8640:10" # Default data reload config values ################################################################################ # # Functions # ### Define names of temporary/working files # _define_output_tmpfile_names_() { [ $MUPLOT_DIR_TMP ] || MUPLOT_DIR_TMP=. tmpfile="$MUPLOT_DIR_TMP/$progname.$$" # Temporary work file tmpstdin="$tmpfile.stdin" # Temporary stdin gpout="$tmpfile.gpt" # Temporary gnuplot-script output file gperr="$tmpfile.err" # Temporary gnuplot-script error file gpsty="$tmpfile.sty" # Temporary gnuplot-script style file } ### Read gnuplot commands from file # _gnuplot_commands_read_file_() { test ! -f "$comm_file_ignore" \ && _guplot_command_print_blocks_ $1 "$HOME/$2" "$3" test "`pwd`" != "$HOME" \ && test "$ignore_local_comm" != "yes" \ && _guplot_command_print_blocks_ $1 "$2" "$3" } ### Read external file with gnuplot commands and print out used blocks # _guplot_command_print_blocks_() { _mode=$1 ; _comm_file="$2" ; _out_file="$3" ; if [ -f $_comm_file ]; then if [ $_mode -gt 0 ]; then cat "$_comm_file" |sed -n '/^#BEGIN/,/^#END/!p' elif [ -n "`grep '^#BEGIN' $comm_file`" ]; then # print everything btw. BEGIN and END echo "set out $_out_file" cat "$_comm_file" |sed -n '/^#BEGIN/,/^#END/p' echo "replot" fi fi } ### Prepare list of files to be plotted # _prepare_list_of_files_to_plot_() { test -z "$1" && return 1 # Last sanity check of the cmdline file-list string syntax: if [ "`echo $1 |sed 's/^-..*/BAD/'`" = BAD ]; then echo "Error: your file name can't start with '-'" _clean_up_ 9 fi # If input is not defined as the stdin, then evaluate file list if [ "x$1" = "x-" ]; then files_data="-" LIST_FILES="ls -1 $tmpstdin" elif [ $file_list_sort = yes ]; then files_data=`eval ls "$1"` || _clean_up_ 10 else files_data="$1" fi # If a single file, then basename is defined using it if [ `ls -1 "$files_data" 2>/dev/null |wc -l` -eq 1 ]; then LIST_FILES="echo $files_data" # Define bfname only once if [ x$list_nr = x ]; then bfname="$files_data" # Remove extension from name bfname=`$LIST_FILES |sed "s/\.[^\.]*$//"` fi elif [ "x$files_data" != "x-" ]; then LIST_FILES="_do_echo_file_name_from_list_ $files_data" fi list_nr=`expr $list_nr + 1` if [ "$files_data" = "-" -a $reload_data = "enabled" ]; then echo "Error: not possible to plot data from when using '-r'" _clean_up_ 15 fi return 0 } ### Just print each file name from in the list of files # _do_echo_file_name_from_list_() { for f in $*; do echo $f; done } ### Define output file names # _define_output_file_names_() { _ofname="$1" [ "x$_ofname" != x ] && bfname="$_ofname" if [ $out_form != "unknown" ]; then ofile="$bfname.$out_form" # Output file name ofile_nstr="'$bfname.$out_form'" # Gnuplot file name string fi if [ $stdout = yes ]; then bfname=$tmpfile # Write to STDOUT - use tmp file ofile="$bfname.ps" ofile_nstr="'$bfname.ps'" fi } ### Define output driver # _define_output_driver_() { case $1 in ps) gdevice="postscript enh landscape $pscolor $psfont" # Define DIN A4 ratio of the plot relative to the canvas size echo "set size ratio 0.71" ;; png) gdevice="png notransparent $termopt" ;; jpg) gdevice="jpeg $termopt" ;; pdf) gdevice="pdfcairo $pscolor $pdffont $pdfsize" ;; *) [ "$gdevice" ] && gdevice="$gdevice_def" ;; esac } ### Determine the plot style # _define_plot_style_() { _files_data="$1" ; shift while [ 1 ]; do case $1 in g) gstyle=lines echo "set grid" ;; d) gstyle=dots ;; p) gstyle=points ;; l) gstyle=lines ;; lp) gstyle=linespoints ;; nn) gstyle="points pt %d" ;; pp) gstyle="points pt 6" ;; b) gstyle=boxes ;; e) gstyle=errorlines sample=1:2:3 ;; a) gstyle=dots # In this case $files_data must be set before further processing [ -z "$_files_data" ] \ && _prepare_list_of_files_to_plot_ "$2" bfname files_data if [ "x$files_data" != "x-" ]; then # Input from file(s) cut -f3- $files_data # Data by 'prefield' - delimiter is a TAB else # Make a copy of stdin tee $tmpstdin |cut -f3- fi ;; nk) echo "unset key" ;; s=*) echo "set `echo $1 |cut -f2- -d=`" ;; u=*) gstyle="`echo $1 |cut -f2- -d=`" ;; dt=*) test -z "$gstyle" && gstyle=linespoints # Format in case of date/time data if [ x"`echo $1 |grep 'dt='`" != x ]; then echo "set xdata time" fmt="`echo $1 |cut -f2 -d= |cut -f1 -d@`" fmtx="`echo $1 |cut -f2 -d= |cut -f2 -d@`" echo "set timefmt '$fmt'" echo "set format x '$fmtx'" sample=1:2 fi ;; 3d) _plot=splot sample=1:2:3 ;; *) break ;; esac shift _ns=`expr $_ns + 1` done return $_ns } ### Print gnuplot command(s) if specified from command line option # _print_gnuplot_cmdl_command_() { _gpcmd="$1" ; _gpdev="$2" ; _gpfn="$3" ; if [ "$_gpdev" ]; then cat << EOC0 set term $_gpdev set out $_gpfn EOC0 fi cat << EOC1 $_gpcmd EOC1 return 0 } ### Find out samples to plot # _tell_me_samples_to_plot_() { if [ -n "$1" ]; then lsample="$1" lsample=`echo $lsample |tr ',' '\040'` # Separate ranges by blanks rc=0 else if [ -z "$sample" ]; then lsample="0:1-0" else lsample="$sample" fi rc=1 fi echo $lsample return $rc } ### Loop for multiple data ranges applied to the current set of files and # print out plot statements # _plot_various_data_ranges_() { _sample=$1 [ "$files_data" = "-" ] && _gtitle="stdin" test -z "$_plot" && _plot=plot lastabsc=`echo $_sample |cut -f1 -d:` i=1; I=1; for j in $_sample do # DATA_RANGE begin absc=`echo $j |cut -f1-2 -d:` # 3-d [ "$absc" = "$j" ] && absc=`echo $absc |cut -f1 -d:` # 2-d first=`echo $j |cut -f1 -d- |$AWK -F: '{print $NF}'` last=`echo $j |cut -f2 -d-` [ "$last" = "$j" ] && last=$first [ "$absc" = "$j" -a "$i" -eq 1 ] && absc=0 [ "$absc" = "$j" -o "$absc" = "$first" ] && absc=$lastabsc lastabsc=$absc # In case of styles that need 3 data columns echo $j |egrep "^[0-9]+:[0-9]+:[0-9]+$" >/dev/null 2>&1 && absc=$j # FILE_LOOP: prepare and print plot statements for all files in the list $LIST_FILES \ |$AWK -v pl=$_plot -v _s="$gstyle" -v _nrs=$I -v _t=$_gtitle \ -v _a=$absc -v _f=$first -v _l=$last \ 'BEGIN { printf("%s ", pl) } { if( _t ~ /^stdin$/ ) tkey=" title \"\"" else tkey="" tsty=sprintf(_s, _nrs) for( i=_f; i<=_l; i++ ) { # plot with 3-data columns if( _a ~ /^[0-9]+:[0-9]+:[0-9]+$/ ) axes=_a else axes=sprintf("%s:%d", _a, i) if( _t ~ /^stdin$/ ) tkey=sprintf(" title \" %s\"", axes) else tkey=sprintf(" title \"%s %s\"", $0, axes) tsty=sprintf(_s, _nrs) _nrs++ printf("\"%s\" using %s with %s%s, ", $0, axes, tsty, tkey) } if( _l == 0 && _l != _f ) printf("\"%s\" with %s%s, ", $0, tsty, tkey) } END { printf "\n" }' > $tmpfile if [ "$gdevice" ]; then echo "set term $gdevice" echo "set out $ofile_nstr" fi # Paste the script saved in the tmpfile - remove last coma followed # by blank before end of line (have been excessively produced in the # FILE_LOOP) cat $tmpfile |sed 's/\, $//' # Plots after the first one must be re-plotted _plot=replot i=`expr $i + 1` I=`expr $I + 1` done # DATA_RANGE end } ### Print gnuplot script file with on terminal # _gnuplot_script_print_to_terminal_() { if [ $stdout != yes -a $quiet != yes -a $reload_data = "disabled" ]; then echo "### Your gnuplot script:" cat "$1" |grep -v "\#" echo "" fi } ### Print gnuplot script errors # _gnuplot_errors_print_to_terminal_() { echo "" 1>&2 echo "### Gnuplot ERRORS:" 1>&2 cat "$1" 1>&2 } ### Ask to display plot # _ask_to_display_plot_() { _ofile="$1" ; _viewer="$2" ; [ $reload_data = "enabled" ] \ && return 0 echo "# Show picture? [y/N]" read answer if [ "$answer" = y -o "$answer" = Y ]; then # Consider the first word in the string to be the executable, # the rest are options viewer=`echo $_viewer |cut -f1 -d' '` if [ ! "`_find_exec_in_path_ $viewer`" ]; then echo "Warn: '$viewer' is not installed or is not in your \$PATH" else $_viewer $opt_landscape "$_ofile" & fi fi } ### Check whether an executable program is in the path # _find_exec_in_path_() { which $1 2>&1 |grep "^/" } ### Verify that an input filename is provided # _exit_on_empty_filename_() { if [ -z "$files_data" ]; then echo "Error: please provide a file name(s) of use '-' for " _clean_up_ 14 fi } ### Look for GhostView installation # _look_for_ghostview_() { _err=/tmp/.$progname.$$ MUPLOT_VIEWER="`_find_exec_in_path_ gv`" if [ ! "$MUPLOT_VIEWER" ]; then MUPLOT_VIEWER=ghostview fi # For better view, show PS-plots in landscape orientation opt_landscape="-landscape" if [ "`_find_exec_in_path_ $MUPLOT_VIEWER`" ]; then test -n "$opt_landscape" \ && $MUPLOT_VIEWER $opt_landscape /dev/null 2>&1 \ |grep "orientation=" > $_err test -s $_err && opt_landscape="--orientation=landscape" rm -f $_err fi } ### Print the raw plot to stdout # _print_raw_plot_() { _ofile="$1" [ $out_form = ps ] \ && cat $_ofile |sed "s;%%Title:.*;%%Title: $cmdstr;" \ || cat $_ofile } ### Append gnuplot commands for data reload to the end of the gpt-script # _initialize_data_reload_() { reload_so_many=`echo $reload_conf |$AWK -F: '{print $1}'` reload_int=`echo $reload_conf |$AWK -F: '{print $2}'` [ "$reload_int" ] \ || reload_int=1 if [ "$gdevice" = x11 ]; then set_output="" else set_output="set out $ofile_nstr;" fi echo |($AWK "{ for( i=1; i<$reload_so_many; i++ ) print \ \"pause $reload_int; $set_output replot;\" }" ) >> $gpout _clean_up_before_reload_started_ } ### Partial cleanup in case of continuous data reload # _clean_up_before_reload_started_() { [ ! -s "$ofile" -o $stdout = yes ] && rm -f "$ofile" rm -f $gpsty $tmpfile } ### Prepare to remove various files after work finished and set a clean trap # _clean_up_() { [ ! -s "$ofile" -o $stdout = yes ] && rm -f "$ofile" # Remove if zero size rm -f $gpout $gperr $gpsty $tmpfile $tmpstdin exit $1 } trap '_clean_up_ $1' 1 2 3 6 15 ### Show usage # _show_usage_() { d=$2 cat << END_HELP $separator $1 $separator Usage: $progname [OPTION]... [STYLE] [FILE] [AXES] [FILE] [AXES] ... Options: --help|-H $d display help -h $d display short help -V $d print program version number -s $d create PostScript-file -S $d send PostScript output to STDOUT (the same as '-s -o -') -n $d create PNG-file -j $d create JPEG-file -p $d create PDF-file (requires the gnuplot "pdfcairo" driver) -X $d don't set the terminal to '$gdevice_def' (use gnuplot's default instead) -r0 $d reload data files continuously (default $reload_conf) -r $d reload data files continuously by the specified config values -c $d execute gnuplot command(s) (using the default plot style) -m $d monochrome plot (valid for PostScript or PDF) -l $d set plot size to 800x600 (valid for PNG and JPEG) -o $d base name of the output file -q $d quiet mode (all messages except errors to be suppressed) -F $d input-data field separator (default is a single space character) -i $d ignore local command file './$comm_file' -I $d specify an alternative command file instead of './$comm_file' -U $d do not sort the file list -T $d use this directory for temporary/working output files Styles/Settings: lp $d lines and points l $d lines p $d points pp $d circle points nn $d various points (types) d $d dots b $d boxes g $d grid nk $d do not plot keys (skip file names lables) e $d errorbars - default used columns are 1:2:3 (x:y:yerror) a $d fields with arrows; The data file has a special format in this case. Use 'prefield' to prepare such data files. dt= $d date/time series with the specified format; For example: dt="%H:%M.%S@%H:%M" where the first part, in front of "@", defines the data format, and the second part defines the format that will be used for tic labels. Here, hours and minutes are separated by \`:', respectively minutes and seconds by \`.' Another example is date and time stamp: dt="%Y-%m-%d %H:%M:%S" 3d $d plot 3-d data using 1:2:3 u= $d user specified plot style format (as defined in Gnuplot); For example: u="points pointtype 2 pointsize 3"; To see the present terminal and palette capabilities of gnuplot use the command '$progname -c test'. s= $d user specified setting (as defined in Gnuplot); For example: s="logscale x" Axes: x:y,x:y-z $d columns in the file defining the x/y-axes of the curve(s); Default are 1:2 or 1:2:3 for data with errors. In case that only one column is provided the default axes are 0:1 - the x-axis will be a simple index then. File(s) could be a single file name whereas '-' means , many files enclosed in '' or "" like "file1 file2 file3", or any valid shell pattern as for example "*.dat". The files '\$HOME/$comm_file' and './$comm_file', if existing, will be included at the beginning of the gnuplot script. The command block between "#BEGIN" and "#END" in those files will be pasted to the end of the script. If you want that the global '\$HOME/$comm_file' is ignored, create in your local directory a file named '$comm_file_ignore'. In case you want to view the output, define the env variable MUPLOT_VIEWER and export it, for example: MUPLOT_VIEWER="xpdf -z page"; export MUPLOT_VIEWER Then the program will prompt you to view the plot, and after confirmation the viewer will present the graphics. If the postscript file format is chosen ('-s' option), and MUPLOT_VIEWER is not defined, the viewer is preset to 'gv', and per default you are prompted to view the output. To disable this behavior use the command "unset MUPLOT_VIEWER". Examples: 1) On X-terminal view a multi-curve plot of all data-files with extension 'dat' $progname "*.dat" 2) Print a sinus curve in black-and-white color on a PostScript-printer $progname -m -S -c "set title 'Function f(x)=sin(x)'; plot sin(x);" | lpr 3) Plot data from file "example.dat" using columns 1:2, 3:4, and 3:5 as x/y-axes in the multi-curve plot; a PostScript-file with the name "example.ps" is automatically created. $progname -s example.dat 1:2,3:4-5 4) Create graphics in PDF-format reading data from file "example.1.dat" (columns 1:2), and from file "example.2.dat" (columns 3:4) $progname -p lp example.1.dat 1:2 example.2.dat 3:4 5) View file where the first column is data, and the third and forth columns are date of the form 'yyyy-mm-dd' and time in the form 'hh:mm:ss' cat example_counts_per_second.dat | $progname dt="%Y-%m-%d %H:%M:%S" - 3:1 6) Plot 3-dimensional data from file "example_3d.dat" using the 1,3, and 5-th data columns with dots-plot-style, enabling grid, setting the xrange to [0:10], disabling keys and defining a plot-title muplot nk g d 3d s="xrange [0:10]" s="title 'This is a 3-d plot'" example_3d.dat 1:3:5 7) Replot data 1000 times every 5 seconds and write temporary created files in the '/tmp' directory; This scenario is useful in case of growing or otherwise changing over time data-file muplot -T /tmp -r 1000:5 example.dat Report bugs to END_HELP } ### Print out license # print_licence_version() { cat << _VERSION_ $progname $version $license _VERSION_ } ### Print out usage (short help) # print_usage() { separator=`echo |$AWK '{printf( "%080d", 0 )}' |tr 0 -` header_text="$progname $version: plot a multi-curve figure from multiple data by using Gnuplot" _show_usage_ "$header_text" "-" \ |egrep "^($progname|Usage:|Options:|Styles.*:|Axes:|.*--|.*[\ >]\ -\ |.*\,x:y-z)" } ### Print out Help (long help) # print_help() { separator="" header_text="Muplot is a simple, non-interactive gnuplot-wrapper to plot a multi-curve figure from multiple data (files). It can produce PostScript, PDF, PNG or JPEG output file formats." _show_usage_ "$header_text" " " } ################################################################################ # # MAIN # We need an AWK supporting assignments if [ x"$AWK" = x ]; then exec 3>&2 2>&- for a in gawk nawk awk do [ "`set +x; echo |$a -v a=a '{}' 2>&1`" = "" ] && AWK=$a done exec 2>&3 fi [ x"$AWK" = x ] && \ echo "Error: can't find 'awk' programm supporting assignments" && \ exit 12 [ $# -eq 0 ] && set -- "-h" # Process cmdline options while [ 0 ] do case $1 in -h) # Print usage (short help) and exit print_usage exit 0 ;; -H|--help) # Print help and exit print_help exit 0 ;; -V) # Print version and exit echo $version exit 0 ;; -v|--version) # Print version and license and exit print_licence_version exit 0 ;; -s) out_form=ps [ "`env |grep ^MUPLOT_VIEWER`" ] || _look_for_ghostview_ ;; -S) out_form=ps stdout=yes ;; -n) out_form=png ;; -j) out_form=jpg ;; -p) out_form=pdf ;; -X) gdevice="" ;; -r) reload_data=enabled reload_conf="$2" shift ;; -r0) reload_data=enabled ;; -c) gpt_cmd="$2" shift ;; -l) termopt="large size 800,600" ;; -m) pscolor=monochrome ;; -o) [ "x$2" != "x-" ] \ && ofname=$2 \ || { stdout=yes; quiet=yes ;} shift ;; -q) quiet=yes ;; -i) ignore_local_comm=yes ;; -I) set_file="$2" shift [ ! -e "$set_file" ] \ && echo "$progname: no such file '$set_file'" \ && exit 13 ;; -F) data_FS="$2" shift ;; -T) MUPLOT_DIR_TMP="$2" shift ;; -U) file_list_sort=no ;; -|*) break ;; -*) exec 1>&2 echo "$progname: invalid option '$1'" echo "Try \`$progname -H' for help." exit 8 ;; esac shift done # Setup names for working files _define_output_tmpfile_names_ # Check whether gnuplot is available [ ! `which gnuplot 2>&1 |grep "^/"` ] \ && echo 'Gnuplot is not installed or is not in your $PATH' \ && _clean_up_ 7 # Create script file for gnuplot echo "unset time" > $gpout # Set data-field separator if defined [ "$data_FS" ] \ && echo "set datafile separator \"$data_FS\"" >> $gpout # Define output driver _define_output_driver_ $out_form >> $gpout # Read gnuplot commands from file - OUTSide #BEGIN ... #END block _gnuplot_commands_read_file_ 1 "$set_file" dummy >> $gpout # Check for gnuplot command(s) specified by '-c' if [ -n "$gpt_cmd" ]; then _define_output_file_names_ "$ofname" bfname ofile ofile_nstr _print_gnuplot_cmdl_command_ "$gpt_cmd" "$gdevice" "$ofile_nstr" >> $gpout # Process the list of files else # Determine the plot style and send the output to the style-file; # More than one style can be specified this way _define_plot_style_ "$files_data" "$@" >> $gpsty shift $? # Check for files specified _prepare_list_of_files_to_plot_ "$1" bfname files_data \ && data_file_set=defined # Exit if no filename provided _exit_on_empty_filename_ "$files_data" # Define output file names _define_output_file_names_ "$ofname" bfname ofile ofile_nstr # Add the style file to the output script cat $gpsty >> $gpout # Loop over multiple file sets while [ $data_file_set ] do # FILE_SET begin shift # If input is piped in, then start using the temporary file [ "x$files_data" = "x-" ] && cat ->> $tmpstdin && exec <&1 # Check for samples and ranges sample=`_tell_me_samples_to_plot_ "$1"` \ && shift # Look for multiple data ranges and print out plot commands _plot_various_data_ranges_ "$sample" files_data gdevice ofile_nstr >> $gpout # Look for next data file set and prepare a list _prepare_list_of_files_to_plot_ "$1" bfname files_data \ || data_file_set="" done # FILE_SET end fi # Read gnuplot commands from file - INSide #BEGIN ... #END block _gnuplot_commands_read_file_ 0 "$set_file" "$ofile_nstr" >> $gpout # "pause" if the terminal is X11 or is not defined explicitely if [ "$gdevice" = x11 -o "$gdevice" = "" ]; then [ $reload_data = "disabled" ] \ && echo "pause -1" >> $gpout fi # In case of continues data reload for "real-time" data observation [ $reload_data = "enabled" ] \ && _initialize_data_reload_ reload_conf ofile_nstr gpout files_data # Execute GNUPLOT gnuplot $gpout > $gperr 2>&1 # Print out the gnuplot script _gnuplot_script_print_to_terminal_ $gpout # If gnuplot failed with errors, report them and exit if [ -s $gperr ]; then _gnuplot_errors_print_to_terminal_ $gperr _clean_up_ 11 fi if [ $stdout = yes ]; then # Print the raw plot to STDOUT if chosen _print_raw_plot_ "$ofile" else # Print the name of the output file if [ -n "$ofile_nstr" -a $quiet != yes ]; then echo "# Your plot file is $ofile_nstr." fi # Ask user whether he wants to view the plot if [ $quiet != yes -a "$gdevice" != x11 ]; then if [ -n "$MUPLOT_VIEWER" ] ;then _ask_to_display_plot_ "$ofile" "$MUPLOT_VIEWER" fi fi fi _clean_up_ 0 stda-1.3.1/src/mintegrate.10000644017777601777760000000717212357527403015317 0ustar nobodynogroup.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.45.1. .TH MINTEGRATE "1" "July 2014" "mintegrate 2.4.1" "User Commands" .SH NAME mintegrate \- evaluate average/sum/integral/derivative of 1\-d numerical data .SH SYNOPSIS .B mintegrate [\fI\,OPTION\/\fR]... [\fI\,FILE\/\fR] .SH DESCRIPTION mintegrate is a program to compute averages, sums, integrals or derivatives of numerical 1\-d data in situations where ultimate numerical precision is not needed. .SH OPTIONS .TP \fB\-a\fR compute mean value (arithmetic average) and standard deviation .TP \fB\-c\fR compute integral on closed x\-data interval; In case that dx is not specified by the '\-d' flag, the data are supposed to be from an irregular x\-grid, and dx is computed separately for every x\-interval. The integral is computed by the trapezoidal rule. .TP \fB\-d\fR compute integral on open x\-data interval with the specified dx; Can be used also in combination with '\-D' and '\-c'. .TP \fB\-D\fR compute difference btw. numbers or derivative of the y\-data; In the default scenario where x\- and y\-data column are same, the difference btw. the current and the previous data value will be output. In this case when '\-d' is defined as 0, the x\-data value will be print out in front of the calculated difference. If x\-and the y\-column are different and if the x\-data resolution is not defined or it is !=0, then the derivative of the y\-data is calculated. When the x\-data resolution is constant, specify it explicitly by '\-d' to achieve a higher numerical precision by a 'leapfrog' algorithm. .TP \fB\-x\fR x\-data column (default is 1). If 0, the x\-range is an index; .TP \fB\-y\fR y\-data column, where y=f(x) (default is 1) .TP \fB\-r\fR x_0:x_1 x\-data range to consider .TP \fB\-s\fR print out accumulated y_i sums: x_i versus accumulated f(x_i); In the case of a closed integral you have to specify also the x\-data resolution dx (see '\-d' above). .TP \fB\-S\fR compute the accumulated y_i\-sums and add it to the output .TP \fB\-p\fR print format of the result ("%.10g" is default) .TP \fB\-t\fR output text in front of the result (invalid with '\-s' or '\-S'); A blank can be printed by using a double underscore character .TP \fB\-F\fR sets the field separator (default is a single space character) \&'__'. .TP \fB\-T\fR run a self\-test that the program is working correctly .TP \fB\-V\fR print version number .TP \fB\-\-version\fR output version and license message .TP \fB\-\-help\fR|\-H display help .TP \fB\-h\fR display short help (options summary) .PP If none of the options '\-a', '\-D', '\-d', or '\-c' is used, then the sum of the provided data will be computed. Empty lines or lines starting with '#' are skipped. .PP This program is perfectly suitable as a basic tool for initial data analysis and will meet the expected accuracy of a numerical solution for the most demanding computer users and professionals. Yet be aware that, although the computations are carried with double floating precision, the computational techniques used for evaluating an integral or a standard deviation are analytically low\-order approximations, and thus not intended to be used for numerical computations in engineering or mathematical sciences for cases where an ultimate numerical precision is a must. For deeper understanding of the topic see http://en.wikipedia.org/wiki/Numerical_analysis. .SH COPYRIGHT Copyright \(co 1997, 2001, 2006\-2007, 2009, 2011\-2014 Dimitar Ivanov .PP License: GNU GPL version 3 or later .br This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. stda-1.3.1/src/nnum0000744017777601777760000000465112357525002013767 0ustar nobodynogroup#!/bin/sh VERSION=2.2.2 NAME=`basename $0` NV="$NAME $VERSION: print a series of integers, floats, or function values" LICENSE="Copyright (C) 2006, 2007, 2009, 2011-2013 Dimitar Ivanov License: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law." ################################################################################ ofmt="%.6g" sep=`echo |awk '{printf( "%080d", 0 )}' |tr 0 -` show_help() { cat << EOH && exit $sep $NV $sep Usage: $NAME [] [] [] or: $NAME Examples: a) $NAME 100 b) $NAME 10 1 -1 c) $NAME 1 10 0.1 x "N=%05.2f" d) $NAME -3.14 3.14 0.01 "sin(x)" "sin(x)=%f at x=%f" e) $NAME -3.14 3.14 0.01 "cos(x*x)" "%g %g" Remark: an user-defined function should have syntax conforming to 'awk'. EOH } show_version() { cat << !ver && exit $NAME $VERSION $LICENSE !ver } case $1 in -h|"") show_help ;; --help) sep="" NV="$NAME produces a series of integers, floats, or function values" show_help ;; --version) show_version ;; -[-a-zA-Z]*) exec 1>&2 echo "$NAME: invalid option '$1'" echo "Try \`$NAME -h' for help." exit 2 ;; esac case $# in 1) b=0; e=$1; d=1; ;; 2) b=$1; e=$2; d=1; ;; 3) b=$1; e=$2; d=$3; ;; 4) b=$1; e=$2; d=$3; func=$4; ;; 5) b=$1; e=$2; d=$3; func=$4; ofmt=$5; ;; *) exit 1 ;; esac [ "$func" ] || func=x; sign=`echo $d \ |awk 'BEGIN { if( $1 == 0 ) exit } { if( $1 > 0 ) printf "+" if( $1 < 0 ) printf "-" }' ` case $sign in +) cop='<=' ;; -) cop='>=' ;; *) echo "($NAME) error: step must be different than zero"; exit 2 ;; esac # Use e1 because of round-off errors with floating numbers echo |awk "BEGIN \ { CONVFMT = \"%.17g\" OFMT = \"%.17g\" e1 = $e + ($d/10) } MAIN { i = $b while( i ${cop} e1 ) { x = i; printf( \"$ofmt\n\", $func, x ) i = i + ($d) } }" stda-1.3.1/src/mmval0000744017777601777760000000721112111163512014111 0ustar nobodynogroup#!/bin/sh VERSION=1.3.1 PROGNAME=`basename $0` DESC="$PROGNAME $VERSION: find minimum and maximum value in a data set" LICENSE="Copyright (C) 2009, 2012-2013 Dimitar Ivanov License: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law." ################################################################################ show_usage() { cat << EOU Usage: $PROGNAME [OPTION]... [FILE] Options: -m - find the maximum value -M - find the minimum value -n - prefix the output with the line number within its input -c - consider the data in the specified column of the input -v - print program version and copyright message, then exit -h - display this help and exit EOU } show_version() { cat << !ver $PROGNAME $VERSION $LICENSE !ver } [ x$1 = x--help ] \ && set -- '-h' \ && DESC="$PROGNAME determines minimum and maximum values of data" [ x$1 = x--version ] && set -- '-v' opts="mMnc:vh" opts=`getopt $opts $*` && RC=0 || { opts="-h"; RC=1; } set -- $opts while [ 1 ] do case $1 in -v) show_version; exit ;; -n) line_numbers=yes ;; -m) mode=${mode}min ;; -M) mode=${mode}max ;; -c) col=$2 shift ;; -[a-zA-Z0-9]) echo $DESC show_usage exit $RC ;; *) file=$2 [ -z "$file" ] && file=- break ;; esac shift done # File sanity check if [ "$file" != "-" ]; then [ -f "$file" ] || \ { echo "Error: no such file '$file'"; exit 1; } [ -r "$file" ] || \ { echo "Error: no read permission for '$file'"; exit 2; } fi [ x$col = x ] && col=1 case $mode in min) comp='<' ;; max) comp='>' ;; maxmin|minmax) ;; *) mode=minmax # If no mode chosen, then minimum + maximum is default ;; esac # Code for finding out minum or maximum values only awk_script_min=" { v_i=\$$col if( ! i ) v_m = v_i; if( v_i $comp v_m ) { v_m = v_i; lines = \"\"; } i++ if( \"$line_numbers\" && v_i == v_m ) { if( lines ) lines = sprintf( \"%s\\n%d:%s\", lines, i, \$0 ); else lines = sprintf( \"%d:%s\", i, \$0 ) } } END \ { if( \"$line_numbers\" == \"yes\" ) print lines; else print v_m; } " # The same like the minimum script awk_script_max="$awk_script_min" # Code for finding out concurrently minum and maximum values awk_script_minmax=" { v_i=\$$col if( ! i ) { v_max = v_min = v_i; } if( v_i < v_min ) { v_min = v_i; lines_min = \"\"; } if( v_i > v_max ) { v_max = v_i; lines_max = \"\"; } i++ if( \"$line_numbers\" && v_i == v_max ) { if( lines_max ) lines_max = sprintf( \"%s\\n%d:%s\", lines_max, i, \$0 ); else lines_max = sprintf( \"%d:%s\", i, \$0 ); } if( \"$line_numbers\" && v_i == v_min ) { if( lines_min ) lines_min = sprintf( \"%s\\n%d:%s\", lines_min, i, \$0 ); else lines_min = sprintf( \"%d:%s\", i, \$0 ); } } END \ { if( \"$line_numbers\" == \"yes\" ) { if( \"$mode\" == \"maxmin\" ) { print lines_max; print lines_min; } else { print lines_min; print lines_max; } } else { if( \"$mode\" == \"maxmin\" ) printf( \"%s\n%s\n\", v_max, v_min ); else printf( \"%s\n%s\n\", v_min, v_max ); } } " # The same like the minmax script awk_script_maxmin="$awk_script_minmax" # Evaluate the variable to get the actual script name eval awk_script="\${awk_script_$mode}" cat $file |awk "$awk_script" stda-1.3.1/src/prefield0000744017777601777760000000501411716723734014610 0ustar nobodynogroup#!/bin/sh VERSION=1.4.8 NAME=`basename $0` NV="$NAME $VERSION:" LICENSE="Copyright (C) 1997, 2001, 2005, 2007, 2009, 2011-2012 Dimitar Ivanov License: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law." # ################################################################################ # # prefield - prepare input file for 'muplot' to plot 2-d fields by arrows # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # ################################################################################ # sep=`echo |awk '{printf( "%080s", 0 )}' |tr 0 -` if [ x$1 = x--version ]; then cat << !ver $NAME $VERSION $LICENSE !ver exit fi [ x$1 = x--help -o x$1 = x-h ] && rc=0 || rc=1 [ x$1 = x--help ] && NV="$NAME will" && sep="" if [ $# != 6 ]; then cat << EOH $sep $NV prepare input file for 'muplot' to plot 2-d fields by arrows $sep Usage: $NAME x y F_x F_y Example: On running "$NAME test.dat 20 1 2 5 6" the source file 'test.dat' will be read, and a field-data file will be produced with the 1st and 2nd columns being the x and y space-positions like in the source file, whereas the fields F_x and F_y are calculated from the values in the 5th and 6th columns of the source data multiplied by the second command line option, which means in this example a 20-fold magnification. Use '-' as file name to read from and write to . EOH exit $rc fi ### Main trap 'rm -f "$ofile"; exit' 1 2 3 15 ofile="$1.$2_$3$4$5$6.fd" [ "$1" != "-" ] && exec 3>&1 1>$ofile cat $1 |egrep -v '(#|^$)' \ |awk -v x=$3 -v y=$4 -v fx=$5 -v fy=$6 -v s=$2 -v cmd="# $0 $*" \ 'BEGIN { print cmd; } { printf("%g\t%g\tset arrow from %g,%g to %g,%g\n", $x, $y, $x, $y, $x+(s*$fx), $y+(s*$fy)); }' [ "$1" != "-" ] && exec 1>&3 && echo "Your output file is $ofile" exit 0 stda-1.3.1/src/muplot.10000644017777601777760000001347412357527404014503 0ustar nobodynogroup.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.45.1. .TH MUPLOT "1" "July 2014" "muplot 5.6.2" "User Commands" .SH NAME muplot \- plot a multi\-curve figure from multiple data by using Gnuplot .SH SYNOPSIS .B muplot [\fI\,OPTION\/\fR]... [\fI\,STYLE\/\fR] [\fI\,FILE\/\fR] [\fI\,AXES\/\fR] [\fI\,FILE\/\fR] [\fI\,AXES\/\fR] ... .SH DESCRIPTION Muplot is a simple, non\-interactive gnuplot\-wrapper to plot a multi\-curve figure from multiple data (files). It can produce PostScript, PDF, PNG or JPEG output file formats. .SH OPTIONS .TP \fB\-\-help\fR|\-H display help .TP \fB\-h\fR display short help .TP \fB\-V\fR print program version number .TP \fB\-s\fR create PostScript\-file .TP \fB\-S\fR send PostScript output to STDOUT (the same as '\-s \-o\fR \-') .TP \fB\-n\fR create PNG\-file .TP \fB\-j\fR create JPEG\-file .TP \fB\-p\fR create PDF\-file (requires the gnuplot "pdfcairo" driver) .TP \fB\-X\fR don't set the terminal to 'x11' (use gnuplot's default instead) .TP \fB\-r0\fR reload data files continuously (default 8640:10) .TP \fB\-r\fR reload data files continuously by the specified config values .TP \fB\-c\fR execute gnuplot command(s) (using the default plot style) .TP \fB\-m\fR monochrome plot (valid for PostScript or PDF) .TP \fB\-l\fR set plot size to 800x600 (valid for PNG and JPEG) .TP \fB\-o\fR base name of the output file .TP \fB\-q\fR quiet mode (all messages except errors to be suppressed) .TP \fB\-F\fR input\-data field separator (default is a single space character) .TP \fB\-i\fR ignore local command file './.muplotset' .TP \fB\-I\fR specify an alternative command file instead of './.muplotset' .TP \fB\-U\fR do not sort the file list .TP \fB\-T\fR use this directory for temporary/working output files .SS "Styles/Settings:" .TP lp lines and points .TP l lines .TP p points .TP pp circle points .TP nn various points (types) .TP d dots .TP b boxes .TP g grid .TP nk do not plot keys (skip file names lables) .TP e errorbars \- default used columns are 1:2:3 (x:y:yerror) .TP a fields with arrows; The data file has a special format in this case. Use 'prefield' to prepare such data files. .TP dt= date/time series with the specified format; For example: dt="%H:%M.%S@%H:%M" where the first part, in front of "@", defines the data format, and the second part defines the format that will be used for tic labels. Here, hours and minutes are separated by `:', respectively minutes and seconds by `.' Another example is date and time stamp: dt="%Y\-%m\-%d %H:%M:%S" .TP 3d plot 3\-d data using 1:2:3 .TP u= user specified plot style format (as defined in Gnuplot); For example: u="points pointtype 2 pointsize 3"; To see the present terminal and palette capabilities of gnuplot use the command 'muplot \-c\fR test'. .TP s= user specified setting (as defined in Gnuplot); For example: s="logscale x" .SS "Axes:" .TP x:y,x:y\-z columns in the file defining the x/y\-axes of the curve(s); Default are 1:2 or 1:2:3 for data with errors. In case that only one column is provided the default axes are 0:1 \- the x\-axis will be a simple index then. .PP File(s) could be a single file name whereas '\-' means , many files enclosed in '' or "" like "file1 file2 file3", or any valid shell pattern as for example "*.dat". The files '$HOME/.muplotset' and './.muplotset', if existing, will be included at the beginning of the gnuplot script. The command block between "#BEGIN" and "#END" in those files will be pasted to the end of the script. If you want that the global '$HOME/.muplotset' is ignored, create in your local directory a file named '.muplotset.noglobal'. In case you want to view the output, define the env variable MUPLOT_VIEWER and export it, for example: .IP MUPLOT_VIEWER="xpdf \-z\fR page"; export MUPLOT_VIEWER .PP Then the program will prompt you to view the plot, and after confirmation the viewer will present the graphics. If the postscript file format is chosen ('\-s' option), and MUPLOT_VIEWER is not defined, the viewer is preset to 'gv', and per default you are prompted to view the output. To disable this behavior use the command "unset MUPLOT_VIEWER". .SH EXAMPLES 1) On X\-terminal view a multi\-curve plot of all data\-files with extension 'dat' .IP muplot "*.dat" .PP 2) Print a sinus curve in black\-and\-white color on a PostScript\-printer .IP muplot \-m \-S \-c "set title 'Function f(x)=sin(x)'; plot sin(x);" | lpr .PP 3) Plot data from file "example.dat" using columns 1:2, 3:4, and 3:5 as x/y\-axes in the multi\-curve plot; a PostScript\-file with the name "example.ps" is automatically created. .IP muplot \-s example.dat 1:2,3:4\-5 .PP 4) Create graphics in PDF\-format reading data from file "example.1.dat" (columns 1:2), and from file "example.2.dat" (columns 3:4) .IP muplot \-p lp example.1.dat 1:2 example.2.dat 3:4 .PP 5) View file where the first column is data, and the third and forth columns are date of the form 'yyyy\-mm\-dd' and time in the form 'hh:mm:ss' .IP cat example_counts_per_second.dat | muplot dt="%Y\-%m\-%d %H:%M:%S" \- 3:1 .PP 6) Plot 3\-dimensional data from file "example_3d.dat" using the 1,3, and 5\-th data columns with dots\-plot\-style, enabling grid, setting the xrange to [0:10], disabling keys and defining a plot\-title .IP muplot nk g d 3d s="xrange [0:10]" s="title 'This is a 3\-d plot'" example_3d.dat 1:3:5 .PP 7) Replot data 1000 times every 5 seconds and write temporary created files in the '/tmp' directory; This scenario is useful in case of growing or otherwise changing over time data\-file .IP muplot \-T /tmp \-r 1000:5 example.dat .SH "REPORTING BUGS" Report bugs to .SH COPYRIGHT Copyright \(co 1996\-2009, 2011\-2014 Dimitar Ivanov .PP License: GNU GPL version 3 or later .br This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. stda-1.3.1/README0000644017777601777760000000617612375456055013176 0ustar nobodynogroup-------------------------------------------------------------------------------- Simple Tools for Data Analysis (STDA) -------------------------------------------------------------------------------- About ===== STDA includes some primary tools for data analysis. You can evaluate sums, averages, integrals, derivatives, histograms or probability distribution functions of 1-d data, and eventually plot the results. The programs are stand-alone tools (supporting the standard UNIX input and output pipelines) intended for data processing from the command line. It should be noted that all but one of the scripts use awk and core system utilities. For plotting you have to install Gnuplot (see http://gnuplot.info) since 'muplot' is a wrapper around it. In summary, the package provides utilities for straightforward analysis of data series where a complex analytical approach is not needed and where an ultimate numerical precision with floating-point numbers is not critical. Some general examples of application cases include evaluating usage statistics from server logfiles, determining a response time distribution from a series of queries to a [remote] service, producing a plot from multiple data files, etc. This software should be considered as an open project to be extended with new command-line driven utilities helpful for performing common data analysis tasks. Any contributions and suggestions are welcome. Following programs are included in the distribution: * maphimbu - histogram builder for 1-d numerical and text data * mintegrate - average/sum/integral/derivative of 1-d numerical data * mmval - find minimum and maximum value in a dataset * muplot - plot a multi-curve figure from multiple dataset using Gnuplot * nnum - produce a series of equally separated integers or floats * prefield - prepare input file for 'muplot' to plot 2-d fields by arrows Download ======== You can find the newest version of STDA at http://gnu.mirendom.net/stda.html Installation ============ The software can be installed or uninstalled by using the script 'install.sh' as follows: ./install.sh install or ./install.sh uninstall The default destination directories for the binaries and manual pages can be overwritten by command line options. To see a short help, execute the script without options. Examples ======== - Evaluate the current apache2 logfile and make an unique list of the hostnames (respectively ip-addresses) sorted by the total number of their http requests: maphimbu -rs2 /var/log/apache2/access.log - On a X terminal plot the probability function and the cumulative distribution function of a 'sin(x)' data sample: nnum -3.14159 3.14159 0.00001 "sin(x)" "%.17f %.7f" | maphimbu -d0.01 -x1 -ns1 | mintegrate -d0.01 -x1 -y3 -S | muplot lp - 1:3,4 Features ======== For new features, major changes and bug fixes see the NEWS file. Copyright ========= Copyright (C) 2009, 2011-2014 Dimitar Ivanov This is free software; You can redistribute it and/or modify it under the terms of the GNU General Public License, Version 3 or later. For the full text of the licence see the LICENCE file. stda-1.3.1/COPYING0000644017777601777760000000030211260114236013312 0ustar nobodynogroupPermission is granted to copy, distribute, and/or modify this document under the terms of the GNU GENERAL PUBLIC LICENSE, Version 3 or later. For full text of the license see the LICENSE file. stda-1.3.1/NEWS0000644017777601777760000001025612375455014013001 0ustar nobodynogroup ================== NEWS file for STDA ================== stda 1.3.1 / 2014-08-21 ----------------------------- List of programs and changes: ----------------------------- + maphimbu (v 2.10.1) - CONVFMT and OFMT variables in 'awk' defined separately as "%.17g" + mintegrate (v. 2.4.1) - CONVFMT and OFMT variables in 'awk' defined separately as "%.17g" - new option '-F' for specifying the data-field separator * mmval (v. 1.3.1) + muplot (v. 5.6.2) - default postscript canava set to landscape with size-ratio of 0.71 - fixed bug with processing 's=' and 'u=' options - new style 'nn' for various plotting point-types - "dt=" string parsing fixed to allow space characters and enables reading and plotting of date and time from separate data columns - new option '-F' for specifying the data-field separator + nnum (v. 2.2.2) - CONVFMT and OFMT variables in 'awk' defined separately as "%.17g" - bugfix: shell defined as "!#/bin/sh" - "/bin/dash" used accidentally in previous releases - new: producing a series from user-defined function (conform to awk-syntax) possible now * prefield (v. 1.4.8) stda 1.2.1 / 2013-08-21 ----------------------------- List of programs and changes: ----------------------------- + maphimbu (v. 2.9.1) - new option '-a' to compute accumulated sums of the result-data-column + mintegrate (v. 2.2.3) - better defined special cases when to evaluate derivatives and when differences + mmval (v. 1.3.1) - Performance improved by evaluating line numbers only if requested by '-n' + muplot (v. 5.3.2) - program can be called with only one parameter: muplot - new option '-X' disabling that the default terminal is set to 'x11' - instead gnuplot's default is used - new option '-r' for continous reload of data files; This possibility could be interesting when data files are permanently growing/changing like in the case of real-time data processing - new option '-T' for specifying a directory for temporary data files different then current working directory - new style option s="...": enables the possibility to access directly the gnuplot's setting option command: "set ..." - when reading input from stdin plot title key named to "" - new style option 'nk': translates to gnuplot's "unset key" - gnuplot commands for "set notime" and "set nokey" upgraded to the newer version of "unset ..." which is not backward compatible - new option '-U' instructs to skip sorting the file list - for png-plot the background color is set to "non-transparent" as default * nnum (v. 1.4.5) * prefield (v. 1.4.8) stda 1.1.1 / 2012-02-16 ----------------------------- List of programs and changes: ----------------------------- * maphimbu (v. 2.8.4) + mintegrate (v. 2.2.1) - bug fixed for computing difference with only two data points + mmval (v. 1.2.2) - if no option, default is to find minimum and maximum + muplot (v. 3.2.1) - bug fixed when checking for data ranges - new option '-I' for specifying alternative command file + nnum (v. 1.4.5) - process sequence also with a negative step - descending order + prefield (v. 1.4.8) stda 1.1 / 2011-06-01 ----------------------------- List of programs and changes: ----------------------------- + maphimbu (v. 2.8.4) - New option '-g' for pure numerical sorting + mintegrate (v. 2.1.4) - New option '-D' for computing derivatives or difference between numbers - New option '-T' for self-test * mmval (v. 1.1.2) + muplot (v. 3.1.1) - Bugfix with postscript title and command line options string - Plotting of multiple file sets with their own (different) plot ranges - MUPLOT_VIEWER env. variable introduced to allow user specified viewer * nnum (v. 1.3.3) + prefield (v. 1.4.7) - Example adjusted for better format in the man page stda 1.0 / 2009-10-08 --------------------- Initial release on http://gnu.mirendom.net List of programs: ----------------- * maphimbu (v. 2.8.1) * mintegrate (v. 2.0.9) * mmval (v. 1.1.2) * muplot (v. 2.1.6) * nnum (v. 1.3.2) * prefield (v. 1.4.4) stda-1.3.1/show_package_desc.sh0000755017777601777760000000101711263115577016267 0ustar nobodynogroup#!/bin/sh PWD=`pwd` [ x$1 = x--version ] && \ echo `expr $PWD : ".*\/\(.*\)-[0-9\.]*"` `cat VERSION` && \ grep "Copyright (C)" README && \ cat << ! && exit License: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. ! sed -ne "/^About$/,/^Download$/p" README \ |tail -n+3 |head -n-3 echo sed -ne "s/=*//; s/Examples/Examples:/; /^Examples:$/,/^Features$/p" README \ |head -n-2