summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarl <Kraken.rf.inc@gmail.com>2021-12-23 03:17:38 +0100
committerCarl <Kraken.rf.inc@gmail.com>2021-12-23 03:17:38 +0100
commit6d7d8079da2a315bd4556475da6aa9ae1c7d2b8b (patch)
tree463cc81657e0b3ddbbf4f56663bc52735b6ad562
parentinitial commit (diff)
downloadkrakensdr_pr-6d7d8079da2a315bd4556475da6aa9ae1c7d2b8b.tar
krakensdr_pr-6d7d8079da2a315bd4556475da6aa9ae1c7d2b8b.tar.gz
krakensdr_pr-6d7d8079da2a315bd4556475da6aa9ae1c7d2b8b.tar.bz2
krakensdr_pr-6d7d8079da2a315bd4556475da6aa9ae1c7d2b8b.tar.lz
krakensdr_pr-6d7d8079da2a315bd4556475da6aa9ae1c7d2b8b.tar.xz
krakensdr_pr-6d7d8079da2a315bd4556475da6aa9ae1c7d2b8b.tar.zst
krakensdr_pr-6d7d8079da2a315bd4556475da6aa9ae1c7d2b8b.zip
-rwxr-xr-xdoc/kraken_doadsp_main.pngbin174778 -> 0 bytes
-rwxr-xr-xutil/LICENCE675
-rwxr-xr-xutil/README.md94
-rwxr-xr-xutil/_UI/_web_interface/assets/style.css215
-rwxr-xr-xutil/_UI/_web_interface/kraken_web_interface.py1916
-rw-r--r--util/_UI/_web_interface/tooltips.py210
-rwxr-xr-xutil/_UI/save_settings.py102
-rwxr-xr-xutil/_receiver/iq_header.py152
-rwxr-xr-xutil/_receiver/krakenSDR_receiver.py375
-rwxr-xr-xutil/_receiver/shmemIface.py195
-rwxr-xr-xutil/_signal_processing/krakenSDR_signal_processor.py713
-rwxr-xr-xutil/doc/kraken_doadsp_main.pngbin174778 -> 0 bytes
-rwxr-xr-xutil/gui_run.sh19
-rwxr-xr-xutil/kill.sh5
-rwxr-xr-xutil/kraken_doa_start.sh11
-rwxr-xr-xutil/kraken_doa_stop.sh5
-rwxr-xr-xutil/settings.json1
-rwxr-xr-xutil/settings.json_old1
-rwxr-xr-xutil/setup_init.sh18
19 files changed, 0 insertions, 4707 deletions
diff --git a/doc/kraken_doadsp_main.png b/doc/kraken_doadsp_main.png
deleted file mode 100755
index d6da987..0000000
--- a/doc/kraken_doadsp_main.png
+++ /dev/null
Binary files differ
diff --git a/util/LICENCE b/util/LICENCE
deleted file mode 100755
index 53d1f3d..0000000
--- a/util/LICENCE
+++ /dev/null
@@ -1,675 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
- 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.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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 <https://www.gnu.org/licenses/>.
-
-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:
-
- <program> Copyright (C) <year> <name of author>
- 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
-<https://www.gnu.org/licenses/>.
-
- 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
-<https://www.gnu.org/licenses/why-not-lgpl.html>.
-
diff --git a/util/README.md b/util/README.md
deleted file mode 100755
index 1977e2f..0000000
--- a/util/README.md
+++ /dev/null
@@ -1,94 +0,0 @@
-# Kraken SDR DoA DSP
-This software is intended to demonstrate the direction of arrival (DoA) estimation capabilities of the KrakenSDR and other RTL-SDR based coherent receiver systems which use the compatible data acquisition system - HeIMDALL DAQ Firmware.
-<br>
-<br>
-The complete application is broken down into two main modules in terms of implementation, into the DAQ Subsystem and to the DSP Subsystem. These two modules can operate together either remotely through Ethernet connection or locally on the same host using shared-memory.
-
-Running these two subsystems on separate processing units can grant higher throughput and stability, while running on the same processing unit makes the entire system more compact.
-
-## Installation
-
-1. Install the prerequisites
-
-``` bash
-sudo apt update
-sudo apt install php-cli
-```
-
-2. Install Heimdall DAQ
-
-If not done already, first, follow the instructions at https://github.com/krakenrf/heimdall_daq_fw/tree/development to install the Heimdall DAQ Firmware.
-
-3. Set up Miniconda environment
-
-You will have created a Miniconda environment during the Heimdall DAQ install phase.
-
-Please run the installs in this order as we need to ensure a specific version of dash is installed.
-
-``` bash
-conda activate kraken
-
-conda install quart
-conda install pandas
-conda install orjson
-conda install matplotlib
-
-pip3 install dash_bootstrap_components
-pip3 install quart_compress
-pip3 install dash_devices
-pip3 install pyargus
-
-conda install dash==1.20.0
-```
-
-4. Install the krakensdr_doa software
-
-```bash
-cd ~/krakensdr
-git clone https://github.com/krakenrf/krakensdr_doa
-cd krakensdr_doa
-git checkout clientside_graphs
-```
-
-Copy the the *krakensdr_doa/util/kraken_doa_start.sh* and the *krakensdr_doa/util/kraken_doa_stop.sh* scripts into the krakensdr root folder of the project.
-```bash
-cd ~/krakensdr
-cp krakensdr_doa/util/kraken_doa_start.sh .
-cp krakensdr_doa/util/kraken_doa_stop.sh .
-```
-
-## Running
-
-### Local operation (Recommended)
-
-```bash
-./kraken_doa_start.sh
-```
-
-Please be patient on the first run, at it can take 1-2 minutes for the JIT numba compiler to compile the numba optimized functions, and during this compilation time it may appear that the software has gotten stuck. On subsqeuent runs this loading time will be much faster as it will read from cache.
-
-### Remote operation
-
-1. Start the DAQ Subsystem either remotely. (Make sure that the *daq_chain_config.ini* contains the proper configuration)
- (See:https://github.com/krakenrf/heimdall_daq_fw/Documentation)
-2. Set the IP address of the DAQ Subsystem in the settings.json, *default_ip* field.
-3. Start the DoA DSP software by typing:
-`./gui_run.sh`
-4. To stop the server and the DSP processing chain run the following script:
-`./kill.sh`
-
-<p1> After starting the script a web based server opens at port number 8051, which then can be accessed by typing "KRAKEN_IP:8050/" in the address bar of any web browser. You can find the IP address of the KrakenSDR Pi4 wither via your routers WiFi management page, or by typing "ip addr" into the terminal. You can also use the hostname of the Pi4 in place of the IP address, but this only works on local networks, and not the internet, or mobile hotspot networks. </p1>
-
- ![image info](./doc/kraken_doadsp_main.png)
-
-## Upcoming Features and Known Bugs
-
-1. [FEATURE] Currently squelch works by selecting the strongest signal that is active and above the set threshold within the active bandwidth. The next steps will be to allow users to create multiple channels within the active bandwidth, each with their own squelch. This will allow users to track multiple signals at once, and ignore unwated signals within the bandwidth at the same time.
-
-2. [FEATURE] It would be better if the KrakenSDR controls, spectrum and/or DOA graphs could be accessible from the same page. Future work will look to integrate the controls in a sidebar.
-
-3. [FEATURE] Some users would like to monitor the spectrum, and manually click on an active signal to DF that particular signal. We will be looking at a way to implement this.
-
-4. [BUG] Sometimes the DOA graphs will not load properly and refreshing the page is required. A fix is being investigated.
-
-This software was 95% developed by Tamas Peto, and makes use of his pyAPRIL and pyARGUS libraries. See his website at www.tamaspeto.com
diff --git a/util/_UI/_web_interface/assets/style.css b/util/_UI/_web_interface/assets/style.css
deleted file mode 100755
index 1e39de9..0000000
--- a/util/_UI/_web_interface/assets/style.css
+++ /dev/null
@@ -1,215 +0,0 @@
-/*Globlal Properties*/
-/*Tags*/
-body {
- background-color: #000000;
- color:#ffffff;
- margin: 0px;
- padding: 0px;
-}
-*{
- font-size:18px;
- font-family: 'Montserrat', sans-serif;
-}
-h1{
- font-size:22px;
-}
-a{
- font-size: 22px;
-}
-input[type="checkbox"]{
- width:20px;
- height:20px;
- background:white;
- border-radius:5px;
- border:2px solid #555;
- vertical-align: text-bottom;
-}
-.Select-control {
- background-color:#000000;
-}
-.Select-value {
- background-color: rgb(255, 102, 0);
- color:#000000;
-}
-.Select-menu-outer {
- background-color: rgb(0, 0, 0);
-}
-
-input, select{
- width: 100%;
-}
-iframe{
- background-color: transparent;
- border: 0px none transparent;
- padding: 0px;
- overflow: hidden;
-}
-/*Classes*/
-.header{
- background-color: #000000;
- width: 100%;
- text-align: center;
- padding: 10px;
-}
-.header a{
- color: white;
- text-transform: uppercase;
- text-decoration: none;
- padding: 5px;
- line-height: 40px;
- border: 0.1em solid #ffffff;
- border-radius:0.05em;
- margin: 5px;
-}
-.header_active, .header a:hover{
- background-color: #ff6600c0;
-}
-.ctr_toolbar{
- background-color: #000000;
- height: 50px;
- width: 100%;
- text-align: center;
-}
-.ctr_toolbar_item {
- text-align: center;
- display : inline-block;
- position : relative;
- margin : 0 auto;
- padding : 0px;
- float : center;
-}
-.doa_check{
- text-align: left;
-}
-.btn{
- height: 40px;
- cursor: pointer;
- background-color: #141414;
- border: 0.1em solid #000000;
- border-radius:0.12em;
- color: white;
- font-size:20px;
- text-decoration: none;
- text-align: center;
- width: 100%;
- transition: all 0.2s;
-}
-.btn:hover{
- color: rgb(0, 0, 0);
- background-color: #ff6600;
-}
-.btn a{
- color: white;
- text-decoration: none;
- position: relative;
- top: 15%;
-}
-.btn_start{
- height: 40px;
- cursor: pointer;
- background-color: #02c93d;
- border: 0.1em solid #000000;
- border-radius:0.12em;
- color: rgb(0, 0, 0);
- font-size:20px;
- text-decoration: none;
- text-align: center;
- width: 100%;
- transition: all 0.2s;
-}
-.btn_start:hover{
- color: rgb(0, 0, 0);
- background-color: #ff6600;
-}
-.btn_stop{
- height: 40px;
- cursor: pointer;
- background-color: #c40404;
- border: 0.1em solid #000000;
- border-radius:0.12em;
- color: rgb(0, 0, 0);
- font-size:20px;
- text-decoration: none;
- text-align: center;
- width: 100%;
-}
-.btn_stop:hover{
- color: rgb(0, 0, 0);
- background-color: #ff6600;
-}
-.btn_save_cfg{
- height: 40px;
- cursor: pointer;
- background-color: #b5aef5;
- border: 0.1em solid #000000;
- border-radius:0.12em;
- color: rgb(0, 0, 0);
- font-size:20px;
- text-decoration: none;
- text-align: center;
- width: 100%;
-}
-.btn_save_cfg:hover{
- color: rgb(154, 233, 102);
- background-color: #ff6600;
-}
-.tooltip{
- color: rgb(0, 0, 0);
- background-color: #ffffff;
- opacity: 0.95;
- border-radius:0.2em;
- width: 300px;
-}
-.card{
- background-color: #000000;
- border: 0.1em solid #ffffff;
- border-radius:0.2em;
- width: 400px;
- max-width: 500px;
- padding: 20px;
- box-shadow: 0 6px 18px rgba(0, 0, 0, 0.46);
- margin: 10px;
- float: left;
-}
-.monitor_card{
- background-color: #000000;
- border: 0.1em solid #ffffff;
- border-radius:0.2em;
- width: 95%;
- height: 800px;
- overflow:scroll;
- box-shadow: 0 6px 18px rgba(0, 0, 0, 0.46);
- margin: auto;
- }
-
-.field{
- width: 400px;
- display: block;
- margin: 10px auto;
- padding: 0px;
-}
-.field-label{
- width: 250px;
- display: inline-block;
- vertical-align: top;
-}
-.field-body{
- width: 144px;
- display: inline-block;
-}
-
-/*Mobile Properties*/
-@media screen and (max-width: 1072px) {
- .card{
- width: calc( 100% - 30px );
- padding: 5px;
- margin: 20px auto;
- float: none;
- }
-}
-
-@media screen and (max-width: 500px) {
- .field, .field-label, .field-body, input{
- width: calc( 100% - 15px );
- }
-}
diff --git a/util/_UI/_web_interface/kraken_web_interface.py b/util/_UI/_web_interface/kraken_web_interface.py
deleted file mode 100755
index 7c1c90a..0000000
--- a/util/_UI/_web_interface/kraken_web_interface.py
+++ /dev/null
@@ -1,1916 +0,0 @@
-# KrakenSDR Signal Processor
-#
-# Copyright (C) 2018-2021 Carl Laufer, Tamás Pető
-#
-# 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
-# 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 <https://www.gnu.org/licenses/>.
-#
-#
-# - coding: utf-8 -*-
-
-# Import built-in modules
-import logging
-import os
-import sys
-import queue
-import time
-import subprocess
-import orjson
-# Import third-party modules
-
-#Testing dash_devices
-
-#import dash
-#from dash.dependencies import Input, Output, State
-
-#import plotly.io as pio
-#pio.renderers.default = 'iframe'
-
-import dash_core_components as dcc
-import dash_html_components as html
-
-import dash_devices as dash
-from dash_devices.dependencies import Input, Output, State
-#from dash import html
-
-
-from dash.exceptions import PreventUpdate
-from dash.dash import no_update
-import plotly.graph_objects as go
-import plotly.express as px
-import numpy as np
-from configparser import ConfigParser
-from numba import njit, jit
-
-#from waitress import serve
-#from gevent.pywsgi import WSGIServer
-
-from threading import Timer
-
-# Import Kraken SDR modules
-current_path = os.path.dirname(os.path.realpath(__file__))
-root_path = os.path.dirname(os.path.dirname(current_path))
-receiver_path = os.path.join(root_path, "_receiver")
-signal_processor_path = os.path.join(root_path, "_signal_processing")
-ui_path = os.path.join(root_path, "_UI")
-
-sys.path.insert(0, receiver_path)
-sys.path.insert(0, signal_processor_path)
-sys.path.insert(0, ui_path)
-
-daq_subsystem_path = os.path.join(
- os.path.join(os.path.dirname(root_path),
- "heimdall_daq_fw"),
- "Firmware")
-daq_preconfigs_path = os.path.join(
- os.path.join(os.path.dirname(root_path),
- "heimdall_daq_fw"),
- "config_files")
-daq_config_filename = os.path.join(daq_subsystem_path, "daq_chain_config.ini")
-daq_stop_filename = "daq_stop.sh"
-daq_start_filename = "daq_start_sm.sh"
-#daq_start_filename = "daq_synthetic_start.sh"
-sys.path.insert(0, daq_subsystem_path)
-
-import ini_checker
-import save_settings as settings
-from krakenSDR_receiver import ReceiverRTLSDR
-from krakenSDR_signal_processor import SignalProcessor
-
-import tooltips
-
-class webInterface():
-
- def __init__(self):
- self.user_interface = None
-
- logging.basicConfig(level=settings.logging_level*10)
- self.logger = logging.getLogger(__name__)
- self.logger.setLevel(settings.logging_level*10)
- self.logger.info("Inititalizing web interface ")
- if not settings.settings_found:
- self.logger.warning("Web Interface settings file is not found!")
-
- #############################################
- # Initialize and Configure Kraken modules #
- #############################################
-
- # Web interface internal
- self.disable_tooltips = settings.disable_tooltips
- self.page_update_rate = 1
- self._avg_win_size = 10
- self._update_rate_arr = None
- #self._doa_method = settings.doa_method_dict[settings.doa_method]
- #self._doa_fig_type = settings.doa_fig_type_dict[settings.doa_fig_type]
-
- self.sp_data_que = queue.Queue(1) # Que to communicate with the signal processing module
- self.rx_data_que = queue.Queue(1) # Que to communicate with the receiver modules
-
- # Instantiate and configure Kraken SDR modules
- self.module_receiver = ReceiverRTLSDR(data_que=self.rx_data_que, data_interface=settings.data_interface, logging_level=settings.logging_level*10)
- self.module_receiver.daq_center_freq = settings.center_freq*10**6
- self.module_receiver.daq_rx_gain = settings.uniform_gain
- #self.module_receiver.daq_squelch_th_dB = settings.squelch_threshold_dB
- self.module_receiver.rec_ip_addr = settings.default_ip
-
- self.module_signal_processor = SignalProcessor(data_que=self.sp_data_que, module_receiver=self.module_receiver, logging_level=settings.logging_level*10)
- #self.module_signal_processor.DOA_ant_alignment = settings.ant_arrangement
- #self.module_signal_processor.DOA_inter_elem_space = settings.ant_spacing
- self.module_signal_processor.en_PR = settings.en_pr
- self.module_signal_processor.PR_clutter_cancellation = settings.clutter_cancel_algo
- self.module_signal_processor.max_bistatic_range = settings.max_bistatic_range
- self.module_signal_processor.max_doppler = settings.max_doppler
- self.en_persist = settings.en_pr_persist
- self.pr_persist_decay = settings.pr_persist_decay
- self.pr_dynamic_range_min = settings.pr_dynrange_min
- self.pr_dynamic_range_max = settings.pr_dynrange_max
-
- #self.module_signal_processor.en_DOA_FB_avg = settings.en_fbavg
- #self.module_signal_processor.en_squelch = settings.en_squelch
- #self.config_doa_in_signal_processor()
- self.module_signal_processor.start()
-
- #############################################
- # UI Status and Config variables #
- #############################################
-
- # DAQ Subsystem status parameters
- self.daq_conn_status = 0
- self.daq_cfg_iface_status = 0 # 0- ready, 1-busy
- self.daq_restart = 0 # 1-restarting
- self.daq_update_rate = 0
- self.daq_frame_sync = 1 # Active low
- self.daq_frame_index = 0
- self.daq_frame_type = "-"
- self.daq_power_level = 0
- self.daq_sample_delay_sync = 0
- self.daq_iq_sync = 0
- self.daq_noise_source_state= 0
- self.daq_center_freq = settings.center_freq
- self.daq_adc_fs = "-"
- self.daq_fs = "-"
- self.daq_cpi = "-"
- self.daq_if_gains ="[,,,,]"
- self.en_advanced_daq_cfg = False #settings.en_advanced_daq_cfg
- self.daq_ini_cfg_params = read_config_file()
- self.active_daq_ini_cfg = self.daq_ini_cfg_params[0] #"Default" # Holds the string identifier of the actively loaded DAQ ini configuration
- self.tmp_daq_ini_cfg = "Default"
- self.daq_cfg_ini_error = ""
-
- # DSP Processing Parameters and Results
- self.spectrum = None
- #self.doa_thetas = None
- #self.doa_results = []
- #self.doa_labels = []
- #self.doas = [] # Final measured DoAs [deg]
- #self.doa_confidences = []
- #self.compass_ofset = settings.compass_offset
- self.daq_dsp_latency = 0 # [ms]
- #self.max_amplitude = 0 # Used to help setting the threshold level of the squelch
- #self.avg_powers = []
- self.logger.info("Web interface object initialized")
-
- # Passive Radar Data
- self.RD_matrix = None
-
- self.dsp_timer = None
- self.update_time = 9999
-
- self.pathname = ""
- self.reset_doa_graph_flag = False
- self.reset_spectrum_graph_flag = False
-
- #self.CAFMatrixOld = 0
- #self.en_persist = True
- #self.pr_persist_decay = 0.99
- #self.pr_dynamic_range_min = -20
- #self.pr_dynamic_range_max = 100
- self.CAFMatrixPersist = None
-
- # Basic DAQ Config
- self.decimated_bandwidth = 12.5
-
- if self.daq_ini_cfg_params is not None:
- self.logger.info("Config file found and read succesfully")
- """
- Set the number of channels in the receiver module because it is required
- to produce the initial gain configuration message (Only needed in shared-memory mode)
- """
- self.module_receiver.M = self.daq_ini_cfg_params[1]
-
- # Set initial Squelch parameters based on the content of the active config file
- #if self.daq_ini_cfg_params[5]: # Squelch is enabled
- # self.module_signal_processor.en_squelch = True
- # self.module_receiver.daq_squelch_th_dB = -80 #round(20*np.log10(self.daq_ini_cfg_params[6]),1)
- #self.module_signal_processor.squelch_threshold = self.daq_ini_cfg_params[6]
- # Note: There is no need to set the thresold in the DAQ Subsystem as it is configured from the ini-file.
- #else: # Squelch is disabled
- # self.module_signal_processor.en_squelch = False
-
-
-
- def save_configuration(self):
- data = {}
-
- # DAQ Configuration
- data["center_freq"] = self.module_receiver.daq_center_freq/10**6
- data["uniform_gain"] = self.module_receiver.daq_rx_gain
- data["data_interface"] = settings.data_interface
- data["default_ip"] = settings.default_ip
-
- # DOA Estimation
- data["en_pr"] = self.module_signal_processor.en_PR
-
- data["clutter_cancel_algo"] = self.module_signal_processor.PR_clutter_cancellation
- data["max_bistatic_range"] = self.module_signal_processor.max_bistatic_range
- data["max_doppler"] = self.module_signal_processor.max_doppler
- data["en_pr_persist"] = self.en_persist
- data["pr_persist_decay"] = self.pr_persist_decay
- data["pr_dynrange_min"] = self.pr_dynamic_range_min
- data["pr_dynrange_max"] = self.pr_dynamic_range_max
-
-
- #data["ant_arrangement"] = self.module_signal_processor.DOA_ant_alignment
- #data["ant_spacing"] = self.module_signal_processor.DOA_inter_elem_space
- #doa_method = "MUSIC"
- #for key, val in (settings.doa_method_dict).items():
- # if val == self._doa_method:
- # doa_method = key
- #data["doa_method"] = doa_method
- #data["en_fbavg"] = self.module_signal_processor.en_DOA_FB_avg
- #data["compass_offset"] = self.compass_ofset
- #doa_fig_type = "Linear plot"
- #for key, val in (settings.doa_fig_type_dict).items():
- # if val == self._doa_fig_type:
- # doa_fig_type = key
-
- #data["doa_fig_type"] = doa_fig_type
-
- # DSP misc
- #data["en_squelch"] = self.module_signal_processor.en_squelch
- #data["squelch_threshold_dB"] = self.module_receiver.daq_squelch_th_dB
-
- # Web Interface
- data["en_hw_check"] = settings.en_hw_check
- data["en_advanced_daq_cfg"] = self.en_advanced_daq_cfg
- data["logging_level"] = settings.logging_level
- data["disable_tooltips"] = settings.disable_tooltips
-
- settings.write(data)
- def start_processing(self):
- """
- Starts data processing
-
- Parameters:
- -----------
- :param: ip_addr: Ip address of the DAQ Subsystem
-
- :type ip_addr : string e.g.:"127.0.0.1"
- """
- self.logger.info("Start processing request")
- self.first_frame = 1
- #self.module_receiver.rec_ip_addr = "0.0.0.0"
- self.module_signal_processor.run_processing=True
- def stop_processing(self):
- self.module_signal_processor.run_processing=False
- while self.module_signal_processor.is_running: time.sleep(0.01) # Block until signal processor run_processing while loop ends
- def close_data_interfaces(self):
- self.module_receiver.eth_close()
- def close(self):
- pass
- """
- def config_doa_in_signal_processor(self):
- if self._doa_method == 0:
- self.module_signal_processor.en_DOA_Bartlett = True
- self.module_signal_processor.en_DOA_Capon = False
- self.module_signal_processor.en_DOA_MEM = False
- self.module_signal_processor.en_DOA_MUSIC = False
- elif self._doa_method == 1:
- self.module_signal_processor.en_DOA_Bartlett = False
- self.module_signal_processor.en_DOA_Capon = True
- self.module_signal_processor.en_DOA_MEM = False
- self.module_signal_processor.en_DOA_MUSIC = False
- elif self._doa_method == 2:
- self.module_signal_processor.en_DOA_Bartlett = False
- self.module_signal_processor.en_DOA_Capon = False
- self.module_signal_processor.en_DOA_MEM = True
- self.module_signal_processor.en_DOA_MUSIC = False
- elif self._doa_method == 3:
- self.module_signal_processor.en_DOA_Bartlett = False
- self.module_signal_processor.en_DOA_Capon = False
- self.module_signal_processor.en_DOA_MEM = False
- self.module_signal_processor.en_DOA_MUSIC = True
- """
- def config_squelch_value(self, squelch_threshold_dB):
- """
- Configures the squelch thresold both on the DAQ side and
- on the local DoA DSP side.
- """
- #NOT USING THIS ANYMORE
- self.daq_cfg_iface_status = 1
- #self.module_signal_processor.squelch_threshold = 10**(squelch_threshold_dB/20)
- #self.module_receiver.set_squelch_threshold(squelch_threshold_dB)
- #webInterface_inst.logger.info("Updating receiver parameters")
- #webInterface_inst.logger.info("Squelch threshold : {:f} dB".format(squelch_threshold_dB))
- def config_daq_rf(self, f0, gain):
- """
- Configures the RF parameters in the DAQ module
- """
- self.daq_cfg_iface_status = 1
- self.module_receiver.set_center_freq(int(f0*10**6))
- self.module_receiver.set_if_gain(gain)
-
- webInterface_inst.logger.info("Updating receiver parameters")
- webInterface_inst.logger.info("Center frequency: {:f} MHz".format(f0))
- webInterface_inst.logger.info("Gain: {:f} dB".format(gain))
-
-
-
-
-def read_config_file(config_fname=daq_config_filename):
- parser = ConfigParser()
- found = parser.read([config_fname])
- param_list = []
- if not found:
- return None
- param_list.append(parser.get('meta', 'config_name'))
-
- param_list.append(parser.getint('hw', 'num_ch'))
-
- param_list.append(parser.getint('daq','daq_buffer_size'))
- param_list.append(parser.getint('daq','sample_rate'))
- param_list.append(parser.getint('daq','en_noise_source_ctr'))
-
- param_list.append(parser.getint('squelch','en_squelch'))
- param_list.append(parser.getfloat('squelch','amplitude_threshold'))
-
- param_list.append(parser.getint('pre_processing', 'cpi_size'))
- param_list.append(parser.getint('pre_processing', 'decimation_ratio'))
- param_list.append(parser.getfloat('pre_processing', 'fir_relative_bandwidth'))
- param_list.append(parser.getint('pre_processing', 'fir_tap_size'))
- param_list.append(parser.get('pre_processing','fir_window'))
- param_list.append(parser.getint('pre_processing','en_filter_reset'))
-
- param_list.append(parser.getint('calibration','corr_size'))
- param_list.append(parser.getint('calibration','std_ch_ind'))
- param_list.append(parser.getint('calibration','en_iq_cal'))
- param_list.append(parser.getint('calibration','gain_lock_interval'))
- param_list.append(parser.getint('calibration','require_track_lock_intervention'))
- param_list.append(parser.getint('calibration','cal_track_mode'))
- param_list.append(parser.get('calibration','amplitude_cal_mode'))
- param_list.append(parser.getint('calibration','cal_frame_interval'))
- param_list.append(parser.getint('calibration','cal_frame_burst_size'))
- param_list.append(parser.getint('calibration','amplitude_tolerance'))
- param_list.append(parser.getint('calibration','phase_tolerance'))
- param_list.append(parser.getint('calibration','maximum_sync_fails'))
-
- param_list.append(parser.get('data_interface','out_data_iface_type'))
-
- return param_list
-
-def write_config_file(param_list):
- webInterface_inst.logger.info("Write config file: {0}".format(param_list))
- parser = ConfigParser()
- found = parser.read([daq_config_filename])
- if not found:
- return -1
-
- parser['meta']['config_name']=str(param_list[0])
-
- parser['hw']['num_ch']=str(param_list[1])
-
- parser['daq']['daq_buffer_size']=str(param_list[2])
- parser['daq']['sample_rate']=str(param_list[3])
- parser['daq']['en_noise_source_ctr']=str(param_list[4])
-
- parser['squelch']['en_squelch']=str(param_list[5])
- parser['squelch']['amplitude_threshold']=str(param_list[6])
-
- parser['pre_processing']['cpi_size']=str(param_list[7])
- parser['pre_processing']['decimation_ratio']=str(param_list[8])
- parser['pre_processing']['fir_relative_bandwidth']=str(param_list[9])
- parser['pre_processing']['fir_tap_size']=str(param_list[10])
- parser['pre_processing']['fir_window']=str(param_list[11])
- parser['pre_processing']['en_filter_reset']=str(param_list[12])
-
- parser['calibration']['corr_size']=str(param_list[13])
- parser['calibration']['std_ch_ind']=str(param_list[14])
- parser['calibration']['en_iq_cal']=str(param_list[15])
- parser['calibration']['gain_lock_interval']=str(param_list[16])
- parser['calibration']['require_track_lock_intervention']=str(param_list[17])
- parser['calibration']['cal_track_mode']=str(param_list[18])
- parser['calibration']['amplitude_cal_mode']=str(param_list[19])
- parser['calibration']['cal_frame_interval']=str(param_list[20])
- parser['calibration']['cal_frame_burst_size']=str(param_list[21])
- parser['calibration']['amplitude_tolerance']=str(param_list[22])
- parser['calibration']['phase_tolerance']=str(param_list[23])
- parser['calibration']['maximum_sync_fails']=str(param_list[24])
-
- ini_parameters = parser._sections
- error_list = ini_checker.check_ini(ini_parameters, settings.en_hw_check)
- if len(error_list):
- for e in error_list:
- webInterface_inst.logger.error(e)
- return -1, error_list
- else:
- with open(daq_config_filename, 'w') as configfile:
- parser.write(configfile)
- return 0,[]
-
-def get_preconfigs(config_files_path):
- parser = ConfigParser()
- preconfigs = []
- preconfigs.append([daq_config_filename, "Current"])
- for root, dirs, files in os.walk(config_files_path):
- if len(files):
- config_file_path = os.path.join(root, files[0])
- parser.read([config_file_path])
- parameters = parser._sections
- preconfigs.append([config_file_path, parameters['meta']['config_name']])
- return preconfigs
-
-
-#############################################
-# Prepare Dash application #
-############################################
-webInterface_inst = webInterface()
-
-
-#############################################
-# Prepare component dependencies #
-#############################################
-
-trace_colors = px.colors.qualitative.Plotly
-trace_colors[3] = 'rgb(255,255,51)'
-valid_fir_windows = ['boxcar', 'triang', 'blackman', 'hamming', 'hann', 'bartlett', 'flattop', 'parzen' , 'bohman', 'blackmanharris', 'nuttall', 'barthann']
-valid_sample_rates = [0.25, 0.900001, 1.024, 1.4, 1.8, 1.92, 2.048, 2.4, 2.56, 3.2]
-valid_daq_buffer_sizes = (2**np.arange(10,21,1)).tolist()
-calibration_tack_modes = [['No tracking',0] , ['Periodic tracking',2]]
-doa_trace_colors = {
- "DoA Bartlett": "#00B5F7",
- "DoA Capon" : "rgb(226,26,28)",
- "DoA MEM" : "#1CA71C",
- "DoA MUSIC" : "rgb(257,233,111)"
-}
-figure_font_size = 20
-
-y=np.random.normal(0,1,2**3)
-x=np.arange(2**3)
-
-fig_layout = go.Layout(
- paper_bgcolor='rgba(0,0,0,0)',
- plot_bgcolor='rgba(0,0,0,0)',
- template='plotly_dark',
- showlegend=True,
- margin=go.layout.Margin(
- t=0 #top margin
- )
- )
-
-fig_dummy = go.Figure(layout=fig_layout)
-#fig_dummy.add_trace(go.Scatter(x=x, y=y, name = "Avg spectrum"))
-
-for m in range(0, webInterface_inst.module_receiver.M+1): #+1 for the auto decimation window selection
- fig_dummy.add_trace(go.Scatter(x=x,
- y=y,
- name="Channel {:d}".format(m),
- line = dict(color = trace_colors[m],
- width = 2)
- ))
-
-
-fig_dummy.update_xaxes(title_text="Frequency [MHz]")
-fig_dummy.update_yaxes(title_text="Amplitude [dB]")
-
-option = [{"label":"", "value": 1}]
-
-spectrum_fig = go.Figure(layout=fig_layout)
-
-for m in range(0, webInterface_inst.module_receiver.M+1): #+1 for the auto decimation window selection
- spectrum_fig.add_trace(go.Scattergl(x=x,
- y=y,
- name="Channel {:d}".format(m),
- line = dict(color = trace_colors[m],
- width = 2)
- ))
-
-
-#waterfall_fig = go.Figure(layout=fig_layout)
-#waterfall_fig.add_trace(go.Heatmapgl(
-# z=waterfall_init))
-# z=[[1,2,3,4,5]]))
-
-
-waterfall_init = [[-80] * webInterface_inst.module_signal_processor.spectrum_window_size] * 50
-waterfall_fig = go.Figure(layout=fig_layout)
-waterfall_fig.add_trace(go.Heatmapgl(
- z=waterfall_init,
- zsmooth=False,
- showscale=False,
- hoverinfo='skip',
- colorscale=[[0.0, '#000020'],
- [0.0714, '#000030'],
- [0.1428, '#000050'],
- [0.2142, '#000091'],
- [0.2856, '#1E90FF'],
- [0.357, '#FFFFFF'],
- [0.4284, '#FFFF00'],
- [0.4998, '#FE6D16'],
- [0.5712, '#FE6D16'],
- [0.6426, '#FF0000'],
- [0.714, '#FF0000'],
- [0.7854, '#C60000'],
- [0.8568, '#9F0000'],
- [0.9282, '#750000'],
- [1.0, '#4A0000']]))
-
-
-waterfall_fig.update_xaxes(tickfont_size=1)
-waterfall_fig.update_yaxes(tickfont_size=1)
-waterfall_fig.update_layout(margin=go.layout.Margin(t=5))
-
-
-
-pr_init = [[-80] * 128] * 128
-pr_fig = go.Figure(layout=fig_layout)
-pr_fig.add_trace(go.Heatmap(
- z=pr_init,
- zsmooth='best', #False,
- #zsmooth=False, #False,
- showscale=False,
- #hoverinfo='skip',
- colorscale=[[0.0, '#000020'],
- [0.0714, '#000030'],
- [0.1428, '#000050'],
- [0.2142, '#000091'],
- [0.2856, '#1E90FF'],
- [0.357, '#FFFFFF'],
- [0.4284, '#FFFF00'],
- [0.4998, '#FE6D16'],
- [0.5712, '#FE6D16'],
- [0.6426, '#FF0000'],
- [0.714, '#FF0000'],
- [0.7854, '#C60000'],
- [0.8568, '#9F0000'],
- [0.9282, '#750000'],
- [1.0, '#4A0000']]))
-
-
-
-#app = dash.Dash(__name__, suppress_callback_exceptions=True, compress=True, update_title="") # cannot use update_title with dash_devices
-app = dash.Dash(__name__, suppress_callback_exceptions=True, compress=False)
-
-# app_log = logger.getLogger('werkzeug')
-# app_log.setLevel(settings.logging_level*10)
-# app_log.setLevel(30) # TODO: Only during dev time
-app.layout = html.Div([
- dcc.Location(id='url', children='/config',refresh=False),
-
- html.Div([html.H1('KrakenSDR - Passive Radar')], style={"text-align": "center"}, className="main_title"),
- html.Div([html.A("Configuration", className="header_active" , id="header_config" ,href="/config"),
- html.A("Spectrum" , className="header_inactive" , id="header_spectrum",href="/spectrum"),
- html.A("Passive Radar" , className="header_inactive" , id="header_doa" ,href="/pr"),
- ], className="header"),
- html.Div([html.Div([html.Button('Start Processing', id='btn-start_proc', className="btn_start", n_clicks=0)], className="ctr_toolbar_item"),
- html.Div([html.Button('Stop Processing', id='btn-stop_proc', className="btn_stop", n_clicks=0)], className="ctr_toolbar_item"),
- html.Div([html.Button('Save Configuration', id='btn-save_cfg', className="btn_save_cfg", n_clicks=0)], className="ctr_toolbar_item")
- ], className="ctr_toolbar"),
-
- dcc.Interval(
- id="mem_leak_refresh_interval",
- interval= 300 * 1000, # Every 5mins TEST
- ),
-
-
- #dcc.Interval(
- # id='interval-component',
- # interval=500, # in milliseconds
- # n_intervals=0
- #),
- html.Div(id="placeholder_start" , style={"display":"none"}),
- html.Div(id="placeholder_stop" , style={"display":"none"}),
- html.Div(id="placeholder_save" , style={"display":"none"}),
- html.Div(id="placeholder_update_rx" , style={"display":"none"}),
- html.Div(id="placeholder_recofnig_daq" , style={"display":"none"}),
- html.Div(id="placeholder_update_daq_ini_params", style={"display":"none"}),
- html.Div(id="placeholder_update_freq" , style={"display":"none"}),
- html.Div(id="placeholder_update_dsp" , style={"display":"none"}),
- html.Div(id="placeholder_update_squelch" , style={"display":"none"}),
- html.Div(id="placeholder_config_page_upd" , style={"display":"none"}),
- html.Div(id="placeholder_spectrum_page_upd" , style={"display":"none"}),
- html.Div(id="placeholder_doa_page_upd" , style={"display":"none"}),
- html.Div(id="dummy_output" , style={"display":"none"}),
-
- html.Div(id='page-content')
-])
-def generate_config_page_layout(webInterface_inst):
- # Read DAQ config file
- daq_cfg_params = webInterface_inst.daq_ini_cfg_params
-
- if daq_cfg_params is not None:
- en_noise_src_values =[1] if daq_cfg_params[4] else []
- en_squelch_values =[1] if daq_cfg_params[5] else []
- en_filter_rst_values =[1] if daq_cfg_params[12] else []
- en_iq_cal_values =[1] if daq_cfg_params[15] else []
- en_req_track_lock_values =[1] if daq_cfg_params[17] else []
-
- #daq_data_iface_type = daq_cfg_params[25]
-
- # Read available preconfig files
- preconfigs = get_preconfigs(daq_preconfigs_path)
-
- en_persist_values =[1] if webInterface_inst.en_persist else []
- en_pr_values =[1] if webInterface_inst.module_signal_processor.en_PR else []
- #en_fb_avg_values =[1] if webInterface_inst.module_signal_processor.en_DOA_FB_avg else []
- #en_dsp_squelch_values =[1] if webInterface_inst.module_signal_processor.en_squelch else []
-
- en_advanced_daq_cfg =[1] if webInterface_inst.en_advanced_daq_cfg else []
- # Calulcate spacings
- wavelength= 300 / webInterface_inst.daq_center_freq
-
- ant_spacing_wavelength = webInterface_inst.module_signal_processor.DOA_inter_elem_space
- ant_spacing_meter = round(wavelength * ant_spacing_wavelength, 3)
- ant_spacing_feet = ant_spacing_meter*3.2808399
- ant_spacing_inch = ant_spacing_meter*39.3700787
-
- cfg_decimated_bw = ((daq_cfg_params[3]) / daq_cfg_params[8]) / 10**3
- cfg_data_block_len = ( daq_cfg_params[7] / (cfg_decimated_bw) )
- cfg_recal_interval = (daq_cfg_params[20] * (cfg_data_block_len/10**3)) / 60
-
- if daq_cfg_params[18] == 0: #If set to no tracking
- cfg_recal_interval = 1
-
-
- #for preconfig in preconfigs:
- # print(preconfig[0])
-
- #-----------------------------
- # DAQ Configuration Card
- #-----------------------------
- # -- > Main Card Layout < --
- daq_config_card_list = \
- [
- html.H2("RF Receiver Configuration", id="init_title_c"),
- html.Div([
- html.Div("Center Frequency [MHz]", className="field-label"),
- dcc.Input(id='daq_center_freq', value=webInterface_inst.module_receiver.daq_center_freq/10**6, type='number', debounce=True, className="field-body")
- ], className="field"),
- html.Div([
- html.Div("Receiver gain", className="field-label"),
- dcc.Dropdown(id='daq_rx_gain',
- options=[
- {'label': '0 dB', 'value': 0},
- {'label': '0.9 dB', 'value': 0.9},
- {'label': '1.4 dB', 'value': 1.4},
- {'label': '2.7 dB', 'value': 2.7},
- {'label': '3.7 dB', 'value': 3.7},
- {'label': '7.7 dB', 'value': 7.7},
- {'label': '8.7 dB', 'value': 8.7},
- {'label': '12.5 dB', 'value': 12.5},
- {'label': '14.4 dB', 'value': 14.4},
- {'label': '15.7 dB', 'value': 15.7},
- {'label': '16.6 dB', 'value': 16.6},
- {'label': '19.7 dB', 'value': 19.7},
- {'label': '20.7 dB', 'value': 20.7},
- {'label': '22.9 dB', 'value': 22.9},
- {'label': '25.4 dB', 'value': 25.4},
- {'label': '28.0 dB', 'value': 28.0},
- {'label': '29.7 dB', 'value': 29.7},
- {'label': '32.8 dB', 'value': 32.8},
- {'label': '33.8 dB', 'value': 33.8},
- {'label': '36.4 dB', 'value': 36.4},
- {'label': '37.2 dB', 'value': 37.2},
- {'label': '38.6 dB', 'value': 38.6},
- {'label': '40.2 dB', 'value': 40.2},
- {'label': '42.1 dB', 'value': 42.1},
- {'label': '43.4 dB', 'value': 43.4},
- {'label': '43.9 dB', 'value': 43.9},
- {'label': '44.5 dB', 'value': 44.5},
- {'label': '48.0 dB', 'value': 48.0},
- {'label': '49.6 dB', 'value': 49.6},
- ],
- value=webInterface_inst.module_receiver.daq_rx_gain, clearable=False, className="field-body"),
- ], className="field"),
- html.Div([
- html.Button('Update Receiver Parameters', id='btn-update_rx_param', className="btn"),
- ], className="field"),
-
-
- html.Div([
- html.Div("Preconfigured DAQ Files", className="field-label"),
- dcc.Dropdown(id='daq_cfg_files',
- options=[
- {'label': str(i[1]), 'value': i[0]} for i in preconfigs
- ],
- clearable=False,
- value=preconfigs[0][0],
- placeholder="Select Configuration File",
- persistence=True,
- style={"display":"inline-block", "width": "400px"},
- className="field-body"),
- ], className="field"),
- html.Div([
- html.Div("Active Configuration: " + webInterface_inst.active_daq_ini_cfg, id="active_daq_ini_cfg", className="field-label"),
- ], className="field"),
- html.Div([
- html.Div(webInterface_inst.daq_cfg_ini_error , id="daq_ini_check", className="field-label", style={"color":"red"}),
- ], className="field"),
-
- html.Div([html.Div("Basic Custom DAQ Configuration", id="label_en_basic_daq_cfg" , className="field-label")]),
- html.Div([
- html.Div("Data Block Length (ms):", className="field-label"),
- dcc.Input(id='cfg_data_block_len', value=cfg_data_block_len, type='number', debounce=True, className="field-body")
- ], className="field"),
- html.Div([
- html.Div("Decimated Bandwidth (kHz):", className="field-label"),
- dcc.Input(id='cfg_decimated_bw', value=cfg_decimated_bw, type='number', debounce=True, className="field-body")
- ], className="field"),
- html.Div([
- html.Div("Recalibration Interval (mins):", className="field-label"),
- dcc.Input(id='cfg_recal_interval', value=cfg_recal_interval, type='number', debounce=True, className="field-body")
- ], className="field"),
-
- html.Div([html.Div("Advanced Custom DAQ Configuration", id="label_en_advanced_daq_cfg" , className="field-label"),
- dcc.Checklist(options=option , id="en_advanced_daq_cfg" , className="field-body", value=en_advanced_daq_cfg),
- ], className="field"),
- ]
-
- # --> Optional DAQ Subsystem reconfiguration fields <--
- #if len(en_advanced_daq_cfg):
- # if daq_cfg_params is not None:
- daq_subsystem_reconfiguration_options = [ \
- html.Div([
-
- html.H2("DAQ Subsystem Reconfiguration", id="init_title_reconfig"),
- html.H3("HW", id="cfg_group_hw"),
- html.Div([
- html.Div("# RX Channels:", className="field-label"),
- dcc.Input(id='cfg_rx_channels', value=daq_cfg_params[1], type='number', debounce=True, className="field-body")
- ], className="field"),
- html.H3("DAQ", id="cfg_group_daq"),
- html.Div([
- html.Div("DAQ Buffer Size:", className="field-label", id="label_daq_buffer_size"),
- dcc.Dropdown(id='cfg_daq_buffer_size',
- options=[
- {'label': i, 'value': i} for i in valid_daq_buffer_sizes
- ],
- value=daq_cfg_params[2], style={"display":"inline-block"},className="field-body"),
- ], className="field"),
- html.Div([
- html.Div("Sample Rate [MHz]:", className="field-label", id="label_sample_rate"),
- dcc.Dropdown(id='cfg_sample_rate',
- options=[
- {'label': i, 'value': i} for i in valid_sample_rates
- ],
- value=daq_cfg_params[3]/10**6, style={"display":"inline-block"},className="field-body")
- ], className="field"),
- html.Div([
- html.Div("Enable Noise Source Control:", className="field-label", id="label_en_noise_source_ctr"),
- dcc.Checklist(options=option , id="en_noise_source_ctr" , className="field-body", value=en_noise_src_values),
- ], className="field"),
- html.H3("Squelch"),
- html.Div([
- html.Div("Enable DAQ Squelch (NOT ACTIVE):", className="field-label", id="label_en_squelch"),
- dcc.Checklist(options=option , id="en_squelch_mode" , className="field-body", value=en_squelch_values),
- ], className="field"),
- html.Div([
- html.Div("Initial Threshold:", className="field-label", id="label_squelch_init_threshold"),
- dcc.Input(id='cfg_squelch_init_th', value=daq_cfg_params[6], type='number', debounce=True, className="field-body")
- ], className="field"),
- html.H3("Pre Processing"),
- html.Div([
- html.Div("CPI Size [sample]:", className="field-label", id="label_cpi_size"),
- dcc.Input(id='cfg_cpi_size', value=daq_cfg_params[7], type='number', debounce=True, className="field-body")
- ], className="field"),
- html.Div([
- html.Div("Decimation Ratio:", className="field-label", id="label_decimation_ratio"),
- dcc.Input(id='cfg_decimation_ratio', value=daq_cfg_params[8], type='number', debounce=True, className="field-body")
- ], className="field"),
- html.Div([
- html.Div("FIR Relative Bandwidth:", className="field-label", id="label_fir_relative_bw"),
- dcc.Input(id='cfg_fir_bw', value=daq_cfg_params[9], type='number', debounce=True, className="field-body")
- ], className="field"),
- html.Div([
- html.Div("FIR Tap Size:", className="field-label", id="label_fir_tap_size"),
- dcc.Input(id='cfg_fir_tap_size', value=daq_cfg_params[10], type='number', debounce=True, className="field-body")
- ], className="field"),
- html.Div([
- html.Div("FIR Window:", className="field-label", id="label_fir_window"),
- dcc.Dropdown(id='cfg_fir_window',
- options=[
- {'label': i, 'value': i} for i in valid_fir_windows
- ],
- value=daq_cfg_params[11], style={"display":"inline-block"},className="field-body")
- ], className="field"),
- html.Div([
- html.Div("Enable Filter Reset:", className="field-label", id="label_en_filter_reset"),
- dcc.Checklist(options=option , id="en_filter_reset" , className="field-body", value=en_filter_rst_values),
- ], className="field"),
- html.H3("Calibration"),
- html.Div([
- html.Div("Correlation Size [sample]:", className="field-label", id="label_correlation_size"),
- dcc.Input(id='cfg_corr_size', value=daq_cfg_params[13], type='number', debounce=True, className="field-body")
- ], className="field"),
- html.Div([
- html.Div("Standard Channel Index:", className="field-label", id="label_std_ch_index"),
- dcc.Input(id='cfg_std_ch_ind', value=daq_cfg_params[14], type='number', debounce=True, className="field-body")
- ], className="field"),
- html.Div([
- html.Div("Enable IQ Calibration:", className="field-label", id="label_en_iq_calibration"),
- dcc.Checklist(options=option , id="en_iq_cal" , className="field-body", value=en_iq_cal_values),
- ], className="field"),
- html.Div([
- html.Div("Gain Lock Interval [frame]:", className="field-label", id="label_gain_lock_interval"),
- dcc.Input(id='cfg_gain_lock', value=daq_cfg_params[16], type='number', debounce=True, className="field-body")
- ], className="field"),
- html.Div([
- html.Div("Require Track Lock Intervention (For Kerberos):", className="field-label", id="label_require_track_lock"),
- dcc.Checklist(options=option , id="en_req_track_lock_intervention" , className="field-body", value=en_req_track_lock_values),
- ], className="field"),
- html.Div([
- html.Div("Calibration Track Mode:", className="field-label", id="label_calibration_track_mode"),
- dcc.Dropdown(id='cfg_cal_track_mode',
- options=[
- {'label': i[0], 'value': i[1]} for i in calibration_tack_modes
- ],
- value=daq_cfg_params[18], style={"display":"inline-block"},className="field-body"),
- ], className="field"),
- html.Div([
- html.Div("Amplitude Calibration Mode :", className="field-label", id="label_amplitude_calibration_mode"),
- dcc.Dropdown(id='cfg_amplitude_cal_mode',
- options=[
- {'label': 'default', 'value': 'default'},
- {'label': 'disabled', 'value': 'disabled'},
- {'label': 'channel_power', 'value': 'channel_power'}
- ],
- value=daq_cfg_params[19], style={"display":"inline-block"},className="field-body"),
- ], className="field"),
- html.Div([
- html.Div("Calibration Frame Interval:", className="field-label", id="label_calibration_frame_interval"),
- dcc.Input(id='cfg_cal_frame_interval', value=daq_cfg_params[20], type='number', debounce=True, className="field-body")
- ], className="field"),
- html.Div([
- html.Div("Calibration Frame Burst Size:", className="field-label", id="label_calibration_frame_burst_size"),
- dcc.Input(id='cfg_cal_frame_burst_size', value=daq_cfg_params[21], type='number', debounce=True, className="field-body")
- ], className="field"),
- html.Div([
- html.Div("Amplitude Tolerance [dB]:", className="field-label", id="label_amplitude_tolerance"),
- dcc.Input(id='cfg_amplitude_tolerance', value=daq_cfg_params[22], type='number', debounce=True, className="field-body")
- ], className="field"),
- html.Div([
- html.Div("Phase Tolerance [deg]:", className="field-label", id="label_phase_tolerance"),
- dcc.Input(id='cfg_phase_tolerance', value=daq_cfg_params[23], type='number', debounce=True, className="field-body")
- ], className="field"),
- html.Div([
- html.Div("Maximum Sync Fails:", className="field-label", id="label_max_sync_fails"),
- dcc.Input(id='cfg_max_sync_fails', value=daq_cfg_params[24], type='number', debounce=True, className="field-body")
- ], className="field"),
- ], style={'width': '100%'}, id='adv-cfg-container'),
-
- # Reconfigure Button
- html.Div([
- html.Button('Reconfigure & Restart DAQ chain', id='btn_reconfig_daq_chain', className="btn"),
- ], className="field"),
- ]
- for i in range(len(daq_subsystem_reconfiguration_options)):
- daq_config_card_list.append(daq_subsystem_reconfiguration_options[i])
- #else:
- # daq_config_card_list.append(html.H2("DAQ Subsystem Reconfiguration", id="init_title_reconfig"))
- # daq_config_card_list.append(html.Div("Config file not found! Reconfiguration is not possible !", id="daq_reconfig_note", className="field", style={"color":"red"}))
-
- daq_config_card = html.Div(daq_config_card_list, className="card")
- #-----------------------------
- # DAQ Status Card
- #-----------------------------
- daq_status_card = \
- html.Div([
- html.H2("DAQ Subsystem Status", id="init_title_s"),
- html.Div([html.Div("Update rate:" , id="label_daq_update_rate" , className="field-label"), html.Div("- ms" , id="body_daq_update_rate" , className="field-body")], className="field"),
- html.Div([html.Div("Latency:" , id="label_daq_dsp_latency" , className="field-label"), html.Div("- ms" , id="body_daq_dsp_latency" , className="field-body")], className="field"),
- html.Div([html.Div("Frame index:" , id="label_daq_frame_index" , className="field-label"), html.Div("-" , id="body_daq_frame_index" , className="field-body")], className="field"),
- html.Div([html.Div("Frame type:" , id="label_daq_frame_type" , className="field-label"), html.Div("-" , id="body_daq_frame_type" , className="field-body")], className="field"),
- html.Div([html.Div("Frame sync:" , id="label_daq_frame_sync" , className="field-label"), html.Div("LOSS" , id="body_daq_frame_sync" , className="field-body", style={"color": "red"})], className="field"),
- html.Div([html.Div("Power level:" , id="label_daq_power_level" , className="field-label"), html.Div("-" , id="body_daq_power_level" , className="field-body")], className="field"),
- html.Div([html.Div("Connection status:" , id="label_daq_conn_status" , className="field-label"), html.Div("Disconnected", id="body_daq_conn_status" , className="field-body", style={"color": "red"})], className="field"),
- html.Div([html.Div("Sample delay snyc:" , id="label_daq_delay_sync" , className="field-label"), html.Div("LOSS" , id="body_daq_delay_sync" , className="field-body", style={"color": "red"})], className="field"),
- html.Div([html.Div("IQ snyc:" , id="label_daq_iq_sync" , className="field-label"), html.Div("LOSS" , id="body_daq_iq_sync" , className="field-body", style={"color": "red"})], className="field"),
- html.Div([html.Div("Noise source state:" , id="label_daq_noise_source" , className="field-label"), html.Div("Disabled" , id="body_daq_noise_source" , className="field-body", style={"color": "green"})], className="field"),
- html.Div([html.Div("RF center frequecy [MHz]:" , id="label_daq_rf_center_freq", className="field-label"), html.Div("- MHz" , id="body_daq_rf_center_freq", className="field-body")], className="field"),
- html.Div([html.Div("Sampling frequency [MHz]:" , id="label_daq_sampling_freq" , className="field-label"), html.Div("- MHz" , id="body_daq_sampling_freq" , className="field-body")], className="field"),
- html.Div([html.Div("Data block length [ms]:" , id="label_daq_cpi" , className="field-label"), html.Div("- ms" , id="body_daq_cpi" , className="field-body")], className="field"),
- html.Div([html.Div("IF gains [dB]:" , id="label_daq_if_gain" , className="field-label"), html.Div("[,] dB" , id="body_daq_if_gain" , className="field-body")], className="field"),
- #html.Div([html.Div("Avg. powers [dB]:" , id="label_avg_powers" , className="field-label"), html.Div("[,] dB" , id="body_avg_powers" , className="field-body")], className="field"),
- ], className="card")
-
- #-----------------------------
- # DSP Confugartion Card
- #-----------------------------
-
- dsp_config_card = \
- html.Div([
- html.H2("Passive Radar Configuration", id="init_title_d"),
- html.Div([html.Div("Enable Passive Radar", id="label_en_pr" , className="field-label"),
- dcc.Checklist(options=option , id="en_pr_check" , className="field-body", value=en_pr_values),
- ], className="field"),
-
- html.Div([html.Div("Clutter Cancellation:" , id="label_clutter_cancellation" , className="field-label"),
- dcc.Dropdown(id='clutter_cancel_algo',
- options=[
- {'label': 'OFF', 'value': "OFF"},
- {'label': 'Wiener MRE' , 'value': "Wiener MRE"},
- ],
- value=webInterface_inst.module_signal_processor.PR_clutter_cancellation, style={"display":"inline-block"},className="field-body")
- ], className="field"),
-
- html.Div([html.Div("Max Bistatic Range [km]:" , id="label_max_bistatic_range" , className="field-label"),
- dcc.Dropdown(id='max_bistatic_range',
- options=[
- {'label': '16', 'value': 16},
- {'label': '32' , 'value': 32},
- {'label': '64' , 'value': 64},
- {'label': '128' , 'value': 128},
- {'label': '256' , 'value': 256},
- {'label': '512' , 'value': 512},
- {'label': '1024' , 'value': 1024},
- ],
- value=webInterface_inst.module_signal_processor.max_bistatic_range, style={"display":"inline-block"},className="field-body")
- ], className="field"),
-
- html.Div([html.Div("Max Doppler [Hz]:" , id="label_max_doppler" ,style={"display":"inline-block"}, className="field-label"),
- dcc.Input(id="max_doppler", value=webInterface_inst.module_signal_processor.max_doppler, type='number', style={"display":"inline-block", "float":"right", "padding-left":0}, debounce=True, className="field-body")
- ], style={'display':'inline-block'}, className="field"),
-
- html.Div([html.Div("PR Persist", id="label_en_persist" , className="field-label"),
- dcc.Checklist(options=option , id="en_persist_check" , className="field-body", value=en_persist_values),
- ], className="field"),
-
- html.Div([html.Div("Persist Decay:" , id="label_persist_decay" ,style={"display":"inline-block"}, className="field-label"),
- dcc.Input(id="persist_decay", value=webInterface_inst.pr_persist_decay, type='number', style={"display":"inline-block", "float":"right", "padding-left":0}, debounce=True, className="field-body")
- ], style={'display':'inline-block'}, className="field"),
-
-
- html.Div([html.Div("Dynamic Range (Min):" , id="label_dynrange_min" ,style={"display":"inline-block"}, className="field-label"),
- dcc.Input(id="dynrange_min", value=webInterface_inst.pr_dynamic_range_min, type='number', style={"display":"inline-block", "float":"right", "padding-left":0}, debounce=True, className="field-body")
- ], style={'display':'inline-block'}, className="field"),
-
- html.Div([html.Div("Dynamic Range (Max):" , id="label_dynrange_max" ,style={"display":"inline-block"}, className="field-label"),
- dcc.Input(id="dynrange_max", value=webInterface_inst.pr_dynamic_range_max, type='number', style={"display":"inline-block", "float":"right", "padding-left":0}, debounce=True, className="field-body")
- ], style={'display':'inline-block'}, className="field"),
-
-
-
-
- ], className="card")
-
- #-----------------------------
- # Display Options Card
- #-----------------------------
- #config_page_component_list = [daq_config_card, daq_status_card, dsp_config_card, display_options_card,squelch_card]
- config_page_component_list = [daq_config_card, daq_status_card, dsp_config_card]
-
- if not webInterface_inst.disable_tooltips:
- config_page_component_list.append(tooltips.dsp_config_tooltips)
- #if len(en_advanced_daq_cfg):
- #if daq_cfg_params is not None:
- config_page_component_list.append(tooltips.daq_ini_config_tooltips)
-
- return html.Div(children=config_page_component_list)
-
-
-spectrum_page_layout = html.Div([
- html.Div([
- dcc.Store(id="spectrum-store"),
- dcc.Graph(
- id="spectrum-graph",
- style={'width': '100%', 'height': '45%'},
- figure=fig_dummy #spectrum_fig #fig_dummy #spectrum_fig #fig_dummy
- ),
- dcc.Graph(
- id="waterfall-graph",
- style={'width': '93.5%', 'height': '60%'},
- figure=waterfall_fig #waterfall fig remains unchanged always due to slow speed to update entire graph #fig_dummy #spectrum_fig #fig_dummy
- ),
-], className="monitor_card"),
-
-
- #html.Div([
- #dcc.Graph(
- # style={"height": "inherit"},
- # id="waterfall-graph",
- # figure=fig_dummy #spectrum_fig #fig_dummy
- #)], className="monitor_card"),
-
-
-
-])
-def generate_pr_page_layout(webInterface_inst):
- pr_page_layout = html.Div([
- html.Div([
- #dcc.Graph(id='doa-graph-test', figure=doa_fig),
- dcc.Store(id='pr-store', data=[]),
- dcc.Graph(
- style={"height": "inherit"},
- id="pr-graph",
- figure=pr_fig, #fig_dummy #doa_fig #fig_dummy
- )], className="monitor_card"),
- ])
- return pr_page_layout
-
-#============================================
-# CALLBACK FUNCTIONS
-#============================================
-@app.callback_connect
-def func(client, connect):
- #print(client, connect, len(app.clients))
- if connect and len(app.clients)==1:
- fetch_dsp_data()
- elif not connect and len(app.clients)==0:
- webInterface_inst.dsp_timer.cancel()
-
-def fetch_dsp_data():
- daq_status_update_flag = 0
- spectrum_update_flag = 0
- doa_update_flag = 0
- freq_update = no_update
- #############################################
- # Fetch new data from back-end ques #
- #############################################
- try:
- # Fetch new data from the receiver module
- que_data_packet = webInterface_inst.rx_data_que.get(False)
- for data_entry in que_data_packet:
- if data_entry[0] == "conn-ok":
- webInterface_inst.daq_conn_status = 1
- daq_status_update_flag = 1
- elif data_entry[0] == "disconn-ok":
- webInterface_inst.daq_conn_status = 0
- daq_status_update_flag = 1
- elif data_entry[0] == "config-ok":
- webInterface_inst.daq_cfg_iface_status = 0
- daq_status_update_flag = 1
- except queue.Empty:
- # Handle empty queue here
- webInterface_inst.logger.debug("Receiver module que is empty")
- else:
- pass
- # Handle task here and call q.task_done()
- if webInterface_inst.daq_restart: # Set by the restarting script
- daq_status_update_flag = 1
- try:
- # Fetch new data from the signal processing module
- que_data_packet = webInterface_inst.sp_data_que.get(False)
- for data_entry in que_data_packet:
- if data_entry[0] == "iq_header":
- webInterface_inst.logger.debug("Iq header data fetched from signal processing que")
- iq_header = data_entry[1]
- # Unpack header
- webInterface_inst.daq_frame_index = iq_header.cpi_index
-
- if iq_header.frame_type == iq_header.FRAME_TYPE_DATA:
- webInterface_inst.daq_frame_type = "Data"
- elif iq_header.frame_type == iq_header.FRAME_TYPE_DUMMY:
- webInterface_inst.daq_frame_type = "Dummy"
- elif iq_header.frame_type == iq_header.FRAME_TYPE_CAL:
- webInterface_inst.daq_frame_type = "Calibration"
- elif iq_header.frame_type == iq_header.FRAME_TYPE_TRIGW:
- webInterface_inst.daq_frame_type = "Trigger wait"
- else:
- webInterface_inst.daq_frame_type = "Unknown"
-
- webInterface_inst.daq_frame_sync = iq_header.check_sync_word()
- webInterface_inst.daq_power_level = iq_header.adc_overdrive_flags
- webInterface_inst.daq_sample_delay_sync = iq_header.delay_sync_flag
- webInterface_inst.daq_iq_sync = iq_header.iq_sync_flag
- webInterface_inst.daq_noise_source_state= iq_header.noise_source_state
-
- if webInterface_inst.daq_center_freq != iq_header.rf_center_freq/10**6:
- freq_update = 1
-
- webInterface_inst.daq_center_freq = iq_header.rf_center_freq/10**6
- webInterface_inst.daq_adc_fs = iq_header.adc_sampling_freq/10**6
- webInterface_inst.daq_fs = iq_header.sampling_freq/10**6
- webInterface_inst.daq_cpi = int(iq_header.cpi_length*10**3/iq_header.sampling_freq)
- gain_list_str=""
- for m in range(iq_header.active_ant_chs):
- gain_list_str+=str(iq_header.if_gains[m]/10)
- gain_list_str+=", "
- webInterface_inst.daq_if_gains =gain_list_str[:-2]
- daq_status_update_flag = 1
- elif data_entry[0] == "update_rate":
- webInterface_inst.daq_update_rate = data_entry[1]
- # Set absoluth minimum
- #if webInterface_inst.daq_update_rate < 0.1: webInterface_inst.daq_update_rate = 0.1
- if webInterface_inst._update_rate_arr is None:
- webInterface_inst._update_rate_arr = np.ones(webInterface_inst._avg_win_size)*webInterface_inst.daq_update_rate
- webInterface_inst._update_rate_arr[0:webInterface_inst._avg_win_size-2] = \
- webInterface_inst._update_rate_arr[1:webInterface_inst._avg_win_size-1]
- webInterface_inst._update_rate_arr[webInterface_inst._avg_win_size-1] = webInterface_inst.daq_update_rate
- #webInterface_inst.page_update_rate = np.average(webInterface_inst._update_rate_arr)*0.8
- elif data_entry[0] == "latency":
- webInterface_inst.daq_dsp_latency = data_entry[1] + webInterface_inst.daq_cpi
- elif data_entry[0] == "spectrum":
- webInterface_inst.logger.debug("Spectrum data fetched from signal processing que")
- spectrum_update_flag = 1
- webInterface_inst.spectrum = data_entry[1]
- elif data_entry[0] == "RD_matrix":
- webInterface_inst.logger.debug("Passive Radar RD Matrix data fetched from signal processing que")
- doa_update_flag = 1
- webInterface_inst.RD_matrix = data_entry[1]
- else:
- webInterface_inst.logger.warning("Unknown data entry: {:s}".format(data_entry[0]))
- except queue.Empty:
- # Handle empty queue here
- webInterface_inst.logger.debug("Signal processing que is empty")
- else:
- pass
- # Handle task here and call q.task_done()
-
- #current_time = time.time()
- #time_elapsed = current_time - webInterface_inst.update_time
- #webInterface_inst.update_time = current_time
-
- if (webInterface_inst.pathname == "/config" or webInterface_inst.pathname == "/") and daq_status_update_flag:
- update_daq_status()
- elif webInterface_inst.pathname == "/spectrum" and spectrum_update_flag:
- plot_spectrum()
- elif (webInterface_inst.pathname == "/pr" and doa_update_flag): #or (webInterface_inst.pathname == "/doa" and webInterface_inst.reset_doa_graph_flag):
- plot_pr()
-
- #if (pathname == "/config" or pathname=="/") and daq_status_update_flag:
- # pass
- #elif pathname == "/spectrum" and spectrum_update_flag:
- # pass
- #elif pathname == "/doa" and doa_update_flag:
- # pass
- #else:
- # pass
-
- webInterface_inst.dsp_timer = Timer(.01, fetch_dsp_data)
- webInterface_inst.dsp_timer.start()
-
-
-def update_daq_status():
-
- #############################################
- # Prepare UI component properties #
- #############################################
-
- if webInterface_inst.daq_conn_status == 1:
-
- if not webInterface_inst.daq_cfg_iface_status:
- daq_conn_status_str = "Connected"
- conn_status_style={"color": "green"}
- else: # Config interface is busy
- daq_conn_status_str = "Reconfiguration.."
- conn_status_style={"color": "orange"}
- else:
- daq_conn_status_str = "Disconnected"
- conn_status_style={"color": "red"}
-
- if webInterface_inst.daq_restart:
- daq_conn_status_str = "Restarting.."
- conn_status_style={"color": "orange"}
-
- if webInterface_inst.daq_update_rate < 1:
- daq_update_rate_str = "{:d} ms".format(round(webInterface_inst.daq_update_rate*1000))
- else:
- daq_update_rate_str = "{:.2f} s".format(webInterface_inst.daq_update_rate)
-
- daq_dsp_latency = "{:d} ms".format(webInterface_inst.daq_dsp_latency)
- daq_frame_index_str = str(webInterface_inst.daq_frame_index)
-
- daq_frame_type_str = webInterface_inst.daq_frame_type
- if webInterface_inst.daq_frame_type == "Data":
- frame_type_style = frame_type_style={"color": "green"}
- elif webInterface_inst.daq_frame_type == "Dummy":
- frame_type_style = frame_type_style={"color": "white"}
- elif webInterface_inst.daq_frame_type == "Calibration":
- frame_type_style = frame_type_style={"color": "orange"}
- elif webInterface_inst.daq_frame_type == "Trigger wait":
- frame_type_style = frame_type_style={"color": "yellow"}
- else:
- frame_type_style = frame_type_style={"color": "red"}
-
- if webInterface_inst.daq_frame_sync:
- daq_frame_sync_str = "LOSS"
- frame_sync_style={"color": "red"}
- else:
- daq_frame_sync_str = "Ok"
- frame_sync_style={"color": "green"}
- if webInterface_inst.daq_sample_delay_sync:
- daq_delay_sync_str = "Ok"
- delay_sync_style={"color": "green"}
- else:
- daq_delay_sync_str = "LOSS"
- delay_sync_style={"color": "red"}
-
- if webInterface_inst.daq_iq_sync:
- daq_iq_sync_str = "Ok"
- iq_sync_style={"color": "green"}
- else:
- daq_iq_sync_str = "LOSS"
- iq_sync_style={"color": "red"}
-
- if webInterface_inst.daq_noise_source_state:
- daq_noise_source_str = "Enabled"
- noise_source_style={"color": "red"}
- else:
- daq_noise_source_str = "Disabled"
- noise_source_style={"color": "green"}
-
- if webInterface_inst.daq_power_level:
- daq_power_level_str = "Overdrive"
- daq_power_level_style={"color": "red"}
- else:
- daq_power_level_str = "OK"
- daq_power_level_style={"color": "green"}
-
- daq_rf_center_freq_str = str(webInterface_inst.daq_center_freq)
- daq_sampling_freq_str = str(webInterface_inst.daq_fs)
- daq_cpi_str = str(webInterface_inst.daq_cpi)
- #daq_max_amp_str = "{:.1f}".format(webInterface_inst.max_amplitude)
- #daq_avg_powers_str = webInterface_inst.avg_powers
-
-
- app.push_mods({
- 'body_daq_update_rate': {'children': daq_update_rate_str},
- 'body_daq_dsp_latency': {'children': daq_dsp_latency},
- 'body_daq_frame_index': {'children': daq_frame_index_str},
- 'body_daq_frame_sync': {'children': daq_frame_sync_str},
- 'body_daq_frame_type': {'children': daq_frame_type_str},
- 'body_daq_power_level': {'children': daq_power_level_str},
- 'body_daq_conn_status': {'children': daq_conn_status_str },
- 'body_daq_delay_sync': {'children': daq_delay_sync_str},
- 'body_daq_iq_sync': {'children': daq_iq_sync_str},
- 'body_daq_noise_source': {'children': daq_noise_source_str},
- 'body_daq_rf_center_freq': {'children': daq_rf_center_freq_str},
- 'body_daq_sampling_freq': {'children': daq_sampling_freq_str},
- 'body_daq_cpi': {'children': daq_cpi_str},
- 'body_daq_if_gain': {'children': webInterface_inst.daq_if_gains},
- #'body_avg_powers': {'children': daq_avg_powers_str}
- })
-
- app.push_mods({
- 'body_daq_frame_sync': {'style': frame_sync_style},
- 'body_daq_frame_type': {'style': frame_type_style},
- 'body_daq_power_level': {'style': daq_power_level_style},
- 'body_daq_conn_status': {'style': conn_status_style},
- 'body_daq_delay_sync': {'style': delay_sync_style},
- 'body_daq_iq_sync': {'style': iq_sync_style},
- 'body_daq_noise_source': {'style': noise_source_style},
- })
-
-@app.callback(
- Output(component_id="placeholder_update_freq", component_property="children"),
- [Input(component_id ="btn-update_rx_param" , component_property="n_clicks")],
- [State(component_id ="daq_center_freq" , component_property='value'),
- State(component_id ="daq_rx_gain" , component_property='value')],
-)
-def update_daq_params(input_value, f0, gain):
- #if input_value is None:
- # raise PreventUpdate
- webInterface_inst.daq_center_freq = f0
- webInterface_inst.config_daq_rf(f0,gain)
- return 1
-
-@app.callback([Output("page-content" , "children"),
- Output("header_config" ,"className"),
- Output("header_spectrum","className"),
- Output("header_doa" ,"className")],
- [Input("url" , "pathname")])
-def display_page(pathname):
- global spectrum_fig
- global doa_fig
- webInterface_inst.pathname = pathname
-
- if pathname == "/":
- webInterface_inst.module_signal_processor.en_spectrum = False
- return [generate_config_page_layout(webInterface_inst), "header_active", "header_inactive", "header_inactive"]
- elif pathname == "/config":
- webInterface_inst.module_signal_processor.en_spectrum = False
- return [generate_config_page_layout(webInterface_inst), "header_active", "header_inactive", "header_inactive"]
- elif pathname == "/spectrum":
- webInterface_inst.module_signal_processor.en_spectrum = True
- #webInterface_inst.reset_spectrum_graph_flag = True
- #plot_spectrum()
- #while webInterface_inst.reset_spectrum_graph_flag: time.sleep(1)
- spectrum_fig = None # Force reload of graphs as axes may change etc
- time.sleep(1)
- return [spectrum_page_layout, "header_inactive", "header_active", "header_inactive"]
- elif pathname == "/pr":
- webInterface_inst.module_signal_processor.en_spectrum = False
- #webInterface_inst.module_signal_processor.en_DOA_estimation = False
- #webInterface_inst.reset_doa_graph_flag = True
- plot_pr()
- #doa_fig = {}
- #while webInterface_inst.reset_doa_graph_flag: time.sleep(1) # Wait until the graph is reset
- #while doa_fig == None : time.sleep(0.1) # Wait for doa_fig to reconfigure in timer callback
- #time.sleep(1)
- #webInterface_inst.module_signal_processor.en_DOA_estimation = True
- return [generate_pr_page_layout(webInterface_inst), "header_inactive", "header_inactive", "header_active"]
- return Output('dummy_output', 'children', '') #[no_update, no_update, no_update, no_update]
-
- #return [no_update, no_update, no_update, no_update]
-
-
-@app.callback_shared(
- None,
- [Input(component_id='btn-start_proc', component_property='n_clicks')],
-)
-def start_proc_btn(input_value):
- webInterface_inst.logger.info("Start pocessing btn pushed")
- webInterface_inst.start_processing()
-
-@app.callback_shared(
- None,
- [Input(component_id='btn-stop_proc', component_property='n_clicks')],
-)
-def stop_proc_btn(input_value):
- webInterface_inst.logger.info("Stop pocessing btn pushed")
- webInterface_inst.stop_processing()
-
-@app.callback_shared(
- None,
- [Input(component_id='btn-save_cfg' , component_property='n_clicks')],
-)
-def save_config_btn(input_value):
- webInterface_inst.logger.info("Saving DAQ and DSP Configuration")
- webInterface_inst.save_configuration()
-
-"""
-@app.callback(
- #Output(component_id='url', component_property='pathname'),
- None,
- [Input(component_id='mem_leak_refresh_interval', component_property='n_intervals')],
- [State(component_id='url', component_property='pathname')]
-)
-def heatmap_mem_leak_refresh_fix(intervals, pathname):
- if pathname == "/doa":
-
- CAFMatrix = np.abs(webInterface_inst.RD_matrix)
-
- CAFMatrix = CAFMatrix / 50 #/ np.amax(CAFMatrix) # Noramlize with the maximum value
- CAFMatrixLog = 20 * np.log10(CAFMatrix)
-
- CAFDynRange = 20
- CAFMatrixLog[CAFMatrixLog < -CAFDynRange] = -CAFDynRange
-
-
- pr_init = CAFMatrixLog
- pr_fig = go.Figure(layout=fig_layout)
- pr_fig.add_trace(go.Heatmap(
- z=pr_init,
- zsmooth='best', #False,
- #zsmooth=False, #False,
- showscale=False,
- hoverinfo='skip',
- colorscale=[[0.0, '#000020'],
- [0.0714, '#000030'],
- [0.1428, '#000050'],
- [0.2142, '#000091'],
- [0.2856, '#1E90FF'],
- [0.357, '#FFFFFF'],
- [0.4284, '#FFFF00'],
- [0.4998, '#FE6D16'],
- [0.5712, '#FE6D16'],
- [0.6426, '#FF0000'],
- [0.714, '#FF0000'],
- [0.7854, '#C60000'],
- [0.8568, '#9F0000'],
- [0.9282, '#750000'],
- [1.0, '#4A0000']]))
-
- app.push_mods({
- 'pr-graph': {'figure': pr_fig},
- #'pr-graph': {'extendData': pr_fig},
- # 'waterfall-graph': {'figure': waterfall_fig}
- })
-"""
-
-def plot_pr():
- global pr_fig
-
- if webInterface_inst.RD_matrix is not None:
-
- #start = time.time()
-
- CAFMatrix = np.abs(webInterface_inst.RD_matrix)
-
- CAFMatrix = CAFMatrix / 50 #/ np.amax(CAFMatrix) # Noramlize with the maximum value
-
- if webInterface_inst.CAFMatrixPersist is None or webInterface_inst.CAFMatrixPersist.shape != CAFMatrix.shape or not webInterface_inst.en_persist:
- webInterface_inst.CAFMatrixPersist = CAFMatrix
- else:
- webInterface_inst.CAFMatrixPersist = np.maximum(webInterface_inst.CAFMatrixPersist, CAFMatrix)*webInterface_inst.pr_persist_decay #webInterface_inst.CAFMatrixPersist * 0.5 + CAFMatrix * 0.5
-
- #CAFMatrixNew = #np.maximum(webInterface_inst.CAFMatrixOld, CAFMatrix)
- #webInterface_inst.CAFMatrixOld = CAFMatrixNew
- #webInterface_inst.CAFMatrixOld = webInterface_inst.CAFMatrixOld * 0.999
-
- CAFMatrixLog = 20 * np.log10(webInterface_inst.CAFMatrixPersist)
-
- CAFDynRange = webInterface_inst.pr_dynamic_range_min
- CAFMatrixLog[CAFMatrixLog < CAFDynRange] = CAFDynRange
-
- CAFDynRange = webInterface_inst.pr_dynamic_range_max
- CAFMatrixLog[CAFMatrixLog > CAFDynRange] = CAFDynRange
-
- #end = time.time()
- #print("WebInt Time: " + str((end-start)* 1000))
-
- app.push_mods({
- #'pr-store': {'data': CAFMatrixLog}
- 'pr-graph': {'extendData': [dict(z =[CAFMatrixLog]), [0], len(CAFMatrixLog)]}
- })
-
-
-# DOA Graph Clientside Callback
-#app.clientside_callback(
-# """
-# function (data, graph_type) {
-# return [
-# [{z: [data]}, [0], data.length]
-# ]
-#
-# }
-# """,
-# [Output('pr-graph', 'extendData')],
-# [Input('pr-store', 'data')]
-#)
-
-
-app.clientside_callback(
- """
- function (data) {
- /*return [{x: data.map(i => i.x), y: data.map(i => i.y)}, [...Array(data.length).keys()], data[0].x.length]*/
-
- /*const every_nth = (arr, nth) => arr.filter((e, i) => i % nth === (nth | 0) - 1);*/
-
- return [
- [{x: data.map(i => i.x), y: data.map(i => i.y)}, [...Array(data.length).keys()], data[0].x.length],
- /*[{z: [[every_nth(data[0].y, 1)]]}, [0], 50]*/
- [{z: [[data[0].y]]}, [0], 50]
- ]
- }
- """,
- [Output('spectrum-graph', 'extendData'),
- Output('waterfall-graph', 'extendData')],
- [Input('spectrum-store', 'data')]
-)
-
-def plot_spectrum():
- global spectrum_fig
- global waterfall_fig
- if spectrum_fig == None:
- #if webInterface_inst.reset_spectrum_graph_flag:
- spectrum_fig = go.Figure(layout=fig_layout)
- #freq_label="Frequency [MHz]"
-
- x=webInterface_inst.spectrum[0,:] + webInterface_inst.daq_center_freq*10**6
-
- # Plot traces
- for m in range(np.size(webInterface_inst.spectrum, 0)-2):
- spectrum_fig.add_trace(go.Scattergl(x=x,
- y=y, #webInterface_inst.spectrum[m+1, :],
- name="Channel {:d}".format(m),
- line = dict(color = trace_colors[m],
- width = 1)
- ))
-
- spectrum_fig.add_hline(y=webInterface_inst.module_receiver.daq_squelch_th_dB)
-
- # Add selected window plot
- m = np.size(webInterface_inst.spectrum,0)-1
- spectrum_fig.add_trace(go.Scattergl(x=x,
- y=y, #webInterface_inst.spectrum[m, :],
- name="Selected Signal Window",
- line = dict(color = trace_colors[m],
- width = 3)
- ))
-
- spectrum_fig.update_xaxes( #title_text=freq_label,
- color='rgba(255,255,255,1)',
- title_font_size=20,
- tickfont_size= 15, #figure_font_size,
- range=[np.min(x), np.max(x)],
- rangemode='normal',
- mirror=True,
- ticks='outside',
- showline=True)
- spectrum_fig.update_yaxes(title_text="Amplitude [dB]",
- color='rgba(255,255,255,1)',
- title_font_size=20,
- tickfont_size=figure_font_size,
- range=[-90, 0],
- mirror=True,
- ticks='outside',
- showline=True)
-
-
- spectrum_fig.update_layout(margin=go.layout.Margin(b=5, t=0))
-
- webInterface_inst.reset_spectrum_graph_flag = False
- app.push_mods({
- 'spectrum-graph': {'figure': spectrum_fig},
- # 'waterfall-graph': {'figure': waterfall_fig}
- })
-
- else:
- update_data = []
- for m in range(1, np.size(webInterface_inst.spectrum, 0)): #webInterface_inst.module_receiver.M+1):
- #update_data.append(dict(x=webInterface_inst.spectrum[0,:], y=webInterface_inst.spectrum[m, :]))
- update_data.append(dict(x=webInterface_inst.spectrum[0,:] + webInterface_inst.daq_center_freq*10**6, y=webInterface_inst.spectrum[m, :]))
-
- app.push_mods({
- 'spectrum-store': {'data': update_data}
- #'spectrum-graph': {'extendData': spec},
- #'waterfall-graph': {'extendData': waterfall}
- })
-
-
-@app.callback(
- #[Output(component_id="body_ant_spacing_wavelength", component_property='children')],
- #Output(component_id="label_ant_spacing_meter", component_property='children')],
- #Output(component_id="ambiguity_warning", component_property='children'),
- #Output(component_id="en_fb_avg_check", component_property="options")],
- None,
- [Input(component_id ="placeholder_update_freq" , component_property='children'),
- Input(component_id ="en_pr_check" , component_property='value'),
- Input(component_id ="en_persist_check" , component_property='value'),
- Input(component_id ="persist_decay" , component_property='value'),
- Input(component_id ="max_bistatic_range" , component_property='value'),
- Input(component_id ="max_doppler" , component_property='value'),
- Input(component_id ="clutter_cancel_algo" , component_property='value'),
- Input(component_id ="dynrange_max" , component_property='value'),
- Input(component_id ="dynrange_min" , component_property='value')]
-)
-#def update_dsp_params(freq_update, en_doa, en_fb_avg, spacing_meter, ant_arrangement, doa_fig_type, doa_method, compass_ofset): #, input_value):
-def update_dsp_params(update_freq, en_pr, en_persist, persist_decay, max_bistatic_range, max_doppler, clutter_cancel_algo, dynrange_max, dynrange_min): #, input_value):
-
- if en_pr is not None and len(en_pr):
- webInterface_inst.logger.debug("Passive Radar enabled")
- webInterface_inst.module_signal_processor.en_PR = True
- else:
- webInterface_inst.module_signal_processor.en_PR = False
-
- if en_persist is not None and len(en_persist):
- webInterface_inst.en_persist = True
- else:
- webInterface_inst.en_persist = False
-
- #webInterface_inst.module_signal_processor.DOA_ant_alignment=ant_arrangement
- webInterface_inst.module_signal_processor.PR_clutter_cancellation = clutter_cancel_algo
- webInterface_inst.module_signal_processor.max_bistatic_range = max_bistatic_range
- webInterface_inst.module_signal_processor.max_doppler = max_doppler
- webInterface_inst.pr_persist_decay = persist_decay
- webInterface_inst.pr_dynamic_range_min = dynrange_min
- webInterface_inst.pr_dynamic_range_max = dynrange_max
- #webInterface_inst._doa_fig_type = doa_fig_type
- #webInterface_inst.compass_ofset = compass_ofset
-
- #return [str(ant_spacing_wavelength)]
-
-@app.callback(
- None,
- [Input('cfg_rx_channels' ,'value'),
- Input('cfg_daq_buffer_size' ,'value'),
- Input('cfg_sample_rate' ,'value'),
- Input('en_noise_source_ctr' ,'value'),
- Input('en_squelch_mode' ,'value'),
- Input('cfg_squelch_init_th' ,'value'),
- Input('cfg_cpi_size' ,'value'),
- Input('cfg_decimation_ratio' ,'value'),
- Input('cfg_fir_bw' ,'value'),
- Input('cfg_fir_tap_size' ,'value'),
- Input('cfg_fir_window' ,'value'),
- Input('en_filter_reset' ,'value'),
- Input('cfg_corr_size' ,'value'),
- Input('cfg_std_ch_ind' ,'value'),
- Input('en_iq_cal' ,'value'),
- Input('cfg_gain_lock' ,'value'),
- Input('en_req_track_lock_intervention','value'),
- Input('cfg_cal_track_mode' ,'value'),
- Input('cfg_amplitude_cal_mode' ,'value'),
- Input('cfg_cal_frame_interval' ,'value'),
- Input('cfg_cal_frame_burst_size' ,'value'),
- Input('cfg_amplitude_tolerance' ,'value'),
- Input('cfg_phase_tolerance' ,'value'),
- Input('cfg_max_sync_fails' ,'value'),
- Input('cfg_data_block_len' ,'value'),
- Input('cfg_decimated_bw' ,'value'),
- Input('cfg_recal_interval' ,'value')]
-)
-def update_daq_ini_params(
- cfg_rx_channels,cfg_daq_buffer_size,cfg_sample_rate,en_noise_source_ctr, \
- en_squelch_mode,cfg_squelch_init_th,cfg_cpi_size,cfg_decimation_ratio, \
- cfg_fir_bw,cfg_fir_tap_size,cfg_fir_window,en_filter_reset,cfg_corr_size, \
- cfg_std_ch_ind,en_iq_cal,cfg_gain_lock,en_req_track_lock_intervention, \
- cfg_cal_track_mode,cfg_amplitude_cal_mode,cfg_cal_frame_interval, \
- cfg_cal_frame_burst_size, cfg_amplitude_tolerance,cfg_phase_tolerance, \
- cfg_max_sync_fails, cfg_data_block_len, cfg_decimated_bw, cfg_recal_interval):
- # TODO: Use disctionarry instead of parameter list
-
- ctx = dash.callback_context
- component_id = ctx.triggered[0]['prop_id'].split('.')[0]
- if ctx.triggered:
- if len(ctx.triggered) == 1: # User manually changed one parameter
- webInterface_inst.tmp_daq_ini_cfg = "Custom"
-
- # If the input was from basic DAQ config, update the actual DAQ params
- if component_id == "cfg_data_block_len" or component_id == "cfg_decimated_bw" or component_id == "cfg_recal_interval":
- if not cfg_data_block_len or not cfg_decimated_bw or not cfg_recal_interval:
- return Output('dummy_output', 'children', '') #[no_update, no_update, no_update, no_update]
-
- cfg_daq_buffer_size = 262144 # This is a reasonable DAQ buffer size to use
- cfg_corr_size = 32768 # Reasonable value that never has problems calibrating
- en_noise_source_ctr = [1]
- en_squelch_mode = [] # NOTE: For checkboxes, zero is defined by an empty array
- cfg_fir_bw = 1
- cfg_fir_window = 'hann'
- en_filter_reset = []
- cfg_std_ch_ind = 0
- en_iq_cal = [1]
- en_req_track_lock_intervention = []
- cfg_amplitude_cal_mode = 'channel_power'
- cfg_cal_frame_burst_size = 10
- cfg_amplitude_tolerance = 2
- cfg_phase_tolerance = 2
- cfg_max_sync_fails = 10
-
- # Set sample rate to something sensible for the desired decimated_bw
- """
- if cfg_decimated_bw < 3:
- cfg_sample_rate = 0.25
- cfg_corr_size = 4096
- cfg_daq_buffer_size = 16384
- elif cfg_decimated_bw < 10:
- cfg_sample_rate = 1.024
- cfg_corr_size = 16384
- else:
- cfg_sample_rate = 2.4
- """
-
- cfg_decimation_ratio = round( (cfg_sample_rate*10**6) / (cfg_decimated_bw*10**3) )
-
- cfg_cpi_size = round( (cfg_data_block_len / 10**3) * cfg_decimated_bw*10**3 )
- cfg_cal_frame_interval = round((cfg_recal_interval*60) / (cfg_data_block_len/10**3))
-
- while cfg_decimation_ratio * cfg_cpi_size < cfg_daq_buffer_size:
- cfg_daq_buffer_size = (int) (cfg_daq_buffer_size / 2)
-
- cfg_corr_size = (int) (cfg_daq_buffer_size / 2)
-
- # Choose a tap size larger than the decimation ratio
- cfg_fir_tap_size = (int)(cfg_decimation_ratio * 1.2) + 8
-
- if cfg_decimation_ratio == 1:
- cfg_fir_tap_size = 1
-
- cfg_cal_track_mode = 0
- if cfg_cal_frame_interval > 1:
- cfg_cal_track_mode = 2 #[{'label': calibration_tack_modes[1], 'value': calibration_tack_modes[1]}]
- else:
- cfg_cal_track_mode = 0
-
-
- param_list = []
- param_list.append("Custom")
- param_list.append(cfg_rx_channels)
- param_list.append(cfg_daq_buffer_size)
- param_list.append(int(cfg_sample_rate*10**6))
- if en_noise_source_ctr is not None and len(en_noise_source_ctr):
- param_list.append(1)
- else:
- param_list.append(0)
- if en_squelch_mode is not None and len(en_squelch_mode):
- param_list.append(1)
- else:
- param_list.append(0)
- param_list.append(cfg_squelch_init_th)
- param_list.append(cfg_cpi_size)
- param_list.append(cfg_decimation_ratio)
- param_list.append(cfg_fir_bw)
- param_list.append(cfg_fir_tap_size)
- param_list.append(cfg_fir_window)
- if en_filter_reset is not None and len(en_filter_reset):
- param_list.append(1)
- else:
- param_list.append(0)
- param_list.append(cfg_corr_size)
- param_list.append(cfg_std_ch_ind)
- if en_iq_cal is not None and len(en_iq_cal):
- param_list.append(1)
- else:
- param_list.append(0)
- param_list.append(cfg_gain_lock)
- if en_req_track_lock_intervention is not None and len(en_req_track_lock_intervention):
- param_list.append(1)
- else:
- param_list.append(0)
- param_list.append(cfg_cal_track_mode)
- param_list.append(cfg_amplitude_cal_mode)
- param_list.append(cfg_cal_frame_interval)
- param_list.append(cfg_cal_frame_burst_size)
- param_list.append(cfg_amplitude_tolerance)
- param_list.append(cfg_phase_tolerance)
- param_list.append(cfg_max_sync_fails)
- param_list.append(webInterface_inst.daq_ini_cfg_params[25]) # Preserve data interface information
- webInterface_inst.daq_ini_cfg_params = param_list
-
- if ctx.triggered:
- # If we updated advanced daq, update basic DAQ params
- if component_id == "cfg_sample_rate" or component_id == "cfg_decimation_ratio" or component_id == "cfg_cpi_size" or component_id == "cfg_cal_frame_interval":
- if not cfg_sample_rate or not cfg_decimation_ratio or not cfg_cpi_size:
- return Output('dummy_output', 'children', '') #[no_update, no_update, no_update, no_update]
-
- cfg_decimated_bw = ((int(cfg_sample_rate*10**6)) / cfg_decimation_ratio) / 10**3
- cfg_data_block_len = ( cfg_cpi_size / (cfg_decimated_bw) )
- cfg_recal_interval = (cfg_cal_frame_interval * (cfg_data_block_len/10**3)) / 60
-
- app.push_mods({
- 'cfg_data_block_len': {'value': cfg_data_block_len},
- 'cfg_decimated_bw': {'value': cfg_decimated_bw},
- 'cfg_recal_interval': {'value': cfg_recal_interval},
- })
- # If we updated basic DAQ, update advanced DAQ
- elif component_id == "cfg_data_block_len" or component_id == "cfg_decimated_bw" or component_id == "cfg_recal_interval":
- app.push_mods({
- 'cfg_decimation_ratio': {'value': cfg_decimation_ratio},
- 'cfg_cpi_size': {'value': cfg_cpi_size},
- 'cfg_cal_frame_interval': {'value': cfg_cal_frame_interval},
- 'cfg_fir_tap_size': {'value': cfg_fir_tap_size},
- 'cfg_sample_rate': {'value': cfg_sample_rate},
- 'cfg_daq_buffer_size': {'value': cfg_daq_buffer_size},
- 'cfg_corr_size': {'value': cfg_corr_size},
- 'en_noise_source_ctr': {'value': en_noise_source_ctr},
- 'en_squelch_mode': {'value': en_squelch_mode},
- 'cfg_fir_bw': {'value': cfg_fir_bw},
- 'cfg_fir_window': {'value': cfg_fir_window},
- 'en_filter_reset': {'value': en_filter_reset},
- 'cfg_std_ch_ind': {'value': cfg_std_ch_ind},
- 'en_iq_cal': {'value': en_iq_cal},
- 'en_req_track_lock_intervention': {'value': en_req_track_lock_intervention},
- 'cfg_amplitude_cal_mode': {'value': cfg_amplitude_cal_mode},
- 'cfg_cal_frame_burst_size': {'value': cfg_cal_frame_burst_size},
- 'cfg_amplitude_tolerance': {'value': cfg_amplitude_tolerance},
- 'cfg_phase_tolerance': {'value': cfg_phase_tolerance},
- 'cfg_max_sync_fails': {'value': cfg_max_sync_fails},
- })
-
-
-
-@app.callback(Output('adv-cfg-container', 'style'),
- [Input("en_advanced_daq_cfg", "value")]
-)
-def toggle_adv_daq(toggle_value):
- webInterface_inst.en_advanced_daq_cfg = toggle_value
- if toggle_value:
- return {'display': 'block'}
- else:
- return {'display': 'none'}
-
-@app.callback([Output("url" , "pathname")],
- [ #Input("en_advanced_daq_cfg" , "value"),
- Input("daq_cfg_files" , "value"),
- Input("placeholder_recofnig_daq" , "children"),
- Input("placeholder_update_rx" , "children")]
-)
-def reload_cfg_page(config_fname, dummy_0, dummy_1):
- #ctx = dash.callback_context
- webInterface_inst.daq_ini_cfg_params = read_config_file(config_fname)
- webInterface_inst.tmp_daq_ini_cfg = webInterface_inst.daq_ini_cfg_params[0]
-
- #if ctx.triggered:
- # component_id = ctx.triggered[0]['prop_id'].split('.')[0]
- #if component_id == "daq_cfg_files" and config_fname is not None:
- # webInterface_inst.daq_ini_cfg_params = read_config_file(config_fname)
- # webInterface_inst.tmp_daq_ini_cfg = webInterface_inst.daq_ini_cfg_params[0]
- #elif component_id == "en_advanced_daq_cfg":
- #if component_id == "en_advanced_daq_cfg":
- # if en_advanced_daq_cfg is not None and len(en_advanced_daq_cfg):
- # webInterface_inst.en_advanced_daq_cfg = True
- # else:
- # webInterface_inst.en_advanced_daq_cfg = False
- return ["/config"]
-
-@app.callback(
- None,
- [Input(component_id="btn_reconfig_daq_chain" , component_property="n_clicks")],
- [State(component_id ="daq_center_freq" , component_property='value'),
- State(component_id ="daq_rx_gain" , component_property='value')]
-)
-def reconfig_daq_chain(input_value, freq, gain):
-
- if input_value is None:
- return Output('dummy_output', 'children', '') #[no_update, no_update, no_update, no_update]
-
- #return [no_update]
-# raise PreventUpdate
-
- # TODO: Check data interface mode here !
- # Update DAQ Subsystem config file
-
- config_res, config_err = write_config_file(webInterface_inst.daq_ini_cfg_params)
- if config_res:
- webInterface_inst.daq_cfg_ini_error = config_err[0]
- return Output("placeholder_recofnig_daq", "children", '-1')
- else:
- webInterface_inst.logger.info("DAQ Subsystem configuration file edited")
-
- webInterface_inst.daq_restart = 1
-
- # Restart DAQ Subsystem
-
- # Stop signal processing
- webInterface_inst.stop_processing()
- #time.sleep(2)
- webInterface_inst.logger.debug("Signal processing stopped")
-
- # Close control and IQ data interfaces
- webInterface_inst.close_data_interfaces()
- webInterface_inst.logger.debug("Data interfaces are closed")
-
- os.chdir(daq_subsystem_path)
- # Kill DAQ subsystem
- daq_stop_script = subprocess.Popen(['bash', daq_stop_filename])#, stdout=subprocess.DEVNULL)
- daq_stop_script.wait()
- webInterface_inst.logger.debug("DAQ Subsystem halted")
-
- # Start DAQ subsystem
- daq_start_script = subprocess.Popen(['bash', daq_start_filename])#, stdout=subprocess.DEVNULL)
- daq_start_script.wait()
- webInterface_inst.logger.debug("DAQ Subsystem restarted")
-
- os.chdir(root_path)
-
- # Reinitialize receiver data interface
- if webInterface_inst.module_receiver.init_data_iface() == -1:
- webInterface_inst.logger.critical("Failed to restart the DAQ data interface")
- webInterface_inst.daq_cfg_ini_error = "Failed to restart the DAQ data interface"
- return [-1]
-
- # Reset channel number count
-# webInterface_inst.module_receiver.M = 0
- webInterface_inst.module_signal_processor.first_frame = 1
-
-
- # Restart signal processing
- webInterface_inst.start_processing()
- webInterface_inst.logger.debug("Signal processing started")
- webInterface_inst.daq_restart = 0
-
-
- # Gain is always reset to zero, need to set gains to what is in the web interface
- #webInterface_inst.config_daq_rf(freq,gain)
-
-
- # Set local Squelch-DSP parameters
- #if webInterface_inst.daq_ini_cfg_params[5]: # Squelch is enabled
- # webInterface_inst.module_signal_processor.en_squelch = True
- # webInterface_inst.module_receiver.daq_squelch_th_dB = -80 #round(20*np.log10(webInterface_inst.daq_ini_cfg_params[6]),1)
-
- #webInterface_inst.module_signal_processor.squelch_threshold = webInterface_inst.daq_ini_cfg_params[6]
- # Note: There is no need to set the thresold in the DAQ Subsystem as it is configured from the ini-file.
- #else: # Squelch is disabled
- # webInterface_inst.module_signal_processor.en_squelch = False
-
- # Set number of channels
- # Reset first_frame on signal processor so new channel count is read
- #webInterface_inst.module_signal_processor.channel_number = webInterface_inst.daq_ini_cfg_params[1]
-
- webInterface_inst.daq_cfg_ini_error = ""
- webInterface_inst.active_daq_ini_cfg = webInterface_inst.daq_ini_cfg_params[0] #webInterface_inst.tmp_daq_ini_cfg
-
-
- return Output("daq_cfg_files", "value", daq_config_filename), Output("active_daq_ini_cfg", "children", "Active Configuration: " + webInterface_inst.active_daq_ini_cfg)
-
- #return Output("placeholder_recofnig_daq", "children", '1')
-# return [0]
-
-
-if __name__ == "__main__":
- # For Development only, otherwise use gunicorn
- # Debug mode does not work when the data interface is set to shared-memory "shmem"!
- app.run_server(debug=False, host="0.0.0.0")
- #waitress #serve(app.server, host="0.0.0.0", port=8050)
-
-"""
-html.Div([
- html.H2("System Logs"),
- dcc.Textarea(
- placeholder = "Enter a value...",
- value = "System logs .. - Curently NOT used",
- style = {"width": "100%", "background-color": "#000000", "color":"#02c93d"}
- )
-], className="card")
-"""
diff --git a/util/_UI/_web_interface/tooltips.py b/util/_UI/_web_interface/tooltips.py
deleted file mode 100644
index b4ebfd1..0000000
--- a/util/_UI/_web_interface/tooltips.py
+++ /dev/null
@@ -1,210 +0,0 @@
-import dash_html_components as html
-import dash_bootstrap_components as dbc
-
-dsp_config_tooltips = html.Div([
- # Antenna arrangement selection
- dbc.Tooltip([
- html.P("ULA - Uniform Linear Array"),
- html.P("Antenna elements placed on a line with having equal distances between each other"),
- html.P("UCA - Uniform Circular Array"),
- html.P("Antenna elements are placed on circle equaly distributed on 360°")],
- target="label_ant_arrangement",
- placement="bottom",
- className="tooltip"
- ),
- # Antenna Spacing
-# dbc.Tooltip([
-# html.P("When ULA is selected: Spacing between antenna elements"),
-# html.P("When UCA is selected: Radius of the circle on which the elements are placed")],
-# target="label_ant_spacing",
-# placement="bottom",
-# className="tooltip"
-# ),
- # Enable F-B averaging
- dbc.Tooltip([
- html.P("Forward-backward averegaing improves the performance of DoA estimation in multipath environment"),
- html.P("(Available only for ULA antenna systems)")],
- target="label_en_fb_avg",
- placement="bottom",
- className="tooltip"
- ),
- ])
-
-daq_ini_config_tooltips = html.Div([
- # DAQ buffer size
- dbc.Tooltip([
- html.P("Buffer size of the realtek driver")],
- target="label_daq_buffer_size",
- placement="bottom",
- className="tooltip"
- ),
- # Sampling frequency
- dbc.Tooltip([
- html.P("Raw - ADC sampling frequency of the realtek chip")],
- target="label_sample_rate",
- placement="bottom",
- className="tooltip"
- ),
- # Enable noise source control
- dbc.Tooltip([
- html.P("Enables the utilization of the built-in noise source for calibration")],
- target="label_en_noise_source_ctr",
- placement="bottom",
- className="tooltip"
- ),
- # Enable squelch mode
- dbc.Tooltip([
- html.P("Enable DAQ-side squelch to capture burst like signals - NOTE DISABLED IN THIS VERSION, THIS VERSION USES DSP SIDE SQUELCH ONLY")],
- target="label_en_squelch",
- placement="bottom",
- className="tooltip"
- ),
- # Squelch threshold
- dbc.Tooltip([
- html.P("Amplitude threshold used for the squelch feature."),
- html.P("Should take values on range: 0...1"),
- html.P("When set to zero the squelch is bypassed")],
- target="label_squelch_init_threshold",
- placement="bottom",
- className="tooltip"
- ),
- # CPI size
- dbc.Tooltip([
- html.P("Length of the Coherent Processing Interval (CPI) after decimation")],
- target="label_cpi_size",
- placement="bottom",
- className="tooltip"
- ),
- # Decimation raito
- dbc.Tooltip([
- html.P("Decimation factor")],
- target="label_decimation_ratio",
- placement="bottom",
- className="tooltip"
- ),
- # FIR relative bandwidth
- dbc.Tooltip([
- html.P("Anti-aliasing filter bandwith after decimation"),
- html.P("Should take values on range: (0, 1]"),
- html.P("E.g.: ADC sampling frequency: 1 MHz (IQ!) , Decimation ratio: 2, FIR relative bandwith:0.25"),
- html.P("Resulting passband bandwidth: 125 kHz ")],
- target="label_fir_relative_bw",
- placement="bottom",
- className="tooltip"
- ),
- # FIR tap size
- dbc.Tooltip([
- html.P("Anti-aliasing FIR filter tap size - Do not set too large, or CPU utilization will be 100%"),
- html.P("Should be greater than the decimation ratio")],
- target="label_fir_tap_size",
- placement="bottom",
- className="tooltip"
- ),
- # FIR tap size
- dbc.Tooltip([
- html.P("Window function type for designing the anti-aliasing FIR filter"),
- html.P("https://en.wikipedia.org/wiki/Window_function")],
- target="label_fir_window",
- placement="bottom",
- className="tooltip"
- ),
- # Enable filter reset
- dbc.Tooltip([
- html.P("If enabled, the memory of the anti-aliasing FIR filter is reseted at the begining of every new CPI")],
- target="label_en_filter_reset",
- placement="bottom",
- className="tooltip"
- ),
- # Correlation size
- dbc.Tooltip([
- html.P("Number of samples used for the calibration procedure (sample delay and IQ compensation)")],
- target="label_correlation_size",
- placement="bottom",
- className="tooltip"
- ),
- # Standard channel index
- dbc.Tooltip([
- html.P("The selected channel is used as a reference for the IQ compensation")],
- target="label_std_ch_index",
- placement="bottom",
- className="tooltip"
- ),
- # Enable IQ calibration
- dbc.Tooltip([
- html.P("Enables to compensate the amplitude and phase differences of the receiver channels")],
- target="label_en_iq_calibration",
- placement="bottom",
- className="tooltip"
- ),
- # Gain lock interval
- dbc.Tooltip([
- html.P("Minimum number of stable frames before terminating the gain tuning procedure")],
- target="label_gain_lock_interval",
- placement="bottom",
- className="tooltip"
- ),
- # Require track lock intervention
- dbc.Tooltip([
- html.P("When enabled the DAQ firmware waits for manual intervention during the calibraiton procedure"),
- html.P("Should be used only for hardave version 1.0")],
- target="label_require_track_lock",
- placement="bottom",
- className="tooltip"
- ),
- # Amplitude calibraiton mode
- dbc.Tooltip([
- html.P("Amplitude difference compensation method applied as part of the IQ compensation"),
- html.P("default: Amplitude differences are estimated by calculating the cross-correlations of the channels"),
- html.P("disabled: Amplitude differences are not compensated"),
- html.P("channel_power: Ampltiude compensation is set in a way to achieve equal channel powers")],
- target="label_amplitude_calibration_mode",
- placement="bottom",
- className="tooltip"
- ),
- dbc.Tooltip([
- html.P("When periodic calibration track mode is selected the firmware regularly turn on the noise source for a short burst to\
- check whether the IQ calibration is still valid or not. In case the calibrated state is lost, the firmware automatically\
- initiates a reclaibration procedure")],
- target="label_calibration_track_mode",
- placement="bottom",
- className="tooltip"
- ),
-
- # Calibration frame interval
- dbc.Tooltip([
- html.P("Number of data frames between two consecutive calibration burst. Used when periodic calibration mode is selected")],
- target="label_calibration_frame_interval",
- placement="bottom",
- className="tooltip"
- ),
- # Calibration frame burst size
- dbc.Tooltip([
- html.P("Number of calibration frames generated in the periodic calibration mode")],
- target="label_calibration_frame_burst_size",
- placement="bottom",
- className="tooltip"
- ),
- # Amplitude tolerance
- dbc.Tooltip([
- html.P("Maximum allowed amplitude difference between the receiver channels")],
- target="label_amplitude_tolerance",
- placement="bottom",
- className="tooltip"
- ),
- # Phase tolerance
- dbc.Tooltip([
- html.P("Maximum allowed phase difference between the receiver channels")],
- target="label_phase_tolerance",
- placement="bottom",
- className="tooltip"
- ),
- # Maximum sync fails
- dbc.Tooltip([
- html.P("Maximum allowed consecutive IQ difference check failures before initiating a recalibration")],
- target="label_max_sync_fails",
- placement="bottom",
- className="tooltip"
- ),
- ])
-
-
diff --git a/util/_UI/save_settings.py b/util/_UI/save_settings.py
deleted file mode 100755
index 287bf7d..0000000
--- a/util/_UI/save_settings.py
+++ /dev/null
@@ -1,102 +0,0 @@
-import json
-import os
-
-"""
- Handles the DoA DSP settings
-
- Project: Kraken DoA DSP
- Author : Tamas Peto
-"""
-
-root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
-settings_file_path = os.path.join(root_path,"settings.json")
-
-settings_found =False
-if os.path.exists(settings_file_path):
- settings_found = True
- with open(settings_file_path, 'r') as myfile:
- settings=json.loads(myfile.read())
-
-# DAQ Configuration
-center_freq = settings.get("center_freq", 100.0)
-uniform_gain = settings.get("uniform_gain", 1.4)
-data_interface = settings.get("data_interface", "eth")
-default_ip = settings.get("default_ip", "0.0.0.0")
-
-# PR Paramaters
-en_pr = settings.get("en_pr", 0)
-clutter_cancel_algo = settings.get("clutter_cancel_algo", "Wiener MRE")
-max_bistatic_range = settings.get("max_bistatic_range", 128)
-max_doppler = settings.get("max_doppler", 256)
-en_pr_persist = settings.get("en_pr_persist", 1)
-pr_persist_decay = settings.get("pr_persist_decay", 0.99)
-pr_dynrange_min = settings.get("pr_dynrange_min", -20)
-pr_dynrange_max = settings.get("pr_dynrange_max", 100)
-#ant_arrangement = settings.get("ant_arrangement", "ULA")
-#ant_spacing = settings.get("ant_spacing", 0.5)
-#doa_method = settings.get("doa_method", "MUSIC")
-#en_fbavg = settings.get("en_fbavg", 0)
-#compass_offset = settings.get("compass_offset", 0)
-#doa_fig_type = settings.get("doa_fig_type", "Linear plot")
-
-# DSP misc
-#en_squelch = settings.get("en_squelch", 0)
-#squelch_threshold_dB = settings.get("squelch_threshold_dB", 0.0)
-
-# Web Interface
-en_hw_check = settings.get("en_hw_check", 0)
-en_advanced_daq_cfg = settings.get("en_advanced_daq_cfg", 0)
-logging_level = settings.get("logging_level", 0)
-disable_tooltips = settings.get("disable_tooltips", 0)
-
-# Check and correct if needed
-#if not ant_arrangement in ["ULA", "UCA"]:
-# ant_arrangement="ULA"
-
-#doa_method_dict = {"Bartlett":0, "Capon":1, "MEM":2, "MUSIC":3}
-#if not doa_method in doa_method_dict:
-# doa_method = "MUSIC"
-
-#doa_fig_type_dict = {"Linear plot":0, "Polar plot":1, "Compass":2}
-#if not doa_fig_type in doa_fig_type_dict:
-# doa_gfig_type="Linear plot"
-
-def write(data = None):
- if data is None:
- data = {}
-
- # DAQ Configuration
- data["center_freq"] = center_freq
- data["uniform_gain"] = uniform_gain
- data["data_interface"] = data_interface
- data["default_ip"] = default_ip
-
- # DOA Estimation
- data["en_pr"] = en_pr
- data["clutter_cancel_algo"] = clutter_cancel_algo
- data["max_bistatic_range"] = max_bistatic_range
- data["max_doppler"] = max_doppler
- data["en_pr_persist"] = en_pr_persist
- data["pr_persist_decay"] = pr_persist_decay
- data["pr_dynrange_min"] = pr_dynrange_min
- data["pr_dynrange_max"] = pr_dynrange_max
-
- #data["ant_arrangement"] = ant_arrangement
- #data["ant_spacing"] = ant_spacing
- #data["doa_method"] = doa_method
- #data["en_fbavg"] = en_fbavg
- #data["compass_offset"] = compass_offset
- #data["doa_fig_tpye"] = doa_fig_type
-
- # DSP misc
- #data["en_squelch"] = en_squelch
- #data["squelch_threshold_dB"] = squelch_threshold_dB
-
- # Web Interface
- data["en_hw_check"] = en_hw_check
- data["en_advanced_daq_cfg"] = en_advanced_daq_cfg
- data["logging_level"] = logging_level
- data["disable_tooltips"] = disable_tooltips
-
- with open(settings_file_path, 'w') as outfile:
- json.dump(data, outfile)
diff --git a/util/_receiver/iq_header.py b/util/_receiver/iq_header.py
deleted file mode 100755
index f439019..0000000
--- a/util/_receiver/iq_header.py
+++ /dev/null
@@ -1,152 +0,0 @@
-from struct import pack,unpack
-import logging
-import sys
-"""
- Desctiption: IQ Frame header definition
- For header field description check the corresponding documentation
- Total length: 1024 byte
- Project: HeIMDALL RTL
- Author: Tamás Pető
- Status: Finished
- Version history:
- 1 : Initial version (2019 04 23)
- 2 : Fixed 1024 byte length (2019 07 25)
- 3 : Noise source state (2019 10 01)
- 4 : IQ sync flag (2019 10 21)
- 5 : Sync state (2019 11 10)
- 6 : Unix Epoch timestamp (2019 12 17)
- 6a: Frame type defines (2020 03 19)
- 7 : Sync word (2020 05 03)
-"""
-class IQHeader():
-
- FRAME_TYPE_DATA = 0
- FRAME_TYPE_DUMMY = 1
- FRAME_TYPE_RAMP = 2
- FRAME_TYPE_CAL = 3
- FRAME_TYPE_TRIGW = 4
-
- SYNC_WORD = 0x2bf7b95a
-
- def __init__(self):
-
- self.logger = logging.getLogger(__name__)
- self.header_size = 1024 # size in bytes
- self.reserved_bytes = 192
-
- self.sync_word=self.SYNC_WORD # uint32_t
- self.frame_type=0 # uint32_t
- self.hardware_id="" # char [16]
- self.unit_id=0 # uint32_t
- self.active_ant_chs=0 # uint32_t
- self.ioo_type=0 # uint32_t
- self.rf_center_freq=0 # uint64_t
- self.adc_sampling_freq=0 # uint64_t
- self.sampling_freq=0 # uint64_t
- self.cpi_length=0 # uint32_t
- self.time_stamp=0 # uint64_t
- self.daq_block_index=0 # uint32_t
- self.cpi_index=0 # uint32_t
- self.ext_integration_cntr=0 # uint64_t
- self.data_type=0 # uint32_t
- self.sample_bit_depth=0 # uint32_t
- self.adc_overdrive_flags=0 # uint32_t
- self.if_gains=[0]*32 # uint32_t x 32
- self.delay_sync_flag=0 # uint32_t
- self.iq_sync_flag=0 # uint32_t
- self.sync_state=0 # uint32_t
- self.noise_source_state=0 # uint32_t
- self.reserved=[0]*self.reserved_bytes# uint32_t x reserverd_bytes
- self.header_version=0 # uint32_t
-
- def decode_header(self, iq_header_byte_array):
- """
- Unpack,decode and store the content of the iq header
- """
- iq_header_list = unpack("II16sIIIQQQIQIIQIII"+"I"*32+"IIII"+"I"*self.reserved_bytes+"I", iq_header_byte_array)
-
- self.sync_word = iq_header_list[0]
- self.frame_type = iq_header_list[1]
- self.hardware_id = iq_header_list[2].decode()
- self.unit_id = iq_header_list[3]
- self.active_ant_chs = iq_header_list[4]
- self.ioo_type = iq_header_list[5]
- self.rf_center_freq = iq_header_list[6]
- self.adc_sampling_freq = iq_header_list[7]
- self.sampling_freq = iq_header_list[8]
- self.cpi_length = iq_header_list[9]
- self.time_stamp = iq_header_list[10]
- self.daq_block_index = iq_header_list[11]
- self.cpi_index = iq_header_list[12]
- self.ext_integration_cntr = iq_header_list[13]
- self.data_type = iq_header_list[14]
- self.sample_bit_depth = iq_header_list[15]
- self.adc_overdrive_flags = iq_header_list[16]
- self.if_gains = iq_header_list[17:49]
- self.delay_sync_flag = iq_header_list[49]
- self.iq_sync_flag = iq_header_list[50]
- self.sync_state = iq_header_list[51]
- self.noise_source_state = iq_header_list[52]
- self.header_version = iq_header_list[52+self.reserved_bytes+1]
-
- def encode_header(self):
- """
- Pack the iq header information into a byte array
- """
- iq_header_byte_array=pack("II", self.sync_word, self.frame_type)
- iq_header_byte_array+=self.hardware_id.encode()+bytearray(16-len(self.hardware_id.encode()))
- iq_header_byte_array+=pack("IIIQQQIQIIQIII",
- self.unit_id, self.active_ant_chs, self.ioo_type, self.rf_center_freq, self.adc_sampling_freq,
- self.sampling_freq, self.cpi_length, self.time_stamp, self.daq_block_index, self.cpi_index,
- self.ext_integration_cntr, self.data_type, self.sample_bit_depth, self.adc_overdrive_flags)
- for m in range(32):
- iq_header_byte_array+=pack("I", self.if_gains[m])
-
- iq_header_byte_array+=pack("I", self.delay_sync_flag)
- iq_header_byte_array+=pack("I", self.iq_sync_flag)
- iq_header_byte_array+=pack("I", self.sync_state)
- iq_header_byte_array+=pack("I", self.noise_source_state)
-
- for m in range(self.reserved_bytes):
- iq_header_byte_array+=pack("I",0)
-
- iq_header_byte_array+=pack("I", self.header_version)
- return iq_header_byte_array
-
- def dump_header(self):
- """
- Prints out the content of the header in human readable format
- """
- self.logger.info("Sync word: {:d}".format(self.sync_word))
- self.logger.info("Header version: {:d}".format(self.header_version))
- self.logger.info("Frame type: {:d}".format(self.frame_type))
- self.logger.info("Hardware ID: {:16}".format(self.hardware_id))
- self.logger.info("Unit ID: {:d}".format(self.unit_id))
- self.logger.info("Active antenna channels: {:d}".format(self.active_ant_chs))
- self.logger.info("Illuminator type: {:d}".format(self.ioo_type))
- self.logger.info("RF center frequency: {:.2f} MHz".format(self.rf_center_freq/10**6))
- self.logger.info("ADC sampling frequency: {:.2f} MHz".format(self.adc_sampling_freq/10**6))
- self.logger.info("IQ sampling frequency {:.2f} MHz".format(self.sampling_freq/10**6))
- self.logger.info("CPI length: {:d}".format(self.cpi_length))
- self.logger.info("Unix Epoch timestamp: {:d}".format(self.time_stamp))
- self.logger.info("DAQ block index: {:d}".format(self.daq_block_index))
- self.logger.info("CPI index: {:d}".format(self.cpi_index))
- self.logger.info("Extended integration counter {:d}".format(self.ext_integration_cntr))
- self.logger.info("Data type: {:d}".format(self.data_type))
- self.logger.info("Sample bit depth: {:d}".format(self.sample_bit_depth))
- self.logger.info("ADC overdrive flags: {:d}".format(self.adc_overdrive_flags))
- for m in range(32):
- self.logger.info("Ch: {:d} IF gain: {:.1f} dB".format(m, self.if_gains[m]/10))
- self.logger.info("Delay sync flag: {:d}".format(self.delay_sync_flag))
- self.logger.info("IQ sync flag: {:d}".format(self.iq_sync_flag))
- self.logger.info("Sync state: {:d}".format(self.sync_state))
- self.logger.info("Noise source state: {:d}".format(self.noise_source_state))
-
- def check_sync_word(self):
- """
- Check the sync word of the header
- """
- if self.sync_word != self.SYNC_WORD:
- return -1
- else:
- return 0
diff --git a/util/_receiver/krakenSDR_receiver.py b/util/_receiver/krakenSDR_receiver.py
deleted file mode 100755
index a9e2d63..0000000
--- a/util/_receiver/krakenSDR_receiver.py
+++ /dev/null
@@ -1,375 +0,0 @@
-# KrakenSDR Receiver
-
-# Copyright (C) 2018-2021 Carl Laufer, Tamás Pető
-#
-#
-# 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
-# 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 <https://www.gnu.org/licenses/>.
-#
-
-# -*- coding: utf-8 -*-
-
-# Import built-in modules
-import sys
-import os
-import time
-from struct import pack, unpack
-import socket
-import _thread
-from threading import Lock
-import queue
-import logging
-#import copy
-
-# Import third party modules
-import numpy as np
-from scipy import signal
-from iq_header import IQHeader
-from shmemIface import inShmemIface
-class ReceiverRTLSDR():
-
- def __init__(self, data_que, data_interface = "eth", logging_level=10):
- """
- Parameter:
- ----------
- :param: data_que: Que to communicate with the UI (web iface/Qt GUI)
- :param: data_interface: This field is configured by the GUI during instantiation.
- Valid values are the followings:
- "eth" : The module will receiver IQ frames through an Ethernet connection
- "shmem": The module will receiver IQ frames through a shared memory interface
- :type : data_interface: string
- """
- self.logger = logging.getLogger(__name__)
- self.logger.setLevel(logging_level)
-
- # DAQ parameters
- # These values are used by default to configure the DAQ through the configuration interface
- # Values are configured externally upon configuration request
- self.daq_center_freq = 100 # MHz
- self.daq_rx_gain = 0 # [dB]
- self.daq_squelch_th_dB = 0
-
- # UI interface
- self.data_que = data_que
-
- # IQ data interface
- self.data_interface = data_interface
-
- # -> Ethernet
- self.receiver_connection_status = False
- self.port = 5000
- self.rec_ip_addr = "127.0.0.1" # Configured by the GUI prior to connection request
- self.socket_inst = socket.socket()
- self.receiverBufferSize = 2 ** 18 # Size of the Ethernet receiver buffer measured in bytes
-
- # -> Shared memory
- root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
- daq_path = os.path.join(os.path.dirname(root_path),"heimdall_daq_fw")
- self.daq_shmem_control_path = os.path.join(os.path.join(daq_path,"Firmware"),"_data_control/")
- self.init_data_iface()
-
- # Control interface
- self.ctr_iface_socket = socket.socket()
- self.ctr_iface_port = 5001
- self.ctr_iface_thread_lock = Lock() # Used to synchronize the operation of the ctr_iface thread
-
- self.iq_frame_bytes = None
- self.iq_samples = None
- self.iq_header = IQHeader()
- self.M = 0 # Number of receiver channels, updated after establishing connection
-
- def init_data_iface(self):
- if self.data_interface == "shmem":
- # Open shared memory interface to capture the DAQ firmware output
- self.in_shmem_iface = inShmemIface("delay_sync_iq", self.daq_shmem_control_path)
- if not self.in_shmem_iface.init_ok:
- self.logger.critical("Shared memory initialization failed")
- self.in_shmem_iface.destory_sm_buffer()
- return -1
- return 0
-
-
- def eth_connect(self):
- """
- Compatible only with DAQ firmwares that has the IQ streaming mode.
- HeIMDALL DAQ Firmware version: 1.0 or later
- """
- try:
- if not self.receiver_connection_status:
- if self.data_interface == "eth":
- # Establlish IQ data interface connection
- self.socket_inst.connect((self.rec_ip_addr, self.port))
- self.socket_inst.sendall(str.encode('streaming'))
- test_iq = self.receive_iq_frame()
-
- self.M = self.iq_header.active_ant_chs
-
- # Establish control interface connection
- self.ctr_iface_socket.connect((self.rec_ip_addr, self.ctr_iface_port))
- self.receiver_connection_status = True
- self.ctr_iface_init()
- self.logger.info("CTR INIT Center freq: {0}".format(self.daq_center_freq))
- self.set_center_freq(self.daq_center_freq)
- self.set_if_gain(self.daq_rx_gain)
- self.set_squelch_threshold(self.daq_squelch_th_dB)
- except:
- errorMsg = sys.exc_info()[0]
- self.logger.error("Error message: "+str(errorMsg))
- self.receiver_connection_status = False
- self.logger.error("Unexpected error: {0}".format(sys.exc_info()[0]))
-
- # Re-instantiating sockets
- self.socket_inst = socket.socket()
- self.ctr_iface_socket = socket.socket()
- return -1
-
- self.logger.info("Connection established")
- que_data_packet = []
- que_data_packet.append(['conn-ok',])
- self.data_que.put(que_data_packet)
-
- def eth_close(self):
- """
- Close Ethernet conenctions including the IQ data and the control interfaces
- """
- try:
- if self.receiver_connection_status:
- if self.data_interface == "eth":
- self.socket_inst.sendall(str.encode('q')) # Send exit message
- self.socket_inst.close()
- self.socket_inst = socket.socket() # Re-instantiating socket
-
- # Close control interface connection
- exit_message_bytes=("EXIT".encode()+bytearray(124))
- self.ctr_iface_socket.send(exit_message_bytes)
- self.ctr_iface_socket.close()
- self.ctr_iface_socket = socket.socket()
-
- self.receiver_connection_status = False
- que_data_packet = []
- que_data_packet.append(['disconn-ok',])
- self.data_que.put(que_data_packet)
- except:
- errorMsg = sys.exc_info()[0]
- self.logger.error("Error message: {0}".format(errorMsg))
- return -1
-
- if self.data_interface == "shmem":
- self.in_shmem_iface.destory_sm_buffer()
-
- return 0
-
- def get_iq_online(self):
- """
- This function obtains a new IQ data frame through the Ethernet IQ data or the shared memory interface
- """
-
- # Check connection
- if not self.receiver_connection_status:
- fail = self.eth_connect()
- if fail:
- return -1
-
- if self.data_interface == "eth":
- self.socket_inst.sendall(str.encode("IQDownload")) # Send iq request command
- self.iq_samples = self.receive_iq_frame()
-
- elif self.data_interface == "shmem":
- active_buff_index = self.in_shmem_iface.wait_buff_free()
- if active_buff_index < 0 or active_buff_index > 1:
- self.logger.info("Terminating.., signal: {:d}".format(active_buff_index))
- return -1
-
- buffer = self.in_shmem_iface.buffers[active_buff_index]
- iq_header_bytes = buffer[0:1024].tobytes()
- self.iq_header.decode_header(iq_header_bytes)
-
- # Inititalization from header - Set channel numbers
- if self.M == 0:
- self.M = self.iq_header.active_ant_chs
-
- incoming_payload_size = self.iq_header.cpi_length*self.iq_header.active_ant_chs*2*int(self.iq_header.sample_bit_depth/8)
- if incoming_payload_size > 0:
- iq_samples_in = (buffer[1024:1024 + incoming_payload_size].view(dtype=np.complex64))\
- .reshape(self.iq_header.active_ant_chs, self.iq_header.cpi_length)
- self.iq_samples = iq_samples_in.copy() # Must be .copy
-
- self.in_shmem_iface.send_ctr_buff_ready(active_buff_index)
-
- def receive_iq_frame(self):
- """
- Called by the get_iq_online function. Receives IQ samples over the establed Ethernet connection
- """
- total_received_bytes = 0
- recv_bytes_count = 0
- iq_header_bytes = bytearray(self.iq_header.header_size) # allocate array
- view = memoryview(iq_header_bytes) # Get buffer
-
- self.logger.debug("Starting IQ header reception")
-
- while total_received_bytes < self.iq_header.header_size:
- # Receive into buffer
- recv_bytes_count = self.socket_inst.recv_into(view, self.iq_header.header_size-total_received_bytes)
- view = view[recv_bytes_count:] # reset memory region
- total_received_bytes += recv_bytes_count
-
- self.iq_header.decode_header(iq_header_bytes)
- # Uncomment to check the content of the IQ header
- #self.iq_header.dump_header()
-
- incoming_payload_size = self.iq_header.cpi_length*self.iq_header.active_ant_chs*2*int(self.iq_header.sample_bit_depth/8)
- if incoming_payload_size > 0:
- # Calculate total bytes to receive from the iq header data
- total_bytes_to_receive = incoming_payload_size
- receiver_buffer_size = 2**18
-
- self.logger.debug("Total bytes to receive: {:d}".format(total_bytes_to_receive))
-
- total_received_bytes = 0
- recv_bytes_count = 0
- iq_data_bytes = bytearray(total_bytes_to_receive + receiver_buffer_size) # allocate array
- view = memoryview(iq_data_bytes) # Get buffer
-
- while total_received_bytes < total_bytes_to_receive:
- # Receive into buffer
- recv_bytes_count = self.socket_inst.recv_into(view, receiver_buffer_size)
- view = view[recv_bytes_count:] # reset memory region
- total_received_bytes += recv_bytes_count
-
- self.logger.debug(" IQ data succesfully received")
-
- # Convert raw bytes to Complex float64 IQ samples
- self.iq_samples = np.frombuffer(iq_data_bytes[0:total_bytes_to_receive], dtype=np.complex64).reshape(self.iq_header.active_ant_chs, self.iq_header.cpi_length)
-
- self.iq_frame_bytes = bytearray()+iq_header_bytes+iq_data_bytes
- return self.iq_samples
- else:
- return 0
-
- def set_squelch_threshold(self, threshold_dB):
- """
- Configures the threshold level of the squelch module in the DAQ FW through the control interface
- """
- if self.receiver_connection_status: # Check connection
- self.daq_squelch_th_dB = threshold_dB
- if threshold_dB == -80: threshold = 0
- else: threshold = 10**(threshold_dB/20)
-
- # Assembling message
- cmd="STHU"
- th_bytes=pack("f",threshold)
- msg_bytes=(cmd.encode()+th_bytes+bytearray(120))
- try:
- _thread.start_new_thread(self.ctr_iface_communication, (msg_bytes,))
- except:
- errorMsg = sys.exc_info()[0]
- self.logger.error("Unable to start communication thread")
- self.logger.error("Error message: {:s}".format(errorMsg))
-
- def ctr_iface_init(self):
- """
- Initialize connection with the DAQ FW through the control interface
- """
- if self.receiver_connection_status: # Check connection
- # Assembling message
- cmd="INIT"
- msg_bytes=(cmd.encode()+bytearray(124))
- try:
- _thread.start_new_thread(self.ctr_iface_communication, (msg_bytes,))
- except:
- errorMsg = sys.exc_info()[0]
- self.logger.error("Unable to start communication thread")
- self.logger.error("Error message: {:s}".format(errorMsg))
-
- def ctr_iface_communication(self, msg_bytes):
- """
- Handles communication on the control interface with the DAQ FW
-
- Parameters:
- -----------
-
- :param: msg: Message bytes, that will be sent ont the control interface
- :type: msg: Byte array
- """
- self.ctr_iface_thread_lock.acquire()
- self.logger.debug("Sending control message")
- self.ctr_iface_socket.send(msg_bytes)
-
- # Waiting for the command to take effect
- reply_msg_bytes = self.ctr_iface_socket.recv(128)
-
- self.logger.debug("Control interface communication finished")
- self.ctr_iface_thread_lock.release()
-
- status = reply_msg_bytes[0:4].decode()
- if status == "FNSD":
- self.logger.info("Reconfiguration succesfully finished")
- que_data_packet = []
- que_data_packet.append(['config-ok',])
- self.data_que.put(que_data_packet)
-
- else:
- self.logger.error("Failed to set the requested parameter, reply: {0}".format(status))
-
- def set_center_freq(self, center_freq):
- """
- Configures the RF center frequency of the receiver through the control interface
-
- Paramters:
- ----------
- :param: center_freq: Required center frequency to set [Hz]
- :type: center_freq: float
- """
- if self.receiver_connection_status: # Check connection
- self.daq_center_freq = int(center_freq)
- # Set center frequency
- cmd="FREQ"
- freq_bytes=pack("Q",int(center_freq))
- msg_bytes=(cmd.encode()+freq_bytes+bytearray(116))
- try:
- _thread.start_new_thread(self.ctr_iface_communication, (msg_bytes,))
- except:
- errorMsg = sys.exc_info()[0]
- self.logger.error("Unable to start communication thread")
- self.logger.error("Error message: {:s}".format(errorMsg))
-
- def set_if_gain(self, gain):
- """
- Configures the IF gain of the receiver through the control interface
-
- Paramters:
- ----------
- :param: gain: IF gain value [dB]
- :type: gain: int
- """
- if self.receiver_connection_status: # Check connection
- self.daq_rx_gain = gain
-
- # Set center frequency
- cmd="GAIN"
- gain_list=[297, 37] #[int(gain*10)]*self.M
- gain_bytes=pack("I"*self.M, *gain_list)
- msg_bytes=(cmd.encode()+gain_bytes+bytearray(128-(self.M+1)*4))
- try:
- _thread.start_new_thread(self.ctr_iface_communication, (msg_bytes,))
- except:
- errorMsg = sys.exc_info()[0]
- self.logger.error("Unable to start communication thread")
- self.logger.error("Error message: {:s}".format(errorMsg))
-
- def close(self):
- """
- Disconnet the receiver module and the DAQ FW
- """
- self.eth_close()
-
diff --git a/util/_receiver/shmemIface.py b/util/_receiver/shmemIface.py
deleted file mode 100755
index fd301b1..0000000
--- a/util/_receiver/shmemIface.py
+++ /dev/null
@@ -1,195 +0,0 @@
-"""
- HeIMDALL DAQ Firmware
- Python based shared memory interface implementations
-
- Author: Tamás Pető
- License: GNU GPL V3
-
- 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
- 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 <https://www.gnu.org/licenses/>.
-"""
-import logging
-from struct import pack, unpack
-from multiprocessing import shared_memory
-import numpy as np
-import os
-
-A_BUFF_READY = 1
-B_BUFF_READY = 2
-INIT_READY = 10
-TERMINATE = 255
-class outShmemIface():
-
-
- def __init__(self, shmem_name, shmem_size, drop_mode = False):
-
- self.init_ok = True
- logging.basicConfig(level=logging.INFO)
- self.logger = logging.getLogger(__name__)
- self.drop_mode = drop_mode
- self.dropped_frame_cntr = 0
-
- self.shmem_name = shmem_name
- self.buffer_free = [True, True]
-
- self.memories = []
- self.buffers = []
-
- # Try to remove shared memories if already exist
- try:
- shmem_A = shared_memory.SharedMemory(name=shmem_name+'_A',create=False, size=shmem_size)
- shmem_A.close()
- #shmem_A.unkink()
- except FileNotFoundError as err:
- self.logger.warning("Shared memory not exist")
- try:
- shmem_B = shared_memory.SharedMemory(name=shmem_name+'_B',create=False, size=shmem_size)
- shmem_B.close()
- #shmem_B.unkink()
- except FileNotFoundError as err:
- self.logger.warning("Shared memory not exist")
-
- # Create the shared memories
- self.memories.append(shared_memory.SharedMemory(name=shmem_name+'_A',create=True, size=shmem_size))
- self.memories.append(shared_memory.SharedMemory(name=shmem_name+'_B',create=True, size=shmem_size))
- self.buffers.append(np.ndarray((shmem_size,), dtype=np.uint8, buffer=self.memories[0].buf))
- self.buffers.append(np.ndarray((shmem_size,), dtype=np.uint8, buffer=self.memories[1].buf))
-
- # Opening control FIFOs
- if self.drop_mode:
- bw_fifo_flags = os.O_RDONLY | os.O_NONBLOCK
- else:
- bw_fifo_flags = os.O_RDONLY
- try:
- self.fw_ctr_fifo = os.open('_data_control/'+'fw_'+shmem_name, os.O_WRONLY)
- self.bw_ctr_fifo = os.open('_data_control/'+'bw_'+shmem_name, bw_fifo_flags)
- except OSError as err:
- self.logger.critical("OS error: {0}".format(err))
- self.logger.critical("Failed to open control fifos")
- self.bw_ctr_fifo = None
- self.fw_ctr_fifo = None
- self.init_ok = False
-
- # Send init ready signal
- if self.init_ok:
- os.write(self.fw_ctr_fifo, pack('B',INIT_READY))
-
- def send_ctr_buff_ready(self, active_buffer_index):
- # Send buffer ready signal on the forward FIFO
- if active_buffer_index == 0:
- os.write(self.fw_ctr_fifo, pack('B',A_BUFF_READY))
- elif active_buffer_index == 1:
- os.write(self.fw_ctr_fifo, pack('B',B_BUFF_READY))
-
- # Deassert buffer free flag
- self.buffer_free[active_buffer_index] = False
-
- def send_ctr_terminate(self):
- os.write(self.fw_ctr_fifo, pack('B',TERMINATE))
- self.logger.info("Terminate signal sent")
-
- def destory_sm_buffer(self):
- for memory in self.memories:
- memory.close()
- memory.unlink()
-
- if self.fw_ctr_fifo is not None:
- os.close(self.fw_ctr_fifo)
-
- if self.bw_ctr_fifo is not None:
- os.close(self.bw_ctr_fifo)
-
- def wait_buff_free(self):
- if self.buffer_free[0]:
- return 0
- elif self.buffer_free[1]:
- return 1
- else:
- try:
- buffer = os.read(self.bw_ctr_fifo, 1)
- signal = unpack('B', buffer )[0]
-
- if signal == A_BUFF_READY:
- self.buffer_free[0] = True
- return 0
- if signal == B_BUFF_READY:
- self.buffer_free[1] = True
- return 1
- except BlockingIOError as err:
- self.dropped_frame_cntr +=1
- self.logger.warning("Dropping frame.. Total: [{:d}] ".format(self.dropped_frame_cntr))
- return 3
- return -1
-
-
-class inShmemIface():
-
- def __init__(self, shmem_name, ctr_fifo_path="_data_control/"):
-
- self.init_ok = True
- logging.basicConfig(level=logging.INFO)
- self.logger = logging.getLogger(__name__)
- self.drop_mode = False
-
- self.shmem_name = shmem_name
-
- self.memories = []
- self.buffers = []
- try:
- self.fw_ctr_fifo = os.open(ctr_fifo_path+'fw_'+shmem_name, os.O_RDONLY)
- self.bw_ctr_fifo = os.open(ctr_fifo_path+'bw_'+shmem_name, os.O_WRONLY)
- except OSError as err:
- self.logger.critical("OS error: {0}".format(err))
- self.logger.critical("Failed to open control fifos")
- self.bw_ctr_fifo = None
- self.fw_ctr_fifo = None
- self.init_ok = False
-
- if self.fw_ctr_fifo is not None:
- if unpack('B', os.read(self.fw_ctr_fifo, 1))[0] == INIT_READY:
- self.memories.append(shared_memory.SharedMemory(name=shmem_name+'_A'))
- self.memories.append(shared_memory.SharedMemory(name=shmem_name+'_B'))
- self.buffers.append(np.ndarray((self.memories[0].size,),
- dtype=np.uint8,
- buffer=self.memories[0].buf))
- self.buffers.append(np.ndarray((self.memories[1].size,),
- dtype=np.uint8,
- buffer=self.memories[1].buf))
- else:
- self.init_ok = False
-
- def send_ctr_buff_ready(self, active_buffer_index):
- if active_buffer_index == 0:
- os.write(self.bw_ctr_fifo, pack('B',A_BUFF_READY))
- elif active_buffer_index == 1:
- os.write(self.bw_ctr_fifo, pack('B',B_BUFF_READY))
-
- def destory_sm_buffer(self):
- for memory in self.memories:
- memory.close()
-
- if self.fw_ctr_fifo is not None:
- os.close(self.fw_ctr_fifo)
-
- if self.bw_ctr_fifo is not None:
- os.close(self.bw_ctr_fifo)
-
- def wait_buff_free(self):
- signal = unpack('B', os.read(self.fw_ctr_fifo, 1))[0]
- if signal == A_BUFF_READY:
- return 0
- elif signal == B_BUFF_READY:
- return 1
- elif signal == TERMINATE:
- return TERMINATE
- return -1
diff --git a/util/_signal_processing/krakenSDR_signal_processor.py b/util/_signal_processing/krakenSDR_signal_processor.py
deleted file mode 100755
index 31f1836..0000000
--- a/util/_signal_processing/krakenSDR_signal_processor.py
+++ /dev/null
@@ -1,713 +0,0 @@
-# KrakenSDR Signal Processor
-#
-# Copyright (C) 2018-2021 Carl Laufer, Tamás Pető
-#
-# 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
-# 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 <https://www.gnu.org/licenses/>.
-#
-#
-# - coding: utf-8 -*-
-
-# Import built-in modules
-import sys
-import os
-import time
-import logging
-import threading
-import queue
-import math
-
-# Import optimization modules
-import numba as nb
-from numba import jit, njit
-from functools import lru_cache
-
-# Math support
-import numpy as np
-import numpy.linalg as lin
-#from numba import jit
-import pyfftw
-
-# Signal processing support
-import scipy
-from scipy import fft
-from scipy import signal
-from scipy.signal import correlate
-from scipy.signal import convolve
-
-from pyapril import channelPreparation as cp
-from pyapril import clutterCancellation as cc
-from pyapril import detector as det
-
-c_dtype = np.complex64
-
-#import socket
-# UDP is useless to us because it cannot work over mobile internet
-
-# Init UDP
-#server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
-#server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
-# Enable broadcasting mode
-#server.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
-# Set a timeout so the socket does not block
-# indefinitely when trying to receive data.
-#server.settimeout(0.2)
-
-class SignalProcessor(threading.Thread):
-
- def __init__(self, data_que, module_receiver, logging_level=10):
-
- """
- Parameters:
- -----------
- :param: data_que: Que to communicate with the UI (web iface/Qt GUI)
- :param: module_receiver: Kraken SDR DoA DSP receiver modules
- """
- super(SignalProcessor, self).__init__()
- self.logger = logging.getLogger(__name__)
- self.logger.setLevel(logging_level)
-
- root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
- doa_res_file_path = os.path.join(os.path.join(root_path,"_android_web","DOA_value.html"))
- self.DOA_res_fd = open(doa_res_file_path,"w+")
-
- self.module_receiver = module_receiver
- self.data_que = data_que
- self.en_spectrum = False
- self.en_record = False
- self.en_DOA_estimation = True
- self.first_frame = 1 # Used to configure local variables from the header fields
- self.processed_signal = np.empty(0)
-
- # Squelch feature
- self.data_ready = False
- self.en_squelch = False
- self.squelch_threshold = 0.1
- self.squelch_trigger_channel = 0
- self.raw_signal_amplitude = np.empty(0)
- self.filt_signal = np.empty(0)
- self.squelch_mask = np.empty(0)
-
- # DOA processing options
- self.en_DOA_Bartlett = False
- self.en_DOA_Capon = False
- self.en_DOA_MEM = False
- self.en_DOA_MUSIC = False
- self.en_DOA_FB_avg = False
- self.DOA_offset = 0
- self.DOA_inter_elem_space = 0.5
- self.DOA_ant_alignment = "ULA"
- self.DOA_theta = np.linspace(0,359,360)
-
- # PR processing options
- self.PR_clutter_cancellation = "Wiener MRE"
- self.max_bistatic_range = 128
- self.max_doppler = 256
- self.en_PR = True
-
-
- # Processing parameters
- self.spectrum_window_size = 2048 #1024
- self.spectrum_window = "hann"
- self.run_processing = False
- self.is_running = False
-
-
- self.channel_number = 4 # Update from header
-
- # Result vectors
- self.DOA_Bartlett_res = np.ones(181)
- self.DOA_Capon_res = np.ones(181)
- self.DOA_MEM_res = np.ones(181)
- self.DOA_MUSIC_res = np.ones(181)
- self.DOA_theta = np.arange(0,181,1)
-
- self.max_index = 0
- self.max_frequency = 0
- self.fft_signal_width = 0
-
- self.DOA_theta = np.linspace(0,359,360)
-
- self.spectrum = None #np.ones((self.channel_number+2,N), dtype=np.float32)
- self.spectrum_upd_counter = 0
-
-
- def run(self):
- """
- Main processing thread
- """
-
- pyfftw.config.NUM_THREADS = 4
- scipy.fft.set_backend(pyfftw.interfaces.scipy_fft)
- pyfftw.interfaces.cache.enable()
-
- while True:
- self.is_running = False
- time.sleep(1)
- while self.run_processing:
- self.is_running = True
-
- que_data_packet = []
- start_time = time.time()
-
- #-----> ACQUIRE NEW DATA FRAME <-----
- self.module_receiver.get_iq_online()
-
- # Check frame type for processing
- en_proc = (self.module_receiver.iq_header.frame_type == self.module_receiver.iq_header.FRAME_TYPE_DATA)# or \
- #(self.module_receiver.iq_header.frame_type == self.module_receiver.iq_header.FRAME_TYPE_CAL)# For debug purposes
- """
- You can enable here to process other frame types (such as call type frames)
- """
-
- que_data_packet.append(['iq_header',self.module_receiver.iq_header])
- self.logger.debug("IQ header has been put into the data que entity")
-
- # Configure processing parameteres based on the settings of the DAQ chain
- if self.first_frame:
- self.channel_number = self.module_receiver.iq_header.active_ant_chs
- self.spectrum_upd_counter = 0
- self.spectrum = np.ones((self.channel_number+2, self.spectrum_window_size), dtype=np.float32)
- self.first_frame = 0
-
- decimation_factor = 1
-
- self.data_ready = False
-
- if en_proc:
- self.processed_signal = self.module_receiver.iq_samples
- self.data_ready = True
-
- first_decimation_factor = 1 #480
-
- # TESTING: DSP side main decimation - significantly slower than NE10 but it works ok-ish
- #decimated_signal = signal.decimate(self.processed_signal, first_decimation_factor, n = 584, ftype='fir', zero_phase=True) #first_decimation_factor * 2, ftype='fir')
- #self.processed_signal = decimated_signal #.copy()
- #spectrum_signal = decimated_signal.copy()
-
- max_amplitude = -100
-
- #max_ch = np.argmax(np.max(self.spectrum[1:self.module_receiver.iq_header.active_ant_chs+1,:], axis=1)) # Find the channel that had the max amplitude
- max_amplitude = 0 #np.max(self.spectrum[1+max_ch, :]) #Max amplitude out of all 5 channels
- #max_spectrum = self.spectrum[1+max_ch, :] #Send max ch to channel centering
-
- que_data_packet.append(['max_amplitude',max_amplitude])
-
- #-----> SQUELCH PROCESSING <-----
-
- if self.en_squelch:
- self.data_ready = False
-
- self.processed_signal, decimation_factor, self.fft_signal_width, self.max_index = \
- center_max_signal(self.processed_signal, self.spectrum[0,:], max_spectrum, self.module_receiver.daq_squelch_th_dB, self.module_receiver.iq_header.sampling_freq)
-
- #decimated_signal = []
- #if(decimation_factor > 1):
- # decimated_signal = signal.decimate(self.processed_signal, decimation_factor, n = decimation_factor * 2, ftype='fir')
- # self.processed_signal = decimated_signal #.copy()
-
-
- #Only update if we're above the threshold
- if max_amplitude > self.module_receiver.daq_squelch_th_dB:
- self.data_ready = True
-
-
- #-----> SPECTRUM PROCESSING <-----
-
- if self.en_spectrum and self.data_ready:
-
- spectrum_samples = self.module_receiver.iq_samples #spectrum_signal #self.processed_signal #self.module_receiver.iq_samples #self.processed_signal
-
-
- N = self.spectrum_window_size
-
- N_perseg = 0
- N_perseg = min(N, len(self.processed_signal[0,:])//25)
- N_perseg = N_perseg // 1
-
- # Get power spectrum
- f, Pxx_den = signal.welch(self.processed_signal, self.module_receiver.iq_header.sampling_freq//first_decimation_factor,
- nperseg=N_perseg,
- nfft=N,
- noverlap=int(N_perseg*0.25),
- detrend=False,
- return_onesided=False,
- window= ('tukey', 0.25), #tukey window gives better time resolution for squelching #self.spectrum_window, #('tukey', 0.25), #self.spectrum_window,
- #window=self.spectrum_window,
- scaling="spectrum")
-
- self.spectrum[1:self.module_receiver.iq_header.active_ant_chs+1,:] = np.fft.fftshift(10*np.log10(Pxx_den))
-
- self.spectrum[0,:] = np.fft.fftshift(f)
-
-
- # Create signal window for plot
-# signal_window = np.ones(len(self.spectrum[1,:])) * -100
- # signal_window[max(self.max_index - self.fft_signal_width//2, 0) : min(self.max_index + self.fft_signal_width//2, len(self.spectrum[1,:]))] = max(self.spectrum[1,:])
- #signal_window = np.ones(len(max_spectrum)) * -100
- #signal_window[max(self.max_index - self.fft_signal_width//2, 0) : min(self.max_index + self.fft_signal_width//2, len(max_spectrum))] = max(max_spectrum)
-
- #self.spectrum[self.channel_number+1, :] = signal_window #np.ones(len(spectrum[1,:])) * self.module_receiver.daq_squelch_th_dB # Plot threshold line
- que_data_packet.append(['spectrum', self.spectrum])
-
- #-----> Passive Radar <-----
- conf_val = 0
- theta_0 = 0
- if self.en_PR and self.data_ready and self.channel_number > 1:
-
- ref_ch = self.module_receiver.iq_samples[0,:]
- surv_ch = self.module_receiver.iq_samples[1,:]
-
- td_filter_dimension = self.max_bistatic_range
-
- start = time.time()
-
- if self.PR_clutter_cancellation == "Wiener MRE":
- surv_ch, w = Wiener_SMI_MRE(ref_ch, surv_ch, td_filter_dimension)
- #surv_ch, w = cc.Wiener_SMI_MRE(ref_ch, surv_ch, td_filter_dimension)
-
- surv_ch = det.windowing(surv_ch, "Hamming") #surv_ch * signal.tukey(surv_ch.size, alpha=0.25) #det.windowing(surv_ch, "hamming")
-
- max_Doppler = self.max_doppler #256
- max_range = self.max_bistatic_range
-
- #RD_matrix = det.cc_detector_ons(ref_ch, surv_ch, self.module_receiver.iq_header.sampling_freq, max_Doppler, max_range, verbose=0, Qt_obj=None)
- RD_matrix = cc_detector_ons(ref_ch, surv_ch, self.module_receiver.iq_header.sampling_freq, max_Doppler, max_range)
-
- end = time.time()
- print("Time: " + str((end-start) * 1000))
-
- que_data_packet.append(['RD_matrix', RD_matrix])
-
- # Record IQ samples
- if self.en_record:
- # TODO: Implement IQ frame recording
- self.logger.error("Saving IQ samples to npy is obsolete, IQ Frame saving is currently not implemented")
-
- stop_time = time.time()
- que_data_packet.append(['update_rate', stop_time-start_time])
- que_data_packet.append(['latency', int(stop_time*10**3)-self.module_receiver.iq_header.time_stamp])
-
- # If the que is full, and data is ready (from squelching), clear the buffer immediately so that useful data has the priority
- if self.data_que.full() and self.data_ready:
- try:
- #self.logger.info("BUFFER WAS NOT EMPTY, EMPTYING NOW")
- self.data_que.get(False) #empty que if not taken yet so fresh data is put in
- except queue.Empty:
- #self.logger.info("DIDNT EMPTY")
- pass
-
- # Put data into buffer, but if there is no data because its a cal/trig wait frame etc, then only write if the buffer is empty
- # Otherwise just discard the data so that we don't overwrite good DATA frames.
- try:
- self.data_que.put(que_data_packet, False) # Must be non-blocking so DOA can update when dash browser window is closed
- except:
- # Discard data, UI couldn't consume fast enough
- pass
-
- """
- start = time.time()
- end = time.time()
- thetime = ((end - start) * 1000)
- print ("Time elapsed: ", thetime)
- """
-@jit(fastmath=True)
-def Wiener_SMI_MRE(ref_ch, surv_ch, K):
- """
- Description:
- ------------
- Performs Wiener filtering with applying the Minimum Redundance Estimation (MRE) technique.
- When using MRE, the autocorrelation matrix is not fully estimated, but only the first column.
- With this modification the required calculations can be reduced from KxK to K element.
-
- Parameters:
- -----------
- :param K : Filter tap number
- :param ref_ch : Reference signal array
- :param surv_ch: Surveillance signal array
-
- :type K : int
- :type ref_ch : 1 x N complex numpy array
- :type surv_ch: 1 x N complex numpy array
- Return values:
- --------------
- :return filt: Filtered surveillance channel
- :rtype filt: 1 x N complex numpy array
-
- :return None: Input parameters are not consistent
- """
-
- N = ref_ch.shape[0] # Number of time samples
- R, r = pruned_correlation(ref_ch, surv_ch, K, N)
- R_mult = R_eye_memoize(K)
- w = fast_w(R, r, K, R_mult)
-
- #return surv_ch - np.convolve(ref_ch, w)[0:N], w # subtract the zero doppler clutter
- return surv_ch - signal.oaconvolve(ref_ch, w)[0:N], w # subtract the zero doppler clutter #oaconvolve saves us about 100-200 ms
-
-@njit(fastmath=True, parallel=True, cache=True)
-def fast_w(R, r, K, R_mult):
- # Complete the R matrix based on its Hermitian and Toeplitz property
-
- for k in range(1, K):
- R[:, k] = shift(R[:, 0], k)
- #R[:, K] = shift(R[:,0], K)
-
- R += np.transpose(np.conjugate(R))
- R *= R_mult #(np.ones(K) - np.eye(K) * 0.5)
-
- #w = np.dot(lin.inv(R), r) # weight vector
- w = lin.inv(R) @ r #np.dot(lin.inv(R), r) # weight vector #matmul (@) may be slightly faster that np.dot for 1D, 2D arrays.
- # inverse and dot product run time : 1.1s for 2048*2048 matrix
-
- return w
-
-#Memoize ~50ms speedup?
-@lru_cache(maxsize=2)
-def R_eye_memoize(K):
- return (np.ones(K) - np.eye(K) * 0.5)
-
-#Modified pruned correlation, returns R and r directly and saves one FFT
-@jit(fastmath=True, cache=True)
-def pruned_correlation(ref_ch, surv_ch, clen, N):
- """
- Description:
- -----------
- Calculates the part of the correlation function of arrays with same size
- The total length of the cross-correlation function is 2*N-1, but this
- function calculates the values of the cross-correlation between [N-1 : N+clen-1]
- Parameters:
- -----------
- :param x : input array
- :param y : input array
- :param clen: correlation length
-
- :type x: 1 x N complex numpy array
- :type y: 1 x N complex numpy array
- :type clen: int
- Return values:
- --------------
- :return corr : part of the cross-correlation function
- :rtype corr : 1 x clen complex numpy array
-
- :return None : inconsistent array size
- """
- R = np.zeros((clen, clen), dtype=c_dtype) # Autocorrelation mtx.
-
- # --calculation--
- # set up input matrices pad zeros if not multiply of the correlation length
- cols = clen - 1 #(clen = Filter drowsimension)
- rows = np.int32(N / (cols)) + 1
-
- zeropads = cols * rows - N
- x = np.pad(ref_ch, (0, zeropads))
-
- # shaping inputs into matrices
- xp = np.reshape(x, (rows, cols))
-
- # padding matrices for FFT
- ypp = np.vstack([xp[1:, :], np.zeros(cols, dtype=c_dtype)]) #vstack appears to be faster than pad
- yp = np.concatenate([xp, ypp], axis=1)
-
- # execute FFT on the matrices
- xpw = fft.fft(xp, n = 2*cols, axis=1, workers=4, overwrite_x=True)
- bpw = fft.fft(yp, axis=1, workers=4, overwrite_x=True)
-
- # magic formula which describes the unified equation of the universe
- # corr_batches = np.fliplr(fft.fftshift(fft.ifft(corr_mult(xpw, bpw), axis=1, workers=4, overwrite_x=True)).conj()[:, 0:clen])
- corr_batches = fft.fftshift(fft.ifft(corr_mult(xpw, bpw), axis=1, workers=4, overwrite_x=True)).conj()[:, 0:clen]
-
- # sum each value in a column of the batched correlation matrix
- R[:,0] = np.fliplr([np.sum(corr_batches, axis=0)])[0]
-
- #calc r
- y = np.pad(surv_ch, (0, zeropads))
- yp = np.reshape(y, (rows, cols))
- ypp = np.vstack([yp[1:, :], np.zeros(cols, dtype=c_dtype)]) #vstack appears to be faster than pad
- yp = np.concatenate([yp, ypp], axis=1)
- bpw = fft.fft(yp, axis=1, workers=4, overwrite_x=True)
- #corr_batches = np.fliplr(fft.fftshift(fft.ifft(corr_mult(xpw, bpw), axis=1, workers=4, overwrite_x=True)).conj()[:, 0:clen])
- corr_batches = fft.fftshift(fft.ifft(corr_mult(xpw, bpw), axis=1, workers=4, overwrite_x=True)).conj()[:, 0:clen]
- #r = np.sum(corr_batches, axis=0)
- r = np.fliplr([np.sum(corr_batches, axis=0)])[0]
-
- return R, r
-
-@njit(fastmath=True, cache=True)
-def shift(x, i):
- """
- Description:
- -----------
- Similar to np.roll function, but not circularly shift values
- Example:
- x = |x0|x1|...|xN-1|
- y = shift(x,2)
- x --> y: |0|0|x0|x1|...|xN-3|
- Parameters:
- -----------
- :param:x : input array on which the roll will be performed
- :param i : delay value [sample]
-
- :type i :int
- :type x: N x 1 complex numpy array
- Return values:
- --------------
- :return shifted : shifted version of x
- :rtype shifted: N x 1 complex numpy array
- """
-
- N = x.shape[0]
- if np.abs(i) >= N:
- return np.zeros(N, dtype=c_dtype)
- if i == 0:
- return x
- shifted = np.roll(x, i)
- if i < 0:
- shifted[np.mod(N + i, N):] = np.zeros(np.abs(i), dtype=c_dtype)
- if i > 0:
- shifted[0:i] = np.zeros(np.abs(i), dtype=c_dtype)
- return shifted
-
-
-@njit(fastmath=True, parallel=True, cache=True)
-def resize_and_align(no_sub_tasks, ref_ch, surv_ch, fs, fD_max, r_max):
- surv_ch_align = np.reshape(surv_ch,(no_sub_tasks, r_max)) # shaping surveillance signal array into a matrix
- pad_zeros = np.expand_dims(np.zeros(r_max, dtype=c_dtype), axis=0)
- surv_ch_align = np.vstack((surv_ch_align, pad_zeros)) # padding one row of zeros into the surv matrix
- surv_ch_align = np.concatenate((surv_ch_align[0 : no_sub_tasks,:], surv_ch_align[1 : no_sub_tasks +1, :]), axis = 1)
-
- ref_ch_align = np.reshape(ref_ch, (no_sub_tasks, r_max)) # shaping reference signal array into a matrix
- pad_zeros = np.zeros((no_sub_tasks, r_max),dtype = c_dtype)
- ref_ch_align = np.concatenate((ref_ch_align, pad_zeros),axis = 1) # shaping
-
- return ref_ch_align, surv_ch_align
-
-@njit(fastmath=True, cache=True)
-def corr_mult(surv_fft, ref_fft):
- return np.multiply(surv_fft, ref_fft.conj())
-
-@jit(fastmath=True, cache=True)
-def cc_detector_ons(ref_ch, surv_ch, fs, fD_max, r_max):
- """
- Parameters:
- -----------
- :param N: Range resolution - N must be a divisor of the input length
- :param F: Doppler resolution, F has a theoretical limit. If you break the limit, the output may repeat
- itself and get wrong results. F should be less than length/N otherwise use other method!
- Return values:
- --------------
- :return None: Improper input parameters
-
- """
- N = ref_ch.size
-
- # --> Set processing parameters
- fD_step = fs / (2 * N) # Doppler frequency step size (with zero padding)
- Doppler_freqs_size = int(fD_max / fD_step)
- no_sub_tasks = N // r_max
-
- # Allocate range-Doppler maxtrix
- mx = np.zeros((2*Doppler_freqs_size+1, r_max),dtype = c_dtype) #memoize_zeros((2*Doppler_freqs_size+1, r_max), c_dtype) #np.zeros((2*Doppler_freqs_size+1, r_max),dtype = nb.c8)
-
- ref_ch_align, surv_ch_align = resize_and_align(no_sub_tasks, ref_ch, surv_ch, fs, fD_max, r_max)
-
- # row wise fft on both channels
- ref_fft = fft.fft(ref_ch_align, axis = 1, overwrite_x=True, workers=4) #pyfftw.interfaces.numpy_fft.fft(ref_ch_align_a, axis = 1, overwrite_input=True, threads=4) #fft.fft(ref_ch_align_a, axis = 1, overwrite_x=True, workers=4)
- surv_fft = fft.fft(surv_ch_align, axis = 1, overwrite_x=True, workers=4) #pyfftw.interfaces.numpy_fft.fft(surv_ch_align_a, axis = 1, overwrite_input=True, threads=4) #fft.fft(surv_ch_align_a, axis = 1, overwrite_x=True, workers=4)
-
- corr = corr_mult(surv_fft, ref_fft) #np.multiply(surv_fft, ref_fft.conj())
-
- corr = fft.ifft(corr,axis = 1, workers=4, overwrite_x=True)
-
- corr_a = pyfftw.empty_aligned(np.shape(corr), dtype=c_dtype)
- corr_a[:] = corr #.copy()
-
- # This is the most computationally intensive part ~120ms, overwrite_x=True gives a big speedup, not sure if it changes the result though...
- corr = fft.fft(corr_a, n=2* no_sub_tasks, axis = 0, workers=4, overwrite_x=True) # Setting the output size with "n=.." is faster than doing a concat first.
-
- # crop and fft shift
- mx[ 0 : Doppler_freqs_size, 0 : r_max] = corr[2*no_sub_tasks - Doppler_freqs_size : 2*no_sub_tasks, 0 : r_max]
- mx[Doppler_freqs_size : 2 * Doppler_freqs_size+1, 0 : r_max] = corr[ 0 : Doppler_freqs_size+1 , 0 : r_max]
-
- return mx
-
-
-
-
-
-
-#NUMBA optimized center tracking. Gives a mild speed boost ~25% faster.
-@njit(fastmath=True, cache=True, parallel=True)
-def center_max_signal(processed_signal, frequency, fft_spectrum, threshold, sample_freq):
-
- # Where is the max frequency? e.g. where is the signal?
- max_index = np.argmax(fft_spectrum)
- max_frequency = frequency[max_index]
-
- # Auto decimate down to exactly the max signal width
- fft_signal_width = np.sum(fft_spectrum > threshold) + 25
- decimation_factor = max((sample_freq // fft_signal_width) // 2, 1)
-
- # Auto shift peak frequency center of spectrum, this frequency will be decimated:
- # https://pysdr.org/content/filters.html
- f0 = -max_frequency #+10
- Ts = 1.0/sample_freq
- t = np.arange(0.0, Ts*len(processed_signal[0, :]), Ts)
- exponential = np.exp(2j*np.pi*f0*t) # this is essentially a complex sine wave
-
- return processed_signal * exponential, decimation_factor, fft_signal_width, max_index
-
-
-# NUMBA optimized MUSIC function. About 100x faster on the Pi 4
-@njit(fastmath=True, cache=True)
-def DOA_MUSIC(R, scanning_vectors, signal_dimension, angle_resolution=1):
- # --> Input check
- if R[:,0].size != R[0,:].size:
- print("ERROR: Correlation matrix is not quadratic")
- return np.ones(1, dtype=nb.c16)*-1 #[(-1, -1j)]
-
- if R[:,0].size != scanning_vectors[:,0].size:
- print("ERROR: Correlation matrix dimension does not match with the antenna array dimension")
- return np.ones(1, dtype=nb.c16)*-2
-
- #ADORT = np.zeros(scanning_vectors[0,:].size, dtype=np.complex) #CHANGE TO nb.c16 for NUMBA
- ADORT = np.zeros(scanning_vectors[0,:].size, dtype=nb.c16)
- M = R[:,0].size #np.size(R, 0)
-
- # --- Calculation ---
- # Determine eigenvectors and eigenvalues
- sigmai, vi = lin.eig(R)
- sigmai = np.abs(sigmai)
-
- idx = sigmai.argsort()[::1] # Sort eigenvectors by eigenvalues, smallest to largest
- #sigmai = sigmai[idx] # Eigenvalues not used again
- vi = vi[:,idx]
-
- # Generate noise subspace matrix
- noise_dimension = M - signal_dimension
- #E = np.zeros((M, noise_dimension),dtype=np.complex)
- E = np.zeros((M, noise_dimension),dtype=nb.c16)
- for i in range(noise_dimension):
- E[:,i] = vi[:,i]
-
- theta_index=0
- for i in range(scanning_vectors[0,:].size):
- S_theta_ = scanning_vectors[:, i]
- S_theta_ = S_theta_.T
- ADORT[theta_index] = 1/np.abs(S_theta_.conj().T @ (E @ E.conj().T) @ S_theta_)
- theta_index += 1
-
- return ADORT
-
-# Numba optimized version of pyArgus corr_matrix_estimate with "fast". About 2x faster on Pi4
-@njit(fastmath=True, cache=True) #(nb.c8[:,:](nb.c16[:,:]))
-def corr_matrix(X):
- M = X[:,0].size
- N = X[0,:].size
- #R = np.zeros((M, M), dtype=nb.c8)
- R = np.dot(X, X.conj().T)
- R = np.divide(R, N)
- return R
-
-# Numba optimized scanning vectors generation for UCA arrays. About 10x faster on Pi4
-# LRU cache memoize about 1000x faster.
-@lru_cache(maxsize=8)
-def uca_scanning_vectors(M, DOA_inter_elem_space):
-
- thetas = np.linspace(0,359,360) # Remember to change self.DOA_thetas too, we didn't include that in this function due to memoization cannot work with arrays
-
- x = DOA_inter_elem_space * np.cos(2*np.pi/M * np.arange(M))
- y = -DOA_inter_elem_space * np.sin(2*np.pi/M * np.arange(M)) # For this specific array only
-
- scanning_vectors = np.zeros((M, thetas.size), dtype=np.complex)
- for i in range(thetas.size):
- scanning_vectors[:,i] = np.exp(1j*2*np.pi* (x*np.cos(np.deg2rad(thetas[i])) + y*np.sin(np.deg2rad(thetas[i]))))
-
- return scanning_vectors
- # scanning_vectors = de.gen_scanning_vectors(M, x, y, self.DOA_theta)
-
-@njit(fastmath=True, cache=True)
-def DOA_plot_util(DOA_data, log_scale_min=-100):
- """
- This function prepares the calulcated DoA estimation results for plotting.
-
- - Noramlize DoA estimation results
- - Changes to log scale
- """
-
- DOA_data = np.divide(np.abs(DOA_data), np.max(np.abs(DOA_data))) # Normalization
- DOA_data = 10*np.log10(DOA_data) # Change to logscale
-
- for i in range(len(DOA_data)): # Remove extremely low values
- if DOA_data[i] < log_scale_min:
- DOA_data[i] = log_scale_min
-
- return DOA_data
-
-@njit(fastmath=True, cache=True)
-def calculate_doa_papr(DOA_data):
- return 10*np.log10(np.max(np.abs(DOA_data))/np.mean(np.abs(DOA_data)))
-
-# Old time-domain squelch algorithm (Unused as freq domain FFT with overlaps gives significantly better sensitivity with acceptable time resolution expense
-"""
- K = 10
- self.filtered_signal = self.raw_signal_amplitude #convolve(np.abs(self.raw_signal_amplitude),np.ones(K), mode = 'same')/K
-
- # Burst is always started at the begining of the processed block, ensured by the squelch module in the DAQ FW
- burst_stop_index = len(self.filtered_signal) # CARL FIX: Initialize this to the length of the signal, incase the signal is active the entire time
- self.logger.info("Original burst stop index: {:d}".format(burst_stop_index))
-
- min_burst_size = K
- burst_stop_amp_val = 0
- for n in np.arange(K, len(self.filtered_signal), 1):
- if self.filtered_signal[n] < self.squelch_threshold:
- burst_stop_amp_val = self.filtered_signal[n]
- burst_stop_index = n
- burst_stop_index-=K # Correction with the length of filter
- break
-
- #burst_stop_index-=K # Correction with the length of filter
-
-
- self.logger.info("Burst stop index: {:d}".format(burst_stop_index))
- self.logger.info("Burst stop ampl val: {:f}".format(burst_stop_amp_val))
- self.logger.info("Processed signal length: {:d}".format(len(self.processed_signal[0,:])))
-
- # If sign
- if burst_stop_index < min_burst_size:
- self.logger.debug("The length of the captured burst size is under the minimum: {:d}".format(burst_stop_index))
- burst_stop_index = 0
-
- if burst_stop_index !=0:
- self.logger.info("INSIDE burst_stop_index != 0")
-
- self.logger.debug("Burst stop index: {:d}".format(burst_stop_index))
- self.logger.debug("Burst stop ampl val: {:f}".format(burst_stop_amp_val))
- self.squelch_mask = np.zeros(len(self.filtered_signal))
- self.squelch_mask[0 : burst_stop_index] = np.ones(burst_stop_index)*self.squelch_threshold
- # Next line removes the end parts of the samples after where the signal ended, truncating the array
- self.processed_signal = self.module_receiver.iq_samples[: burst_stop_index, self.squelch_mask == self.squelch_threshold]
- self.logger.info("Raw signal length when burst_stop_index!=0: {:d}".format(len(self.module_receiver.iq_samples[0,:])))
- self.logger.info("Processed signal length when burst_stop_index!=0: {:d}".format(len(self.processed_signal[0,:])))
-
- #self.logger.info(' '.join(map(str, self.processed_signal)))
-
- self.data_ready=True
- else:
- self.logger.info("Signal burst is not found, try to adjust the threshold levels")
- #self.data_ready=True
- self.squelch_mask = np.ones(len(self.filtered_signal))*self.squelch_threshold
- self.processed_signal = np.zeros([self.channel_number, len(self.filtered_signal)])
-"""
-
-
diff --git a/util/doc/kraken_doadsp_main.png b/util/doc/kraken_doadsp_main.png
deleted file mode 100755
index d6da987..0000000
--- a/util/doc/kraken_doadsp_main.png
+++ /dev/null
Binary files differ
diff --git a/util/gui_run.sh b/util/gui_run.sh
deleted file mode 100755
index 4b1c598..0000000
--- a/util/gui_run.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-
-IPADDR="0.0.0.0"
-IPPORT="8081"
-
-echo "Starting KrakenSDR Passive Radar"
-
-# Use only for debugging
-#sudo python3 _UI/_web_interface/kraken_web_interface.py 2> ui.log &
-
-#sudo gunicorn -w 1 --threads 12 -b $IPADDR:8050 --chdir _UI/_web_interface kraken_web_interface:server 2> ui.log &
-#sudo gunicorn -w 1 --threads 2 -b $IPADDR:8050 --chdir _UI/_web_interface kraken_web_interface:server 2> ui.log &
-
-python3 _UI/_web_interface/kraken_web_interface.py 2> ui.log &
-
-# Start PHP webserver to interface with Android devices
-#echo "Python Server running at $IPADDR:8050"
-#echo "PHP Server running at $IPADDR:$IPPORT"
-#sudo php -S $IPADDR:$IPPORT -t _android_web 2> /dev/null &
diff --git a/util/kill.sh b/util/kill.sh
deleted file mode 100755
index 1845f48..0000000
--- a/util/kill.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#/bin/sh!
-sudo kill $(ps ax | grep "[p]ython3 _UI/_web_interface/kraken_web_interface.py" | awk '{print $1}') 2> /dev/null
-sudo kill $(ps ax | grep "[p]hp" | awk '{print $1}') 2> /dev/null
-sudo pkill -f gunicorn
-
diff --git a/util/kraken_doa_start.sh b/util/kraken_doa_start.sh
deleted file mode 100755
index 656ac65..0000000
--- a/util/kraken_doa_start.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-eval "$(conda shell.bash hook)"
-conda activate kraken
-
-./kraken_doa_stop.sh
-
-cd heimdall_daq_fw/Firmware
-#sudo ./daq_synthetic_start.sh
-sudo env "PATH=$PATH" ./daq_start_sm.sh
-sleep 2
-cd ../../krakensdr_doa
-sudo env "PATH=$PATH" ./gui_run.sh
diff --git a/util/kraken_doa_stop.sh b/util/kraken_doa_stop.sh
deleted file mode 100755
index ce85571..0000000
--- a/util/kraken_doa_stop.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-cd heimdall_daq_fw/Firmware
-./daq_stop.sh
-
-cd ../../krakensdr_doa
-./kill.sh
diff --git a/util/settings.json b/util/settings.json
deleted file mode 100755
index 8ec14fd..0000000
--- a/util/settings.json
+++ /dev/null
@@ -1 +0,0 @@
-{"center_freq": 569.0, "uniform_gain": 7.7, "data_interface": "shmem", "default_ip": "0.0.0.0", "en_pr": true, "clutter_cancel_algo": "Wiener MRE", "max_bistatic_range": 128, "max_doppler": 256, "en_pr_persist": true, "pr_persist_decay": 0.99, "pr_dynrange_min": -20, "pr_dynrange_max": 10, "en_hw_check": 0, "en_advanced_daq_cfg": false, "logging_level": 5, "disable_tooltips": 0} \ No newline at end of file
diff --git a/util/settings.json_old b/util/settings.json_old
deleted file mode 100755
index 9862885..0000000
--- a/util/settings.json_old
+++ /dev/null
@@ -1 +0,0 @@
-{"center_freq": 569.0, "uniform_gain": 7.7, "data_interface": "shmem", "default_ip": "0.0.0.0", "en_pr": true, "ant_arrangement": "UCA", "ant_spacing": 0.40399, "doa_method": "MUSIC", "en_fbavg": false, "compass_offset": 0, "doa_fig_type": "Linear plot", "en_squelch": false, "squelch_threshold_dB": -65, "en_hw_check": 0, "en_advanced_daq_cfg": [], "logging_level": 5, "disable_tooltips": 0}
diff --git a/util/setup_init.sh b/util/setup_init.sh
deleted file mode 100755
index 7097883..0000000
--- a/util/setup_init.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#/bin/bash!
-
-# PhP for android device support
-sudo apt install php7.4-cli
-
-echo "Set execution rights"
-sudo chmod +x ../gui_run.sh
-sudo chmod +x ../kill.sh
-echo "Install dependencies"
-python3 -m pip install numpy
-python3 -m pip install scipy
-python3 -m pip install pyargus
-python3 -m pip install matplotlib
-
-# For web interface
-python3 -m pip install dash
-python3 -m pip install dash-bootstrap-components
-python3 -m pip install gunicorn \ No newline at end of file